|
|
@@ -100,15 +100,13 @@ type testSimpleFields struct {
|
|
|
// TODO: test these separately, specifically for reflection and codecgen.
|
|
|
// Unfortunately, ffjson doesn't support these. Its compilation even fails.
|
|
|
|
|
|
- Ui64array [4]uint64
|
|
|
- Ui64slicearray []*[4]uint64
|
|
|
WrapSliceInt64 wrapSliceUint64
|
|
|
WrapSliceString wrapSliceString
|
|
|
|
|
|
Msi64 map[string]int64
|
|
|
}
|
|
|
|
|
|
-type testStrucCommon struct {
|
|
|
+type TestStrucCommon struct {
|
|
|
S string
|
|
|
|
|
|
I64 int64
|
|
|
@@ -145,8 +143,6 @@ type testStrucCommon struct {
|
|
|
// TODO: test these separately, specifically for reflection and codecgen.
|
|
|
// Unfortunately, ffjson doesn't support these. Its compilation even fails.
|
|
|
|
|
|
- Ui64array [4]uint64
|
|
|
- Ui64slicearray []*[4]uint64
|
|
|
WrapSliceInt64 wrapSliceUint64
|
|
|
WrapSliceString wrapSliceString
|
|
|
|
|
|
@@ -174,7 +170,7 @@ type testStrucCommon struct {
|
|
|
type TestStruc struct {
|
|
|
// _struct struct{} `json:",omitempty"` //set omitempty for every field
|
|
|
|
|
|
- testStrucCommon
|
|
|
+ TestStrucCommon
|
|
|
|
|
|
Mtsptr map[string]*TestStruc
|
|
|
Mts map[string]TestStruc
|
|
|
@@ -184,9 +180,11 @@ type TestStruc struct {
|
|
|
|
|
|
var testStrucTime = time.Date(2012, 2, 2, 2, 2, 2, 2000, time.UTC).UTC()
|
|
|
|
|
|
-func populateTestStrucCommon(ts *testStrucCommon, n int, bench, useInterface, useStringKeyOnly bool) {
|
|
|
+func populateTestStrucCommon(ts *TestStrucCommon, n int, bench, useInterface, useStringKeyOnly bool) {
|
|
|
var i64a, i64b, i64c, i64d int64 = 64, 6464, 646464, 64646464
|
|
|
|
|
|
+ // if bench, do not use uint64 values > math.MaxInt64, as bson, etc cannot decode them
|
|
|
+
|
|
|
var a = AnonInTestStruc{
|
|
|
// There's more leeway in altering this.
|
|
|
AS: strRpt(n, "A-String"),
|
|
|
@@ -223,7 +221,6 @@ func populateTestStrucCommon(ts *testStrucCommon, n int, bench, useInterface, us
|
|
|
math.MaxUint8, math.MaxUint8 + 4, math.MaxUint8 - 4,
|
|
|
math.MaxUint16, math.MaxUint16 + 4, math.MaxUint16 - 4,
|
|
|
math.MaxUint32, math.MaxUint32 + 4, math.MaxUint32 - 4,
|
|
|
- math.MaxUint64, math.MaxUint64 - 4,
|
|
|
},
|
|
|
AMSU16: map[string]uint16{strRpt(n, "1"): 1, strRpt(n, "22"): 2, strRpt(n, "333"): 3, strRpt(n, "4444"): 4},
|
|
|
|
|
|
@@ -268,7 +265,10 @@ func populateTestStrucCommon(ts *testStrucCommon, n int, bench, useInterface, us
|
|
|
AMSU16E: map[string]uint16{},
|
|
|
}
|
|
|
|
|
|
- *ts = testStrucCommon{
|
|
|
+ if !bench {
|
|
|
+ a.AUi64slice = append(a.AUi64slice, math.MaxUint64, math.MaxUint64-4)
|
|
|
+ }
|
|
|
+ *ts = TestStrucCommon{
|
|
|
S: strRpt(n, `some really really cool names that are nigerian and american like "ugorji melody nwoke" - get it? `),
|
|
|
|
|
|
// set the numbers close to the limits
|
|
|
@@ -306,8 +306,6 @@ func populateTestStrucCommon(ts *testStrucCommon, n int, bench, useInterface, us
|
|
|
strRpt(n, "\"three\""): 3,
|
|
|
},
|
|
|
|
|
|
- Ui64array: [4]uint64{4, 16, 64, 256},
|
|
|
-
|
|
|
WrapSliceInt64: []uint64{4, 16, 64, 256},
|
|
|
WrapSliceString: []string{strRpt(n, "4"), strRpt(n, "16"), strRpt(n, "64"), strRpt(n, "256")},
|
|
|
|
|
|
@@ -362,8 +360,6 @@ func populateTestStrucCommon(ts *testStrucCommon, n int, bench, useInterface, us
|
|
|
strRpt(n, "\"three\""): 3,
|
|
|
},
|
|
|
|
|
|
- Ui64array: [4]uint64{4, 16, 64, 256},
|
|
|
-
|
|
|
WrapSliceInt64: []uint64{4, 16, 64, 256},
|
|
|
WrapSliceString: []string{strRpt(n, "4"), strRpt(n, "16"), strRpt(n, "64"), strRpt(n, "256")},
|
|
|
},
|
|
|
@@ -372,7 +368,10 @@ func populateTestStrucCommon(ts *testStrucCommon, n int, bench, useInterface, us
|
|
|
NotAnon: a,
|
|
|
}
|
|
|
|
|
|
- ts.Ui64slicearray = []*[4]uint64{&ts.Ui64array, &ts.Ui64array}
|
|
|
+ if bench {
|
|
|
+ ts.Ui64 = math.MaxInt64 * 2 / 3
|
|
|
+ ts.Simplef.Ui64 = ts.Ui64
|
|
|
+ }
|
|
|
|
|
|
if useInterface {
|
|
|
ts.AnonInTestStrucIntf = &AnonInTestStrucIntf{
|
|
|
@@ -403,7 +402,7 @@ func populateTestStrucCommon(ts *testStrucCommon, n int, bench, useInterface, us
|
|
|
|
|
|
func newTestStruc(depth, n int, bench, useInterface, useStringKeyOnly bool) (ts *TestStruc) {
|
|
|
ts = &TestStruc{}
|
|
|
- populateTestStrucCommon(&ts.testStrucCommon, n, bench, useInterface, useStringKeyOnly)
|
|
|
+ populateTestStrucCommon(&ts.TestStrucCommon, n, bench, useInterface, useStringKeyOnly)
|
|
|
if depth > 0 {
|
|
|
depth--
|
|
|
if ts.Mtsptr == nil {
|