|
|
@@ -1266,7 +1266,7 @@ func testCodecRpcOne(t *testing.T, rr Rpc, h Handle, doRequest bool, exitSleepMs
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func doTestMapEncodeForCanonical(t *testing.T, name string, h Handle) {
|
|
|
+func doTestMapEncodeForCanonical(t *testing.T, h Handle) {
|
|
|
testOnce.Do(testInitAll)
|
|
|
// println("doTestMapEncodeForCanonical")
|
|
|
v1 := map[stringUint64T]interface{}{
|
|
|
@@ -1348,7 +1348,7 @@ func doTestMapEncodeForCanonical(t *testing.T, name string, h Handle) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func doTestStdEncIntf(t *testing.T, name string, h Handle) {
|
|
|
+func doTestStdEncIntf(t *testing.T, h Handle) {
|
|
|
testOnce.Do(testInitAll)
|
|
|
args := [][2]interface{}{
|
|
|
{&TestABC{"A", "BB", "CCC"}, new(TestABC)},
|
|
|
@@ -1368,7 +1368,7 @@ func doTestStdEncIntf(t *testing.T, name string, h Handle) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func doTestEncCircularRef(t *testing.T, name string, h Handle) {
|
|
|
+func doTestEncCircularRef(t *testing.T, h Handle) {
|
|
|
testOnce.Do(testInitAll)
|
|
|
type T1 struct {
|
|
|
S string
|
|
|
@@ -1423,7 +1423,7 @@ type (
|
|
|
}
|
|
|
)
|
|
|
|
|
|
-func doTestAnonCycle(t *testing.T, name string, h Handle) {
|
|
|
+func doTestAnonCycle(t *testing.T, h Handle) {
|
|
|
testOnce.Do(testInitAll)
|
|
|
var x TestAnonCycleT1
|
|
|
x.S = "hello"
|
|
|
@@ -1434,10 +1434,12 @@ func doTestAnonCycle(t *testing.T, name string, h Handle) {
|
|
|
rt := reflect.TypeOf((*TestAnonCycleT1)(nil)).Elem()
|
|
|
rtid := rt2id(rt)
|
|
|
pti := basicHandle(h).getTypeInfo(rtid, rt)
|
|
|
- logTv(t, "pti: %v", pti)
|
|
|
+ logTv(t, "[%s] pti: %v", h.Name(), pti)
|
|
|
}
|
|
|
|
|
|
-func doTestErrWriter(t *testing.T, name string, h Handle) {
|
|
|
+func doTestErrWriter(t *testing.T, h Handle) {
|
|
|
+ testOnce.Do(testInitAll)
|
|
|
+ name := h.Name()
|
|
|
var ew testErrWriter
|
|
|
w := bufio.NewWriterSize(&ew, 4)
|
|
|
enc := NewEncoder(w, h)
|
|
|
@@ -1519,7 +1521,7 @@ func doTestJsonLargeInteger(t *testing.T, v interface{}, ias uint8) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func doTestRawValue(t *testing.T, name string, h Handle) {
|
|
|
+func doTestRawValue(t *testing.T, h Handle) {
|
|
|
testOnce.Do(testInitAll)
|
|
|
bh := basicHandle(h)
|
|
|
if !bh.Raw {
|
|
|
@@ -1559,8 +1561,9 @@ func doTestRawValue(t *testing.T, name string, h Handle) {
|
|
|
// and validates that our code can read and write it out accordingly.
|
|
|
// We keep this unexported here, and put actual test in ext_dep_test.go.
|
|
|
// This way, it can be excluded by excluding file completely.
|
|
|
-func doTestPythonGenStreams(t *testing.T, name string, h Handle) {
|
|
|
+func doTestPythonGenStreams(t *testing.T, h Handle) {
|
|
|
testOnce.Do(testInitAll)
|
|
|
+ name := h.Name()
|
|
|
logT(t, "TestPythonGenStreams-%v", name)
|
|
|
tmpdir, err := ioutil.TempDir("", "golang-"+name+"-test")
|
|
|
if err != nil {
|
|
|
@@ -2052,8 +2055,9 @@ func testRandomFillRV(v reflect.Value) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func testMammoth(t *testing.T, name string, h Handle) {
|
|
|
+func testMammoth(t *testing.T, h Handle) {
|
|
|
testOnce.Do(testInitAll)
|
|
|
+ name := h.Name()
|
|
|
var b []byte
|
|
|
|
|
|
var m, m2 TestMammoth
|
|
|
@@ -2071,8 +2075,9 @@ func testMammoth(t *testing.T, name string, h Handle) {
|
|
|
// testMammoth2(t, name, h)
|
|
|
}
|
|
|
|
|
|
-func testTime(t *testing.T, name string, h Handle) {
|
|
|
+func testTime(t *testing.T, h Handle) {
|
|
|
testOnce.Do(testInitAll)
|
|
|
+ name := h.Name()
|
|
|
// test time which uses the time.go implementation (ie Binc)
|
|
|
var tt, tt2 time.Time
|
|
|
// time in 1990
|
|
|
@@ -2087,8 +2092,9 @@ func testTime(t *testing.T, name string, h Handle) {
|
|
|
// testDeepEqualErr(tt.UTC(), tt2, t, "time-"+name)
|
|
|
}
|
|
|
|
|
|
-func testUintToInt(t *testing.T, name string, h Handle) {
|
|
|
+func testUintToInt(t *testing.T, h Handle) {
|
|
|
testOnce.Do(testInitAll)
|
|
|
+ name := h.Name()
|
|
|
var golden = [...]int64{
|
|
|
0, 1, 22, 333, 4444, 55555, 666666,
|
|
|
// msgpack ones
|
|
|
@@ -2127,8 +2133,9 @@ func testUintToInt(t *testing.T, name string, h Handle) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func doTestDifferentMapOrSliceType(t *testing.T, name string, h Handle) {
|
|
|
+func doTestDifferentMapOrSliceType(t *testing.T, h Handle) {
|
|
|
testOnce.Do(testInitAll)
|
|
|
+ name := h.Name()
|
|
|
|
|
|
// - maptype, slicetype: diff from map[string]intf, map[intf]intf or []intf, etc
|
|
|
// include map[interface{}]string where some keys are []byte.
|
|
|
@@ -2213,7 +2220,7 @@ func doTestDifferentMapOrSliceType(t *testing.T, name string, h Handle) {
|
|
|
|
|
|
}
|
|
|
|
|
|
-func doTestScalars(t *testing.T, name string, h Handle) {
|
|
|
+func doTestScalars(t *testing.T, h Handle) {
|
|
|
testOnce.Do(testInitAll)
|
|
|
|
|
|
// for each scalar:
|
|
|
@@ -2289,8 +2296,9 @@ func doTestScalars(t *testing.T, name string, h Handle) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func doTestIntfMapping(t *testing.T, name string, h Handle) {
|
|
|
+func doTestIntfMapping(t *testing.T, h Handle) {
|
|
|
testOnce.Do(testInitAll)
|
|
|
+ name := h.Name()
|
|
|
rti := reflect.TypeOf((*testIntfMapI)(nil)).Elem()
|
|
|
defer func() { basicHandle(h).Intf2Impl(rti, nil) }()
|
|
|
|
|
|
@@ -2314,8 +2322,9 @@ func doTestIntfMapping(t *testing.T, name string, h Handle) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func doTestOmitempty(t *testing.T, name string, h Handle) {
|
|
|
+func doTestOmitempty(t *testing.T, h Handle) {
|
|
|
testOnce.Do(testInitAll)
|
|
|
+ name := h.Name()
|
|
|
if basicHandle(h).StructToArray {
|
|
|
t.Skipf("Skipping OmitEmpty test when StructToArray=true")
|
|
|
}
|
|
|
@@ -2334,8 +2343,9 @@ func doTestOmitempty(t *testing.T, name string, h Handle) {
|
|
|
testDeepEqualErr(b1, b2, t, name+"-omitempty-cmp")
|
|
|
}
|
|
|
|
|
|
-func doTestMissingFields(t *testing.T, name string, h Handle) {
|
|
|
+func doTestMissingFields(t *testing.T, h Handle) {
|
|
|
testOnce.Do(testInitAll)
|
|
|
+ name := h.Name()
|
|
|
if codecgen {
|
|
|
t.Skipf("Skipping Missing Fields tests as it is not honored by codecgen")
|
|
|
}
|
|
|
@@ -2357,8 +2367,9 @@ func doTestMissingFields(t *testing.T, name string, h Handle) {
|
|
|
testDeepEqualErr(v1, v3, t, name+"-missing-cmp-2")
|
|
|
}
|
|
|
|
|
|
-func doTestMaxDepth(t *testing.T, name string, h Handle) {
|
|
|
+func doTestMaxDepth(t *testing.T, h Handle) {
|
|
|
testOnce.Do(testInitAll)
|
|
|
+ name := h.Name()
|
|
|
type T struct {
|
|
|
I interface{} // value to encode
|
|
|
M int16 // maxdepth
|
|
|
@@ -2444,8 +2455,9 @@ func doTestMaxDepth(t *testing.T, name string, h Handle) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func doTestMultipleEncDec(t *testing.T, name string, h Handle) {
|
|
|
+func doTestMultipleEncDec(t *testing.T, h Handle) {
|
|
|
testOnce.Do(testInitAll)
|
|
|
+ name := h.Name()
|
|
|
// encode a string multiple times.
|
|
|
// decode it multiple times.
|
|
|
// ensure we get the value each time
|
|
|
@@ -2463,8 +2475,9 @@ func doTestMultipleEncDec(t *testing.T, name string, h Handle) {
|
|
|
testDeepEqualErr(s2, s21, t, name+"-multiple-encode")
|
|
|
}
|
|
|
|
|
|
-func doTestSelfExt(t *testing.T, name string, h Handle) {
|
|
|
+func doTestSelfExt(t *testing.T, h Handle) {
|
|
|
testOnce.Do(testInitAll)
|
|
|
+ name := h.Name()
|
|
|
var ts TestSelfExtImpl
|
|
|
ts.S = "ugorji"
|
|
|
ts.I = 5678
|
|
|
@@ -2476,8 +2489,9 @@ func doTestSelfExt(t *testing.T, name string, h Handle) {
|
|
|
testDeepEqualErr(&ts, &ts2, t, name)
|
|
|
}
|
|
|
|
|
|
-func doTestBytesEncodedAsArray(t *testing.T, name string, h Handle) {
|
|
|
+func doTestBytesEncodedAsArray(t *testing.T, h Handle) {
|
|
|
testOnce.Do(testInitAll)
|
|
|
+ name := h.Name()
|
|
|
// Need to test edge case where bytes are encoded as an array
|
|
|
// (not using optimized []byte native format)
|
|
|
|
|
|
@@ -2497,8 +2511,9 @@ func doTestBytesEncodedAsArray(t *testing.T, name string, h Handle) {
|
|
|
testDeepEqualErr(un, out, t, name)
|
|
|
}
|
|
|
|
|
|
-func doTestStrucEncDec(t *testing.T, name string, h Handle) {
|
|
|
+func doTestStrucEncDec(t *testing.T, h Handle) {
|
|
|
testOnce.Do(testInitAll)
|
|
|
+ name := h.Name()
|
|
|
{
|
|
|
var ts1 = newTestStruc(2, testNumRepeatString, false, !testSkipIntf, testMapStringKeyOnly)
|
|
|
var ts2 TestStruc
|
|
|
@@ -2518,6 +2533,233 @@ func doTestStrucEncDec(t *testing.T, name string, h Handle) {
|
|
|
// }
|
|
|
}
|
|
|
|
|
|
+func doTestStructKeyType(t *testing.T, h Handle) {
|
|
|
+ testOnce.Do(testInitAll)
|
|
|
+ name := h.Name()
|
|
|
+
|
|
|
+ mh, mok := h.(*MsgpackHandle)
|
|
|
+
|
|
|
+ bch, bcok := h.(*BincHandle)
|
|
|
+
|
|
|
+ bh := basicHandle(h)
|
|
|
+ s2a := bh.StructToArray
|
|
|
+ bh.StructToArray = false
|
|
|
+ var mfx bool
|
|
|
+ if mok {
|
|
|
+ mfx = mh.NoFixedNum
|
|
|
+ mh.NoFixedNum = false
|
|
|
+ }
|
|
|
+ var bcsym uint8
|
|
|
+ if bcok {
|
|
|
+ bcsym = bch.AsSymbols
|
|
|
+ bch.AsSymbols = 2 // TODO: should be 0 but binc symbols do not work well
|
|
|
+ }
|
|
|
+ defer func() {
|
|
|
+ bh.StructToArray = s2a
|
|
|
+ if mok {
|
|
|
+ mh.NoFixedNum = mfx
|
|
|
+ }
|
|
|
+ if bcok {
|
|
|
+ bch.AsSymbols = bcsym
|
|
|
+ }
|
|
|
+ }()
|
|
|
+
|
|
|
+ var bs1, bs2 []byte
|
|
|
+
|
|
|
+ var m = make(map[interface{}]interface{})
|
|
|
+
|
|
|
+ fn := func(v interface{}) {
|
|
|
+ bs1 = testMarshalErr(v, h, t, "")
|
|
|
+ bs2 = testMarshalErr(m, h, t, "")
|
|
|
+ // if _, ok := h.(*JsonHandle); ok {
|
|
|
+ // xdebugf("bs1: %s, bs2: %s", bs1, bs2)
|
|
|
+ // }
|
|
|
+ // if bcok {
|
|
|
+ // xdebug2f("-------------")
|
|
|
+ // xdebugf("v: %#v, m: %#v", v, m)
|
|
|
+ // xdebugf("bs1: %v", bs1)
|
|
|
+ // xdebugf("bs2: %v", bs2)
|
|
|
+ // xdebugf("bs1==bs2: %v", bytes.Equal(bs1, bs2))
|
|
|
+ // testDeepEqualErr(bs1, bs2, t, name+"")
|
|
|
+ // xdebug2f("-------------")
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ testDeepEqualErr(bs1, bs2, t, name+"")
|
|
|
+ }
|
|
|
+
|
|
|
+ fnclr := func() {
|
|
|
+ for k := range m {
|
|
|
+ delete(m, k)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ m["F"] = 0
|
|
|
+ fn(testStrucKeyTypeT0{})
|
|
|
+ fnclr()
|
|
|
+
|
|
|
+ m["FFFF"] = 0
|
|
|
+ fn(testStrucKeyTypeT1{})
|
|
|
+ fnclr()
|
|
|
+
|
|
|
+ m[int64(-1)] = 0
|
|
|
+ fn(testStrucKeyTypeT2{})
|
|
|
+ fnclr()
|
|
|
+
|
|
|
+ m[int64(1)] = 0
|
|
|
+ fn(testStrucKeyTypeT3{})
|
|
|
+ fnclr()
|
|
|
+
|
|
|
+ m[float64(2.5)] = 0
|
|
|
+ fn(testStrucKeyTypeT4{})
|
|
|
+ fnclr()
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+func doTestRawToStringToRawEtc(t *testing.T, h Handle) {
|
|
|
+ testOnce.Do(testInitAll)
|
|
|
+ // name := h.Name()
|
|
|
+
|
|
|
+ // Tests:
|
|
|
+ // - RawToString
|
|
|
+ // - StringToRaw
|
|
|
+ // - MapValueReset
|
|
|
+ // - DeleteOnMapValue (skipped - no longer supported)
|
|
|
+
|
|
|
+ bh := basicHandle(h)
|
|
|
+ // xdebugf("[%s] maptype: %v, slice type: %v", name, bh.MapType, bh.SliceType)
|
|
|
+
|
|
|
+ r2s := bh.RawToString
|
|
|
+ s2r := bh.StringToRaw
|
|
|
+ can := bh.Canonical
|
|
|
+ mvr := bh.MapValueReset
|
|
|
+
|
|
|
+ var wext bool
|
|
|
+ mh, mok := h.(*MsgpackHandle)
|
|
|
+ if mok {
|
|
|
+ wext = mh.WriteExt
|
|
|
+ }
|
|
|
+
|
|
|
+ _, jok := h.(*JsonHandle)
|
|
|
+
|
|
|
+ defer func() {
|
|
|
+ bh.RawToString = r2s
|
|
|
+ bh.StringToRaw = s2r
|
|
|
+ bh.Canonical = can
|
|
|
+ bh.MapValueReset = mvr
|
|
|
+ if mok {
|
|
|
+ mh.WriteExt = wext
|
|
|
+ }
|
|
|
+ }()
|
|
|
+
|
|
|
+ bh.Canonical = false
|
|
|
+
|
|
|
+ var bs1, bs2 []byte
|
|
|
+
|
|
|
+ // encode: StringToRaw
|
|
|
+ // decode: RawToString
|
|
|
+
|
|
|
+ // compare encoded v1 to encoded v2, while setting StringToRaw to b
|
|
|
+ fne := func(v1, v2 interface{}, b bool) {
|
|
|
+ // xdebugf("[%s] fne: StringToRaw: %v, v1: %#v, v2: %#v", name, b, v1, v2)
|
|
|
+ bh.StringToRaw = b
|
|
|
+ bs1 = testMarshalErr(v1, h, t, "")
|
|
|
+ // bs1 = []byte(string(bs1))
|
|
|
+ bs2 = testMarshalErr(v2, h, t, "")
|
|
|
+ // if jok {
|
|
|
+ // xdebugf("[%s] fne: bh: %#v", name, bh.EncodeOptions)
|
|
|
+ // xdebugf("[%s] bs1: %s", name, bs1)
|
|
|
+ // xdebugf("[%s] bs2: %s", name, bs2)
|
|
|
+ // }
|
|
|
+ testDeepEqualErr(bs1, bs2, t, "")
|
|
|
+ }
|
|
|
+
|
|
|
+ // encoded v1, decode naked and compare to v2
|
|
|
+ fnd := func(v1, v2 interface{}, bs2r, br2s, bwext bool) {
|
|
|
+ bh.RawToString = br2s
|
|
|
+ bh.StringToRaw = bs2r
|
|
|
+ if mok {
|
|
|
+ mh.WriteExt = bwext
|
|
|
+ }
|
|
|
+ bs1 = testMarshalErr(v1, h, t, "")
|
|
|
+ var vn interface{}
|
|
|
+ testUnmarshalErr(&vn, bs1, h, t, "")
|
|
|
+ testDeepEqualErr(vn, v2, t, "")
|
|
|
+ }
|
|
|
+
|
|
|
+ sv0 := "value"
|
|
|
+ bv0 := []byte(sv0)
|
|
|
+
|
|
|
+ sv1 := sv0
|
|
|
+ bv1 := []byte(sv1)
|
|
|
+
|
|
|
+ m1 := map[string]*string{"key": &sv1}
|
|
|
+ m2 := map[string]*[]byte{"key": &bv1}
|
|
|
+
|
|
|
+ // m3 := map[[3]byte]string{[3]byte{'k', 'e', 'y'}: sv0}
|
|
|
+ m4 := map[[3]byte][]byte{[3]byte{'k', 'e', 'y'}: bv0}
|
|
|
+ m5 := map[string][]byte{"key": bv0}
|
|
|
+ // m6 := map[string]string{"key": sv0}
|
|
|
+
|
|
|
+ m7 := map[interface{}]interface{}{"key": sv0}
|
|
|
+ m8 := map[interface{}]interface{}{"key": bv0}
|
|
|
+
|
|
|
+ // StringToRaw=true
|
|
|
+ fne(m1, m4, true)
|
|
|
+
|
|
|
+ // StringToRaw=false
|
|
|
+ // compare encoded m2 to encoded m5
|
|
|
+ fne(m2, m5, false)
|
|
|
+
|
|
|
+ // json doesn't work well with StringToRaw and RawToString
|
|
|
+ // when dealing with interfaces, because it cannot decipher
|
|
|
+ // that a string should be treated as base64.
|
|
|
+ if jok {
|
|
|
+ goto MAP_VALUE_RESET
|
|
|
+ }
|
|
|
+
|
|
|
+ // if msgpack, always set WriteExt = RawToString
|
|
|
+
|
|
|
+ // StringToRaw=true (RawToString=true)
|
|
|
+ // encoded m1, decode naked and compare to m5
|
|
|
+ fnd(m2, m7, true, true, true)
|
|
|
+
|
|
|
+ // StringToRaw=true (RawToString=false)
|
|
|
+ // encoded m1, decode naked and compare to m6
|
|
|
+ fnd(m1, m8, true, false, false)
|
|
|
+
|
|
|
+ // StringToRaw=false, RawToString=true
|
|
|
+ // encode m1, decode naked, and compare to m6
|
|
|
+ fnd(m2, m7, false, true, true)
|
|
|
+
|
|
|
+MAP_VALUE_RESET:
|
|
|
+ // set MapValueReset, and then decode i
|
|
|
+ sv2 := "value-new"
|
|
|
+ m9 := map[string]*string{"key": &sv2}
|
|
|
+
|
|
|
+ bs1 = testMarshalErr(m1, h, t, "")
|
|
|
+
|
|
|
+ bh.MapValueReset = false
|
|
|
+ testUnmarshalErr(&m9, bs1, h, t, "")
|
|
|
+ // if !(m9["key"] == m1["key"]
|
|
|
+ testDeepEqualErr(sv2, "value", t, "")
|
|
|
+ testDeepEqualErr(&sv2, m9["key"], t, "")
|
|
|
+
|
|
|
+ sv2 = "value-new"
|
|
|
+ m9["key"] = &sv2
|
|
|
+ bh.MapValueReset = true
|
|
|
+ testUnmarshalErr(&m9, bs1, h, t, "")
|
|
|
+ testDeepEqualErr(sv2, "value-new", t, "")
|
|
|
+ testDeepEqualErr("value", *(m9["key"]), t, "")
|
|
|
+
|
|
|
+ // t1 = struct {
|
|
|
+ // key string
|
|
|
+ // }{ key: sv0 }
|
|
|
+ // t2 := struct {
|
|
|
+ // key []byte
|
|
|
+ // }{ key: bv1 }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
// -----------------
|
|
|
|
|
|
func TestJsonDecodeNonStringScalarInStringContext(t *testing.T) {
|
|
|
@@ -2934,11 +3176,11 @@ func TestBincCodecsEmbeddedPointer(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
func TestBincStdEncIntf(t *testing.T) {
|
|
|
- doTestStdEncIntf(t, "binc", testBincH)
|
|
|
+ doTestStdEncIntf(t, testBincH)
|
|
|
}
|
|
|
|
|
|
func TestBincMammoth(t *testing.T) {
|
|
|
- testMammoth(t, "binc", testBincH)
|
|
|
+ testMammoth(t, testBincH)
|
|
|
}
|
|
|
|
|
|
func TestSimpleCodecsTable(t *testing.T) {
|
|
|
@@ -2954,11 +3196,11 @@ func TestSimpleCodecsEmbeddedPointer(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
func TestSimpleStdEncIntf(t *testing.T) {
|
|
|
- doTestStdEncIntf(t, "simple", testSimpleH)
|
|
|
+ doTestStdEncIntf(t, testSimpleH)
|
|
|
}
|
|
|
|
|
|
func TestSimpleMammoth(t *testing.T) {
|
|
|
- testMammoth(t, "simple", testSimpleH)
|
|
|
+ testMammoth(t, testSimpleH)
|
|
|
}
|
|
|
|
|
|
func TestMsgpackCodecsTable(t *testing.T) {
|
|
|
@@ -2974,11 +3216,11 @@ func TestMsgpackCodecsEmbeddedPointer(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
func TestMsgpackStdEncIntf(t *testing.T) {
|
|
|
- doTestStdEncIntf(t, "msgpack", testMsgpackH)
|
|
|
+ doTestStdEncIntf(t, testMsgpackH)
|
|
|
}
|
|
|
|
|
|
func TestMsgpackMammoth(t *testing.T) {
|
|
|
- testMammoth(t, "msgpack", testMsgpackH)
|
|
|
+ testMammoth(t, testMsgpackH)
|
|
|
}
|
|
|
|
|
|
func TestCborCodecsTable(t *testing.T) {
|
|
|
@@ -2993,20 +3235,16 @@ func TestCborCodecsEmbeddedPointer(t *testing.T) {
|
|
|
testCodecEmbeddedPointer(t, testCborH)
|
|
|
}
|
|
|
|
|
|
-func TestCborMapEncodeForCanonical(t *testing.T) {
|
|
|
- doTestMapEncodeForCanonical(t, "cbor", testCborH)
|
|
|
-}
|
|
|
-
|
|
|
func TestCborCodecChan(t *testing.T) {
|
|
|
testCodecChan(t, testCborH)
|
|
|
}
|
|
|
|
|
|
func TestCborStdEncIntf(t *testing.T) {
|
|
|
- doTestStdEncIntf(t, "cbor", testCborH)
|
|
|
+ doTestStdEncIntf(t, testCborH)
|
|
|
}
|
|
|
|
|
|
func TestCborMammoth(t *testing.T) {
|
|
|
- testMammoth(t, "cbor", testCborH)
|
|
|
+ testMammoth(t, testCborH)
|
|
|
}
|
|
|
|
|
|
func TestJsonCodecsTable(t *testing.T) {
|
|
|
@@ -3026,43 +3264,49 @@ func TestJsonCodecChan(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
func TestJsonStdEncIntf(t *testing.T) {
|
|
|
- doTestStdEncIntf(t, "json", testJsonH)
|
|
|
+ doTestStdEncIntf(t, testJsonH)
|
|
|
}
|
|
|
|
|
|
func TestJsonMammoth(t *testing.T) {
|
|
|
- testMammoth(t, "json", testJsonH)
|
|
|
+ testMammoth(t, testJsonH)
|
|
|
}
|
|
|
|
|
|
// ----- Raw ---------
|
|
|
func TestJsonRaw(t *testing.T) {
|
|
|
- doTestRawValue(t, "json", testJsonH)
|
|
|
+ doTestRawValue(t, testJsonH)
|
|
|
}
|
|
|
func TestBincRaw(t *testing.T) {
|
|
|
- doTestRawValue(t, "binc", testBincH)
|
|
|
+ doTestRawValue(t, testBincH)
|
|
|
}
|
|
|
func TestMsgpackRaw(t *testing.T) {
|
|
|
- doTestRawValue(t, "msgpack", testMsgpackH)
|
|
|
+ doTestRawValue(t, testMsgpackH)
|
|
|
}
|
|
|
func TestSimpleRaw(t *testing.T) {
|
|
|
- doTestRawValue(t, "simple", testSimpleH)
|
|
|
+ doTestRawValue(t, testSimpleH)
|
|
|
}
|
|
|
func TestCborRaw(t *testing.T) {
|
|
|
- doTestRawValue(t, "cbor", testCborH)
|
|
|
+ doTestRawValue(t, testCborH)
|
|
|
}
|
|
|
|
|
|
// ----- ALL (framework based) -----
|
|
|
|
|
|
func TestAllEncCircularRef(t *testing.T) {
|
|
|
- doTestEncCircularRef(t, "cbor", testCborH)
|
|
|
+ doTestEncCircularRef(t, testCborH)
|
|
|
}
|
|
|
|
|
|
func TestAllAnonCycle(t *testing.T) {
|
|
|
- doTestAnonCycle(t, "cbor", testCborH)
|
|
|
+ doTestAnonCycle(t, testCborH)
|
|
|
}
|
|
|
|
|
|
func TestAllErrWriter(t *testing.T) {
|
|
|
- doTestErrWriter(t, "cbor", testCborH)
|
|
|
- doTestErrWriter(t, "json", testJsonH)
|
|
|
+ doTestErrWriter(t, testCborH)
|
|
|
+ doTestErrWriter(t, testJsonH)
|
|
|
+}
|
|
|
+
|
|
|
+// ----- RPC custom -----
|
|
|
+
|
|
|
+func TestMsgpackRpcSpec(t *testing.T) {
|
|
|
+ testCodecRpcOne(t, MsgpackSpecRpc, testMsgpackH, true, 0)
|
|
|
}
|
|
|
|
|
|
// ----- RPC -----
|
|
|
@@ -3087,8 +3331,27 @@ func TestJsonRpcGo(t *testing.T) {
|
|
|
testCodecRpcOne(t, GoRpc, testJsonH, true, 0)
|
|
|
}
|
|
|
|
|
|
-func TestMsgpackRpcSpec(t *testing.T) {
|
|
|
- testCodecRpcOne(t, MsgpackSpecRpc, testMsgpackH, true, 0)
|
|
|
+// ----- OTHERS -----
|
|
|
+
|
|
|
+func TestBincMapEncodeForCanonical(t *testing.T) {
|
|
|
+ t.Skip() // TODO: testing fails??? Need to research
|
|
|
+ doTestMapEncodeForCanonical(t, testBincH)
|
|
|
+}
|
|
|
+
|
|
|
+func TestSimpleMapEncodeForCanonical(t *testing.T) {
|
|
|
+ doTestMapEncodeForCanonical(t, testSimpleH)
|
|
|
+}
|
|
|
+
|
|
|
+func TestMsgpackMapEncodeForCanonical(t *testing.T) {
|
|
|
+ doTestMapEncodeForCanonical(t, testMsgpackH)
|
|
|
+}
|
|
|
+
|
|
|
+func TestCborMapEncodeForCanonical(t *testing.T) {
|
|
|
+ doTestMapEncodeForCanonical(t, testCborH)
|
|
|
+}
|
|
|
+
|
|
|
+func TestJsonMapEncodeForCanonical(t *testing.T) {
|
|
|
+ doTestMapEncodeForCanonical(t, testJsonH)
|
|
|
}
|
|
|
|
|
|
func TestBincUnderlyingType(t *testing.T) {
|
|
|
@@ -3240,229 +3503,269 @@ func TestSimpleMammothMapsAndSlices(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
func TestJsonTime(t *testing.T) {
|
|
|
- testTime(t, "json", testJsonH)
|
|
|
+ testTime(t, testJsonH)
|
|
|
}
|
|
|
|
|
|
func TestCborTime(t *testing.T) {
|
|
|
- testTime(t, "cbor", testCborH)
|
|
|
+ testTime(t, testCborH)
|
|
|
}
|
|
|
|
|
|
func TestMsgpackTime(t *testing.T) {
|
|
|
- testTime(t, "msgpack", testMsgpackH)
|
|
|
+ testTime(t, testMsgpackH)
|
|
|
}
|
|
|
|
|
|
func TestBincTime(t *testing.T) {
|
|
|
- testTime(t, "binc", testBincH)
|
|
|
+ testTime(t, testBincH)
|
|
|
}
|
|
|
|
|
|
func TestSimpleTime(t *testing.T) {
|
|
|
- testTime(t, "simple", testSimpleH)
|
|
|
+ testTime(t, testSimpleH)
|
|
|
}
|
|
|
|
|
|
func TestJsonUintToInt(t *testing.T) {
|
|
|
- testUintToInt(t, "json", testJsonH)
|
|
|
+ testUintToInt(t, testJsonH)
|
|
|
}
|
|
|
|
|
|
func TestCborUintToInt(t *testing.T) {
|
|
|
- testUintToInt(t, "cbor", testCborH)
|
|
|
+ testUintToInt(t, testCborH)
|
|
|
}
|
|
|
|
|
|
func TestMsgpackUintToInt(t *testing.T) {
|
|
|
- testUintToInt(t, "msgpack", testMsgpackH)
|
|
|
+ testUintToInt(t, testMsgpackH)
|
|
|
}
|
|
|
|
|
|
func TestBincUintToInt(t *testing.T) {
|
|
|
- testUintToInt(t, "binc", testBincH)
|
|
|
+ testUintToInt(t, testBincH)
|
|
|
}
|
|
|
|
|
|
func TestSimpleUintToInt(t *testing.T) {
|
|
|
- testUintToInt(t, "simple", testSimpleH)
|
|
|
+ testUintToInt(t, testSimpleH)
|
|
|
}
|
|
|
|
|
|
func TestJsonDifferentMapOrSliceType(t *testing.T) {
|
|
|
- doTestDifferentMapOrSliceType(t, "json", testJsonH)
|
|
|
+ doTestDifferentMapOrSliceType(t, testJsonH)
|
|
|
}
|
|
|
|
|
|
func TestCborDifferentMapOrSliceType(t *testing.T) {
|
|
|
- doTestDifferentMapOrSliceType(t, "cbor", testCborH)
|
|
|
+ doTestDifferentMapOrSliceType(t, testCborH)
|
|
|
}
|
|
|
|
|
|
func TestMsgpackDifferentMapOrSliceType(t *testing.T) {
|
|
|
- doTestDifferentMapOrSliceType(t, "msgpack", testMsgpackH)
|
|
|
+ doTestDifferentMapOrSliceType(t, testMsgpackH)
|
|
|
}
|
|
|
|
|
|
func TestBincDifferentMapOrSliceType(t *testing.T) {
|
|
|
- doTestDifferentMapOrSliceType(t, "binc", testBincH)
|
|
|
+ doTestDifferentMapOrSliceType(t, testBincH)
|
|
|
}
|
|
|
|
|
|
func TestSimpleDifferentMapOrSliceType(t *testing.T) {
|
|
|
- doTestDifferentMapOrSliceType(t, "simple", testSimpleH)
|
|
|
+ doTestDifferentMapOrSliceType(t, testSimpleH)
|
|
|
}
|
|
|
|
|
|
func TestJsonScalars(t *testing.T) {
|
|
|
- doTestScalars(t, "json", testJsonH)
|
|
|
+ doTestScalars(t, testJsonH)
|
|
|
}
|
|
|
|
|
|
func TestCborScalars(t *testing.T) {
|
|
|
- doTestScalars(t, "cbor", testCborH)
|
|
|
+ doTestScalars(t, testCborH)
|
|
|
}
|
|
|
|
|
|
func TestMsgpackScalars(t *testing.T) {
|
|
|
- doTestScalars(t, "msgpack", testMsgpackH)
|
|
|
+ doTestScalars(t, testMsgpackH)
|
|
|
}
|
|
|
|
|
|
func TestBincScalars(t *testing.T) {
|
|
|
- doTestScalars(t, "binc", testBincH)
|
|
|
+ doTestScalars(t, testBincH)
|
|
|
}
|
|
|
|
|
|
func TestSimpleScalars(t *testing.T) {
|
|
|
- doTestScalars(t, "simple", testSimpleH)
|
|
|
+ doTestScalars(t, testSimpleH)
|
|
|
}
|
|
|
|
|
|
func TestJsonOmitempty(t *testing.T) {
|
|
|
- doTestOmitempty(t, "json", testJsonH)
|
|
|
+ doTestOmitempty(t, testJsonH)
|
|
|
}
|
|
|
|
|
|
func TestCborOmitempty(t *testing.T) {
|
|
|
- doTestOmitempty(t, "cbor", testCborH)
|
|
|
+ doTestOmitempty(t, testCborH)
|
|
|
}
|
|
|
|
|
|
func TestMsgpackOmitempty(t *testing.T) {
|
|
|
- doTestOmitempty(t, "msgpack", testMsgpackH)
|
|
|
+ doTestOmitempty(t, testMsgpackH)
|
|
|
}
|
|
|
|
|
|
func TestBincOmitempty(t *testing.T) {
|
|
|
- doTestOmitempty(t, "binc", testBincH)
|
|
|
+ doTestOmitempty(t, testBincH)
|
|
|
}
|
|
|
|
|
|
func TestSimpleOmitempty(t *testing.T) {
|
|
|
- doTestOmitempty(t, "simple", testSimpleH)
|
|
|
+ doTestOmitempty(t, testSimpleH)
|
|
|
}
|
|
|
|
|
|
func TestJsonIntfMapping(t *testing.T) {
|
|
|
- doTestIntfMapping(t, "json", testJsonH)
|
|
|
+ doTestIntfMapping(t, testJsonH)
|
|
|
}
|
|
|
|
|
|
func TestCborIntfMapping(t *testing.T) {
|
|
|
- doTestIntfMapping(t, "cbor", testCborH)
|
|
|
+ doTestIntfMapping(t, testCborH)
|
|
|
}
|
|
|
|
|
|
func TestMsgpackIntfMapping(t *testing.T) {
|
|
|
- doTestIntfMapping(t, "msgpack", testMsgpackH)
|
|
|
+ doTestIntfMapping(t, testMsgpackH)
|
|
|
}
|
|
|
|
|
|
func TestBincIntfMapping(t *testing.T) {
|
|
|
- doTestIntfMapping(t, "binc", testBincH)
|
|
|
+ doTestIntfMapping(t, testBincH)
|
|
|
}
|
|
|
|
|
|
func TestSimpleIntfMapping(t *testing.T) {
|
|
|
- doTestIntfMapping(t, "simple", testSimpleH)
|
|
|
+ doTestIntfMapping(t, testSimpleH)
|
|
|
}
|
|
|
|
|
|
func TestJsonMissingFields(t *testing.T) {
|
|
|
- doTestMissingFields(t, "json", testJsonH)
|
|
|
+ doTestMissingFields(t, testJsonH)
|
|
|
}
|
|
|
|
|
|
func TestCborMissingFields(t *testing.T) {
|
|
|
- doTestMissingFields(t, "cbor", testCborH)
|
|
|
+ doTestMissingFields(t, testCborH)
|
|
|
}
|
|
|
|
|
|
func TestMsgpackMissingFields(t *testing.T) {
|
|
|
- doTestMissingFields(t, "msgpack", testMsgpackH)
|
|
|
+ doTestMissingFields(t, testMsgpackH)
|
|
|
}
|
|
|
|
|
|
func TestBincMissingFields(t *testing.T) {
|
|
|
- doTestMissingFields(t, "binc", testBincH)
|
|
|
+ doTestMissingFields(t, testBincH)
|
|
|
}
|
|
|
|
|
|
func TestSimpleMissingFields(t *testing.T) {
|
|
|
- doTestMissingFields(t, "simple", testSimpleH)
|
|
|
+ doTestMissingFields(t, testSimpleH)
|
|
|
}
|
|
|
|
|
|
func TestJsonMaxDepth(t *testing.T) {
|
|
|
- doTestMaxDepth(t, "json", testJsonH)
|
|
|
+ doTestMaxDepth(t, testJsonH)
|
|
|
}
|
|
|
|
|
|
func TestCborMaxDepth(t *testing.T) {
|
|
|
- doTestMaxDepth(t, "cbor", testCborH)
|
|
|
+ doTestMaxDepth(t, testCborH)
|
|
|
}
|
|
|
|
|
|
func TestMsgpackMaxDepth(t *testing.T) {
|
|
|
- doTestMaxDepth(t, "msgpack", testMsgpackH)
|
|
|
+ doTestMaxDepth(t, testMsgpackH)
|
|
|
}
|
|
|
|
|
|
func TestBincMaxDepth(t *testing.T) {
|
|
|
- doTestMaxDepth(t, "binc", testBincH)
|
|
|
+ doTestMaxDepth(t, testBincH)
|
|
|
}
|
|
|
|
|
|
func TestSimpleMaxDepth(t *testing.T) {
|
|
|
- doTestMaxDepth(t, "simple", testSimpleH)
|
|
|
+ doTestMaxDepth(t, testSimpleH)
|
|
|
}
|
|
|
|
|
|
func TestJsonSelfExt(t *testing.T) {
|
|
|
- doTestSelfExt(t, "json", testJsonH)
|
|
|
+ doTestSelfExt(t, testJsonH)
|
|
|
}
|
|
|
|
|
|
func TestCborSelfExt(t *testing.T) {
|
|
|
- doTestSelfExt(t, "cbor", testCborH)
|
|
|
+ doTestSelfExt(t, testCborH)
|
|
|
}
|
|
|
|
|
|
func TestMsgpackSelfExt(t *testing.T) {
|
|
|
- doTestSelfExt(t, "msgpack", testMsgpackH)
|
|
|
+ doTestSelfExt(t, testMsgpackH)
|
|
|
}
|
|
|
|
|
|
func TestBincSelfExt(t *testing.T) {
|
|
|
- doTestSelfExt(t, "binc", testBincH)
|
|
|
+ doTestSelfExt(t, testBincH)
|
|
|
}
|
|
|
|
|
|
func TestSimpleSelfExt(t *testing.T) {
|
|
|
- doTestSelfExt(t, "simple", testSimpleH)
|
|
|
+ doTestSelfExt(t, testSimpleH)
|
|
|
}
|
|
|
|
|
|
func TestJsonBytesEncodedAsArray(t *testing.T) {
|
|
|
- doTestBytesEncodedAsArray(t, "json", testJsonH)
|
|
|
+ doTestBytesEncodedAsArray(t, testJsonH)
|
|
|
}
|
|
|
|
|
|
func TestCborBytesEncodedAsArray(t *testing.T) {
|
|
|
- doTestBytesEncodedAsArray(t, "cbor", testCborH)
|
|
|
+ doTestBytesEncodedAsArray(t, testCborH)
|
|
|
}
|
|
|
|
|
|
func TestMsgpackBytesEncodedAsArray(t *testing.T) {
|
|
|
- doTestBytesEncodedAsArray(t, "msgpack", testMsgpackH)
|
|
|
+ doTestBytesEncodedAsArray(t, testMsgpackH)
|
|
|
}
|
|
|
|
|
|
func TestBincBytesEncodedAsArray(t *testing.T) {
|
|
|
- doTestBytesEncodedAsArray(t, "binc", testBincH)
|
|
|
+ doTestBytesEncodedAsArray(t, testBincH)
|
|
|
}
|
|
|
|
|
|
func TestSimpleBytesEncodedAsArray(t *testing.T) {
|
|
|
- doTestBytesEncodedAsArray(t, "simple", testSimpleH)
|
|
|
+ doTestBytesEncodedAsArray(t, testSimpleH)
|
|
|
}
|
|
|
|
|
|
func TestJsonStrucEncDec(t *testing.T) {
|
|
|
- doTestStrucEncDec(t, "json", testJsonH)
|
|
|
+ doTestStrucEncDec(t, testJsonH)
|
|
|
}
|
|
|
|
|
|
func TestCborStrucEncDec(t *testing.T) {
|
|
|
- doTestStrucEncDec(t, "cbor", testCborH)
|
|
|
+ doTestStrucEncDec(t, testCborH)
|
|
|
}
|
|
|
|
|
|
func TestMsgpackStrucEncDec(t *testing.T) {
|
|
|
- doTestStrucEncDec(t, "msgpack", testMsgpackH)
|
|
|
+ doTestStrucEncDec(t, testMsgpackH)
|
|
|
}
|
|
|
|
|
|
func TestBincStrucEncDec(t *testing.T) {
|
|
|
- doTestStrucEncDec(t, "binc", testBincH)
|
|
|
+ doTestStrucEncDec(t, testBincH)
|
|
|
}
|
|
|
|
|
|
func TestSimpleStrucEncDec(t *testing.T) {
|
|
|
- doTestStrucEncDec(t, "simple", testSimpleH)
|
|
|
+ doTestStrucEncDec(t, testSimpleH)
|
|
|
+}
|
|
|
+
|
|
|
+func TestJsonRawToStringToRawEtc(t *testing.T) {
|
|
|
+ doTestRawToStringToRawEtc(t, testJsonH)
|
|
|
+}
|
|
|
+
|
|
|
+func TestCborRawToStringToRawEtc(t *testing.T) {
|
|
|
+ doTestRawToStringToRawEtc(t, testCborH)
|
|
|
+}
|
|
|
+
|
|
|
+func TestMsgpackRawToStringToRawEtc(t *testing.T) {
|
|
|
+ doTestRawToStringToRawEtc(t, testMsgpackH)
|
|
|
+}
|
|
|
+
|
|
|
+func TestBincRawToStringToRawEtc(t *testing.T) {
|
|
|
+ doTestRawToStringToRawEtc(t, testBincH)
|
|
|
+}
|
|
|
+
|
|
|
+func TestSimpleRawToStringToRawEtc(t *testing.T) {
|
|
|
+ doTestRawToStringToRawEtc(t, testSimpleH)
|
|
|
+}
|
|
|
+
|
|
|
+func TestJsonStructKeyType(t *testing.T) {
|
|
|
+ doTestStructKeyType(t, testJsonH)
|
|
|
+}
|
|
|
+
|
|
|
+func TestCborStructKeyType(t *testing.T) {
|
|
|
+ doTestStructKeyType(t, testCborH)
|
|
|
+}
|
|
|
+
|
|
|
+func TestMsgpackStructKeyType(t *testing.T) {
|
|
|
+ doTestStructKeyType(t, testMsgpackH)
|
|
|
+}
|
|
|
+
|
|
|
+func TestBincStructKeyType(t *testing.T) {
|
|
|
+ doTestStructKeyType(t, testBincH)
|
|
|
+}
|
|
|
+
|
|
|
+func TestSimpleStructKeyType(t *testing.T) {
|
|
|
+ doTestStructKeyType(t, testSimpleH)
|
|
|
}
|
|
|
|
|
|
// --------
|
|
|
|
|
|
func TestMultipleEncDec(t *testing.T) {
|
|
|
- doTestMultipleEncDec(t, "json", testJsonH)
|
|
|
+ doTestMultipleEncDec(t, testJsonH)
|
|
|
}
|
|
|
|
|
|
// TODO:
|