added WriteVarInt64 ReadVarInt64
This commit is contained in:
@@ -907,6 +907,52 @@ func TestPutGetVarUint64(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// WRITE & READ VAR UINT64
|
||||
|
||||
func TestWriteReadVarUint64(t *testing.T) {
|
||||
for _, testCase := range varUint64TestCases {
|
||||
w := bytes.NewBuffer(nil)
|
||||
putCount, err := WriteVarUint64(w, testCase.Num)
|
||||
if err != nil {
|
||||
t.Fatalf("put %d: %s\n", testCase.Num, err)
|
||||
}
|
||||
decoded, err := ReadVarUint64(w)
|
||||
if err != nil {
|
||||
t.Fatalf("get %d: %s\n", testCase.Num, err)
|
||||
}
|
||||
if decoded != testCase.Num {
|
||||
t.Fatalf("num %d not equal decoded %d", testCase.Num, decoded)
|
||||
}
|
||||
if putCount != testCase.Count {
|
||||
t.Fatalf("count %d not equal put count %d of num %d",
|
||||
testCase.Count, putCount, testCase.Num)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// WRITE & READ VAR INT64
|
||||
|
||||
func TestWriteReadVarInt64(t *testing.T) {
|
||||
for _, testCase := range varInt64TestCases {
|
||||
w := bytes.NewBuffer(nil)
|
||||
putCount, err := WriteVarInt64(w, testCase.Num)
|
||||
if err != nil {
|
||||
t.Fatalf("put %d: %s\n", testCase.Num, err)
|
||||
}
|
||||
decoded, err := ReadVarInt64(w)
|
||||
if err != nil {
|
||||
t.Fatalf("get %d: %s\n", testCase.Num, err)
|
||||
}
|
||||
if decoded != testCase.Num {
|
||||
t.Fatalf("num %d not equal decoded %d", testCase.Num, decoded)
|
||||
}
|
||||
if putCount != testCase.Count {
|
||||
t.Fatalf("count %d not equal put count %d of num %d",
|
||||
testCase.Count, putCount, testCase.Num)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// WRITE & READ VAR SIZE
|
||||
|
||||
func TestWriteReadVarSize(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user