Sha256: 730d0e633ed638d3085814126a020891bd8a0e01cfc9a1e34f630ed8bb21684b
Contents?: true
Size: 1.16 KB
Versions: 93
Compression:
Stored size: 1.16 KB
Contents
package variablelengthquantity import ( "bytes" "reflect" "testing" ) const targetTestVersion = 4 func TestTestVersion(t *testing.T) { if testVersion != targetTestVersion { t.Fatalf("Found testVersion = %v, want %v.", testVersion, targetTestVersion) } } func TestDecodeVarint(t *testing.T) { for i, tc := range decodeTestCases { o, err := DecodeVarint(tc.input) if err != nil { var _ error = err if tc.output != nil { t.Fatalf("FAIL: case %d | %s\nexpected %#v got error: %q\n", i, tc.description, tc.output, err) } } else if tc.output == nil { t.Fatalf("FAIL: case %d | %s\nexpected error, got %#v\n", i, tc.description, o) } else if !reflect.DeepEqual(o, tc.output) { t.Fatalf("FAIL: case %d | %s\nexpected\t%#v\ngot\t\t%#v\n", i, tc.description, tc.output, o) } t.Logf("PASS: case %d | %s\n", i, tc.description) } } func TestEncodeVarint(t *testing.T) { for i, tc := range encodeTestCases { if encoded := EncodeVarint(tc.input); bytes.Compare(encoded, tc.output) != 0 { t.Fatalf("FAIL: case %d | %s\nexpected\t%#v\ngot\t\t%#v\n", i, tc.description, tc.output, encoded) } t.Logf("PASS: case %d | %s\n", i, tc.description) } }
Version data entries
93 entries across 93 versions & 1 rubygems