mirror of https://github.com/goccy/go-json.git
Merge pull request #141 from goccy/feature/integrate-int-op
Reduce memory usage at compile
This commit is contained in:
commit
80b483ce97
|
@ -245,7 +245,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
A int16 `json:"a"`
|
||||
B int16 `json:"b"`
|
||||
C int16 `json:"c"`
|
||||
}{A: 1, B: 2, C: 3},
|
||||
}{A: 1, B: -2, C: 3},
|
||||
},
|
||||
{
|
||||
name: "HeadInt16MultiFieldsOmitEmpty",
|
||||
|
@ -253,7 +253,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
A int16 `json:"a,omitempty"`
|
||||
B int16 `json:"b,omitempty"`
|
||||
C int16 `json:"c,omitempty"`
|
||||
}{A: 1, B: 2, C: 3},
|
||||
}{A: 1, B: -2, C: 3},
|
||||
},
|
||||
{
|
||||
name: "HeadInt16MultiFieldsString",
|
||||
|
@ -261,7 +261,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
A int16 `json:"a,string"`
|
||||
B int16 `json:"b,string"`
|
||||
C int16 `json:"c,string"`
|
||||
}{A: 1, B: 2, C: 3},
|
||||
}{A: 1, B: -2, C: 3},
|
||||
},
|
||||
|
||||
// HeadInt16PtrMultiFields
|
||||
|
@ -271,7 +271,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
A *int16 `json:"a"`
|
||||
B *int16 `json:"b"`
|
||||
C *int16 `json:"c"`
|
||||
}{A: int16ptr(1), B: int16ptr(2), C: int16ptr(3)},
|
||||
}{A: int16ptr(1), B: int16ptr(-2), C: int16ptr(3)},
|
||||
},
|
||||
{
|
||||
name: "HeadInt16PtrMultiFieldsOmitEmpty",
|
||||
|
@ -279,7 +279,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
A *int16 `json:"a,omitempty"`
|
||||
B *int16 `json:"b,omitempty"`
|
||||
C *int16 `json:"c,omitempty"`
|
||||
}{A: int16ptr(1), B: int16ptr(2), C: int16ptr(3)},
|
||||
}{A: int16ptr(1), B: int16ptr(-2), C: int16ptr(3)},
|
||||
},
|
||||
{
|
||||
name: "HeadInt16PtrMultiFieldsString",
|
||||
|
@ -287,7 +287,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
A *int16 `json:"a,string"`
|
||||
B *int16 `json:"b,string"`
|
||||
C *int16 `json:"c,string"`
|
||||
}{A: int16ptr(1), B: int16ptr(2), C: int16ptr(3)},
|
||||
}{A: int16ptr(1), B: int16ptr(-2), C: int16ptr(3)},
|
||||
},
|
||||
|
||||
// HeadInt16PtrNilMultiFields
|
||||
|
@ -345,21 +345,21 @@ func TestCoverInt16(t *testing.T) {
|
|||
data: &struct {
|
||||
A int16 `json:"a"`
|
||||
B int16 `json:"b"`
|
||||
}{A: 1, B: 2},
|
||||
}{A: 1, B: -2},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt16MultiFieldsOmitEmpty",
|
||||
data: &struct {
|
||||
A int16 `json:"a,omitempty"`
|
||||
B int16 `json:"b,omitempty"`
|
||||
}{A: 1, B: 2},
|
||||
}{A: 1, B: -2},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt16MultiFieldsString",
|
||||
data: &struct {
|
||||
A int16 `json:"a,string"`
|
||||
B int16 `json:"b,string"`
|
||||
}{A: 1, B: 2},
|
||||
}{A: 1, B: -2},
|
||||
},
|
||||
|
||||
// PtrHeadInt16PtrMultiFields
|
||||
|
@ -368,21 +368,21 @@ func TestCoverInt16(t *testing.T) {
|
|||
data: &struct {
|
||||
A *int16 `json:"a"`
|
||||
B *int16 `json:"b"`
|
||||
}{A: int16ptr(1), B: int16ptr(2)},
|
||||
}{A: int16ptr(1), B: int16ptr(-2)},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt16PtrMultiFieldsOmitEmpty",
|
||||
data: &struct {
|
||||
A *int16 `json:"a,omitempty"`
|
||||
B *int16 `json:"b,omitempty"`
|
||||
}{A: int16ptr(1), B: int16ptr(2)},
|
||||
}{A: int16ptr(1), B: int16ptr(-2)},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt16PtrMultiFieldsString",
|
||||
data: &struct {
|
||||
A *int16 `json:"a,string"`
|
||||
B *int16 `json:"b,string"`
|
||||
}{A: int16ptr(1), B: int16ptr(2)},
|
||||
}{A: int16ptr(1), B: int16ptr(-2)},
|
||||
},
|
||||
|
||||
// PtrHeadInt16PtrNilMultiFields
|
||||
|
@ -750,7 +750,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
A int16 `json:"a"`
|
||||
}{A: 1}, B: struct {
|
||||
B int16 `json:"b"`
|
||||
}{B: 2}},
|
||||
}{B: -2}},
|
||||
},
|
||||
{
|
||||
name: "HeadInt16MultiFieldsNotRootOmitEmpty",
|
||||
|
@ -765,7 +765,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
A int16 `json:"a,omitempty"`
|
||||
}{A: 1}, B: struct {
|
||||
B int16 `json:"b,omitempty"`
|
||||
}{B: 2}},
|
||||
}{B: -2}},
|
||||
},
|
||||
{
|
||||
name: "HeadInt16MultiFieldsNotRootString",
|
||||
|
@ -780,7 +780,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
A int16 `json:"a,string"`
|
||||
}{A: 1}, B: struct {
|
||||
B int16 `json:"b,string"`
|
||||
}{B: 2}},
|
||||
}{B: -2}},
|
||||
},
|
||||
|
||||
// HeadInt16PtrMultiFieldsNotRoot
|
||||
|
@ -797,7 +797,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
A *int16 `json:"a"`
|
||||
}{A: int16ptr(1)}, B: struct {
|
||||
B *int16 `json:"b"`
|
||||
}{B: int16ptr(2)}},
|
||||
}{B: int16ptr(-2)}},
|
||||
},
|
||||
{
|
||||
name: "HeadInt16PtrMultiFieldsNotRootOmitEmpty",
|
||||
|
@ -812,7 +812,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
A *int16 `json:"a,omitempty"`
|
||||
}{A: int16ptr(1)}, B: struct {
|
||||
B *int16 `json:"b,omitempty"`
|
||||
}{B: int16ptr(2)}},
|
||||
}{B: int16ptr(-2)}},
|
||||
},
|
||||
{
|
||||
name: "HeadInt16PtrMultiFieldsNotRootString",
|
||||
|
@ -827,7 +827,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
A *int16 `json:"a,string"`
|
||||
}{A: int16ptr(1)}, B: struct {
|
||||
B *int16 `json:"b,string"`
|
||||
}{B: int16ptr(2)}},
|
||||
}{B: int16ptr(-2)}},
|
||||
},
|
||||
|
||||
// HeadInt16PtrNilMultiFieldsNotRoot
|
||||
|
@ -926,7 +926,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
A int16 `json:"a"`
|
||||
}{A: 1}, B: struct {
|
||||
B int16 `json:"b"`
|
||||
}{B: 2}},
|
||||
}{B: -2}},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt16MultiFieldsNotRootOmitEmpty",
|
||||
|
@ -941,7 +941,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
A int16 `json:"a,omitempty"`
|
||||
}{A: 1}, B: struct {
|
||||
B int16 `json:"b,omitempty"`
|
||||
}{B: 2}},
|
||||
}{B: -2}},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt16MultiFieldsNotRootString",
|
||||
|
@ -956,7 +956,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
A int16 `json:"a,string"`
|
||||
}{A: 1}, B: struct {
|
||||
B int16 `json:"b,string"`
|
||||
}{B: 2}},
|
||||
}{B: -2}},
|
||||
},
|
||||
|
||||
// PtrHeadInt16PtrMultiFieldsNotRoot
|
||||
|
@ -973,7 +973,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
A *int16 `json:"a"`
|
||||
}{A: int16ptr(1)}), B: &(struct {
|
||||
B *int16 `json:"b"`
|
||||
}{B: int16ptr(2)})},
|
||||
}{B: int16ptr(-2)})},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt16PtrMultiFieldsNotRootOmitEmpty",
|
||||
|
@ -988,7 +988,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
A *int16 `json:"a,omitempty"`
|
||||
}{A: int16ptr(1)}), B: &(struct {
|
||||
B *int16 `json:"b,omitempty"`
|
||||
}{B: int16ptr(2)})},
|
||||
}{B: int16ptr(-2)})},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt16PtrMultiFieldsNotRootString",
|
||||
|
@ -1003,7 +1003,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
A *int16 `json:"a,string"`
|
||||
}{A: int16ptr(1)}), B: &(struct {
|
||||
B *int16 `json:"b,string"`
|
||||
}{B: int16ptr(2)})},
|
||||
}{B: int16ptr(-2)})},
|
||||
},
|
||||
|
||||
// PtrHeadInt16PtrNilMultiFieldsNotRoot
|
||||
|
@ -1091,7 +1091,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A int16 `json:"a"`
|
||||
B int16 `json:"b"`
|
||||
}{A: 1, B: 2}), B: &(struct {
|
||||
}{A: 1, B: -2}), B: &(struct {
|
||||
A int16 `json:"a"`
|
||||
B int16 `json:"b"`
|
||||
}{A: 3, B: 4})},
|
||||
|
@ -1110,7 +1110,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A int16 `json:"a,omitempty"`
|
||||
B int16 `json:"b,omitempty"`
|
||||
}{A: 1, B: 2}), B: &(struct {
|
||||
}{A: 1, B: -2}), B: &(struct {
|
||||
A int16 `json:"a,omitempty"`
|
||||
B int16 `json:"b,omitempty"`
|
||||
}{A: 3, B: 4})},
|
||||
|
@ -1129,7 +1129,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A int16 `json:"a,string"`
|
||||
B int16 `json:"b,string"`
|
||||
}{A: 1, B: 2}), B: &(struct {
|
||||
}{A: 1, B: -2}), B: &(struct {
|
||||
A int16 `json:"a,string"`
|
||||
B int16 `json:"b,string"`
|
||||
}{A: 3, B: 4})},
|
||||
|
@ -1232,7 +1232,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A *int16 `json:"a"`
|
||||
B *int16 `json:"b"`
|
||||
}{A: int16ptr(1), B: int16ptr(2)}), B: &(struct {
|
||||
}{A: int16ptr(1), B: int16ptr(-2)}), B: &(struct {
|
||||
A *int16 `json:"a"`
|
||||
B *int16 `json:"b"`
|
||||
}{A: int16ptr(3), B: int16ptr(4)})},
|
||||
|
@ -1251,7 +1251,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A *int16 `json:"a,omitempty"`
|
||||
B *int16 `json:"b,omitempty"`
|
||||
}{A: int16ptr(1), B: int16ptr(2)}), B: &(struct {
|
||||
}{A: int16ptr(1), B: int16ptr(-2)}), B: &(struct {
|
||||
A *int16 `json:"a,omitempty"`
|
||||
B *int16 `json:"b,omitempty"`
|
||||
}{A: int16ptr(3), B: int16ptr(4)})},
|
||||
|
@ -1270,7 +1270,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A *int16 `json:"a,string"`
|
||||
B *int16 `json:"b,string"`
|
||||
}{A: int16ptr(1), B: int16ptr(2)}), B: &(struct {
|
||||
}{A: int16ptr(1), B: int16ptr(-2)}), B: &(struct {
|
||||
A *int16 `json:"a,string"`
|
||||
B *int16 `json:"b,string"`
|
||||
}{A: int16ptr(3), B: int16ptr(4)})},
|
||||
|
@ -1366,7 +1366,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
B int16 `json:"b"`
|
||||
}{
|
||||
structInt16: structInt16{A: 1},
|
||||
B: 2,
|
||||
B: -2,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1376,7 +1376,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
B int16 `json:"b,omitempty"`
|
||||
}{
|
||||
structInt16OmitEmpty: structInt16OmitEmpty{A: 1},
|
||||
B: 2,
|
||||
B: -2,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1386,7 +1386,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
B int16 `json:"b,string"`
|
||||
}{
|
||||
structInt16String: structInt16String{A: 1},
|
||||
B: 2,
|
||||
B: -2,
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -1398,7 +1398,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
B int16 `json:"b"`
|
||||
}{
|
||||
structInt16: &structInt16{A: 1},
|
||||
B: 2,
|
||||
B: -2,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1408,7 +1408,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
B int16 `json:"b,omitempty"`
|
||||
}{
|
||||
structInt16OmitEmpty: &structInt16OmitEmpty{A: 1},
|
||||
B: 2,
|
||||
B: -2,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1418,7 +1418,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
B int16 `json:"b,string"`
|
||||
}{
|
||||
structInt16String: &structInt16String{A: 1},
|
||||
B: 2,
|
||||
B: -2,
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -1430,7 +1430,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
B int16 `json:"b"`
|
||||
}{
|
||||
structInt16: nil,
|
||||
B: 2,
|
||||
B: -2,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1440,7 +1440,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
B int16 `json:"b,omitempty"`
|
||||
}{
|
||||
structInt16OmitEmpty: nil,
|
||||
B: 2,
|
||||
B: -2,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1450,7 +1450,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
B int16 `json:"b,string"`
|
||||
}{
|
||||
structInt16String: nil,
|
||||
B: 2,
|
||||
B: -2,
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -1462,7 +1462,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
B *int16 `json:"b"`
|
||||
}{
|
||||
structInt16Ptr: structInt16Ptr{A: int16ptr(1)},
|
||||
B: int16ptr(2),
|
||||
B: int16ptr(-2),
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1472,7 +1472,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
B *int16 `json:"b,omitempty"`
|
||||
}{
|
||||
structInt16PtrOmitEmpty: structInt16PtrOmitEmpty{A: int16ptr(1)},
|
||||
B: int16ptr(2),
|
||||
B: int16ptr(-2),
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1482,7 +1482,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
B *int16 `json:"b,string"`
|
||||
}{
|
||||
structInt16PtrString: structInt16PtrString{A: int16ptr(1)},
|
||||
B: int16ptr(2),
|
||||
B: int16ptr(-2),
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -1494,7 +1494,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
B *int16 `json:"b"`
|
||||
}{
|
||||
structInt16Ptr: structInt16Ptr{A: nil},
|
||||
B: int16ptr(2),
|
||||
B: int16ptr(-2),
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1504,7 +1504,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
B *int16 `json:"b,omitempty"`
|
||||
}{
|
||||
structInt16PtrOmitEmpty: structInt16PtrOmitEmpty{A: nil},
|
||||
B: int16ptr(2),
|
||||
B: int16ptr(-2),
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1514,7 +1514,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
B *int16 `json:"b,string"`
|
||||
}{
|
||||
structInt16PtrString: structInt16PtrString{A: nil},
|
||||
B: int16ptr(2),
|
||||
B: int16ptr(-2),
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -1526,7 +1526,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
B *int16 `json:"b"`
|
||||
}{
|
||||
structInt16Ptr: &structInt16Ptr{A: int16ptr(1)},
|
||||
B: int16ptr(2),
|
||||
B: int16ptr(-2),
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1536,7 +1536,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
B *int16 `json:"b,omitempty"`
|
||||
}{
|
||||
structInt16PtrOmitEmpty: &structInt16PtrOmitEmpty{A: int16ptr(1)},
|
||||
B: int16ptr(2),
|
||||
B: int16ptr(-2),
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1546,7 +1546,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
B *int16 `json:"b,string"`
|
||||
}{
|
||||
structInt16PtrString: &structInt16PtrString{A: int16ptr(1)},
|
||||
B: int16ptr(2),
|
||||
B: int16ptr(-2),
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -1558,7 +1558,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
B *int16 `json:"b"`
|
||||
}{
|
||||
structInt16Ptr: nil,
|
||||
B: int16ptr(2),
|
||||
B: int16ptr(-2),
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1568,7 +1568,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
B *int16 `json:"b,omitempty"`
|
||||
}{
|
||||
structInt16PtrOmitEmpty: nil,
|
||||
B: int16ptr(2),
|
||||
B: int16ptr(-2),
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1578,7 +1578,7 @@ func TestCoverInt16(t *testing.T) {
|
|||
B *int16 `json:"b,string"`
|
||||
}{
|
||||
structInt16PtrString: nil,
|
||||
B: int16ptr(2),
|
||||
B: int16ptr(-2),
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -57,19 +57,19 @@ func TestCoverInt32(t *testing.T) {
|
|||
name: "HeadInt32",
|
||||
data: struct {
|
||||
A int32 `json:"a"`
|
||||
}{A: 1},
|
||||
}{A: -1},
|
||||
},
|
||||
{
|
||||
name: "HeadInt32OmitEmpty",
|
||||
data: struct {
|
||||
A int32 `json:"a,omitempty"`
|
||||
}{A: 1},
|
||||
}{A: -1},
|
||||
},
|
||||
{
|
||||
name: "HeadInt32String",
|
||||
data: struct {
|
||||
A int32 `json:"a,string"`
|
||||
}{A: 1},
|
||||
}{A: -1},
|
||||
},
|
||||
|
||||
// HeadInt32Ptr
|
||||
|
@ -77,19 +77,19 @@ func TestCoverInt32(t *testing.T) {
|
|||
name: "HeadInt32Ptr",
|
||||
data: struct {
|
||||
A *int32 `json:"a"`
|
||||
}{A: int32ptr(1)},
|
||||
}{A: int32ptr(-1)},
|
||||
},
|
||||
{
|
||||
name: "HeadInt32PtrOmitEmpty",
|
||||
data: struct {
|
||||
A *int32 `json:"a,omitempty"`
|
||||
}{A: int32ptr(1)},
|
||||
}{A: int32ptr(-1)},
|
||||
},
|
||||
{
|
||||
name: "HeadInt32PtrString",
|
||||
data: struct {
|
||||
A *int32 `json:"a,string"`
|
||||
}{A: int32ptr(1)},
|
||||
}{A: int32ptr(-1)},
|
||||
},
|
||||
|
||||
// HeadInt32PtrNil
|
||||
|
@ -137,19 +137,19 @@ func TestCoverInt32(t *testing.T) {
|
|||
name: "PtrHeadInt32",
|
||||
data: &struct {
|
||||
A int32 `json:"a"`
|
||||
}{A: 1},
|
||||
}{A: -1},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt32OmitEmpty",
|
||||
data: &struct {
|
||||
A int32 `json:"a,omitempty"`
|
||||
}{A: 1},
|
||||
}{A: -1},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt32String",
|
||||
data: &struct {
|
||||
A int32 `json:"a,string"`
|
||||
}{A: 1},
|
||||
}{A: -1},
|
||||
},
|
||||
|
||||
// PtrHeadInt32Ptr
|
||||
|
@ -157,19 +157,19 @@ func TestCoverInt32(t *testing.T) {
|
|||
name: "PtrHeadInt32Ptr",
|
||||
data: &struct {
|
||||
A *int32 `json:"a"`
|
||||
}{A: int32ptr(1)},
|
||||
}{A: int32ptr(-1)},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt32PtrOmitEmpty",
|
||||
data: &struct {
|
||||
A *int32 `json:"a,omitempty"`
|
||||
}{A: int32ptr(1)},
|
||||
}{A: int32ptr(-1)},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt32PtrString",
|
||||
data: &struct {
|
||||
A *int32 `json:"a,string"`
|
||||
}{A: int32ptr(1)},
|
||||
}{A: int32ptr(-1)},
|
||||
},
|
||||
|
||||
// PtrHeadInt32PtrNil
|
||||
|
@ -245,7 +245,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
A int32 `json:"a"`
|
||||
B int32 `json:"b"`
|
||||
C int32 `json:"c"`
|
||||
}{A: 1, B: 2, C: 3},
|
||||
}{A: -1, B: 2, C: 3},
|
||||
},
|
||||
{
|
||||
name: "HeadInt32MultiFieldsOmitEmpty",
|
||||
|
@ -253,7 +253,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
A int32 `json:"a,omitempty"`
|
||||
B int32 `json:"b,omitempty"`
|
||||
C int32 `json:"c,omitempty"`
|
||||
}{A: 1, B: 2, C: 3},
|
||||
}{A: -1, B: 2, C: 3},
|
||||
},
|
||||
{
|
||||
name: "HeadInt32MultiFieldsString",
|
||||
|
@ -261,7 +261,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
A int32 `json:"a,string"`
|
||||
B int32 `json:"b,string"`
|
||||
C int32 `json:"c,string"`
|
||||
}{A: 1, B: 2, C: 3},
|
||||
}{A: -1, B: 2, C: 3},
|
||||
},
|
||||
|
||||
// HeadInt32PtrMultiFields
|
||||
|
@ -271,7 +271,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
A *int32 `json:"a"`
|
||||
B *int32 `json:"b"`
|
||||
C *int32 `json:"c"`
|
||||
}{A: int32ptr(1), B: int32ptr(2), C: int32ptr(3)},
|
||||
}{A: int32ptr(-1), B: int32ptr(2), C: int32ptr(3)},
|
||||
},
|
||||
{
|
||||
name: "HeadInt32PtrMultiFieldsOmitEmpty",
|
||||
|
@ -279,7 +279,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
A *int32 `json:"a,omitempty"`
|
||||
B *int32 `json:"b,omitempty"`
|
||||
C *int32 `json:"c,omitempty"`
|
||||
}{A: int32ptr(1), B: int32ptr(2), C: int32ptr(3)},
|
||||
}{A: int32ptr(-1), B: int32ptr(2), C: int32ptr(3)},
|
||||
},
|
||||
{
|
||||
name: "HeadInt32PtrMultiFieldsString",
|
||||
|
@ -287,7 +287,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
A *int32 `json:"a,string"`
|
||||
B *int32 `json:"b,string"`
|
||||
C *int32 `json:"c,string"`
|
||||
}{A: int32ptr(1), B: int32ptr(2), C: int32ptr(3)},
|
||||
}{A: int32ptr(-1), B: int32ptr(2), C: int32ptr(3)},
|
||||
},
|
||||
|
||||
// HeadInt32PtrNilMultiFields
|
||||
|
@ -345,21 +345,21 @@ func TestCoverInt32(t *testing.T) {
|
|||
data: &struct {
|
||||
A int32 `json:"a"`
|
||||
B int32 `json:"b"`
|
||||
}{A: 1, B: 2},
|
||||
}{A: -1, B: 2},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt32MultiFieldsOmitEmpty",
|
||||
data: &struct {
|
||||
A int32 `json:"a,omitempty"`
|
||||
B int32 `json:"b,omitempty"`
|
||||
}{A: 1, B: 2},
|
||||
}{A: -1, B: 2},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt32MultiFieldsString",
|
||||
data: &struct {
|
||||
A int32 `json:"a,string"`
|
||||
B int32 `json:"b,string"`
|
||||
}{A: 1, B: 2},
|
||||
}{A: -1, B: 2},
|
||||
},
|
||||
|
||||
// PtrHeadInt32PtrMultiFields
|
||||
|
@ -368,21 +368,21 @@ func TestCoverInt32(t *testing.T) {
|
|||
data: &struct {
|
||||
A *int32 `json:"a"`
|
||||
B *int32 `json:"b"`
|
||||
}{A: int32ptr(1), B: int32ptr(2)},
|
||||
}{A: int32ptr(-1), B: int32ptr(2)},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt32PtrMultiFieldsOmitEmpty",
|
||||
data: &struct {
|
||||
A *int32 `json:"a,omitempty"`
|
||||
B *int32 `json:"b,omitempty"`
|
||||
}{A: int32ptr(1), B: int32ptr(2)},
|
||||
}{A: int32ptr(-1), B: int32ptr(2)},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt32PtrMultiFieldsString",
|
||||
data: &struct {
|
||||
A *int32 `json:"a,string"`
|
||||
B *int32 `json:"b,string"`
|
||||
}{A: int32ptr(1), B: int32ptr(2)},
|
||||
}{A: int32ptr(-1), B: int32ptr(2)},
|
||||
},
|
||||
|
||||
// PtrHeadInt32PtrNilMultiFields
|
||||
|
@ -466,7 +466,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int32 `json:"a"`
|
||||
}{A: 1}},
|
||||
}{A: -1}},
|
||||
},
|
||||
{
|
||||
name: "HeadInt32NotRootOmitEmpty",
|
||||
|
@ -476,7 +476,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int32 `json:"a,omitempty"`
|
||||
}{A: 1}},
|
||||
}{A: -1}},
|
||||
},
|
||||
{
|
||||
name: "HeadInt32NotRootString",
|
||||
|
@ -486,7 +486,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int32 `json:"a,string"`
|
||||
}{A: 1}},
|
||||
}{A: -1}},
|
||||
},
|
||||
|
||||
// HeadInt32PtrNotRoot
|
||||
|
@ -498,7 +498,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A *int32 `json:"a"`
|
||||
}{int32ptr(1)}},
|
||||
}{int32ptr(-1)}},
|
||||
},
|
||||
{
|
||||
name: "HeadInt32PtrNotRootOmitEmpty",
|
||||
|
@ -508,7 +508,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A *int32 `json:"a,omitempty"`
|
||||
}{int32ptr(1)}},
|
||||
}{int32ptr(-1)}},
|
||||
},
|
||||
{
|
||||
name: "HeadInt32PtrNotRootString",
|
||||
|
@ -518,7 +518,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A *int32 `json:"a,string"`
|
||||
}{int32ptr(1)}},
|
||||
}{int32ptr(-1)}},
|
||||
},
|
||||
|
||||
// HeadInt32PtrNilNotRoot
|
||||
|
@ -588,7 +588,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A int32 `json:"a"`
|
||||
}{A: 1})},
|
||||
}{A: -1})},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt32NotRootOmitEmpty",
|
||||
|
@ -598,7 +598,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A int32 `json:"a,omitempty"`
|
||||
}{A: 1})},
|
||||
}{A: -1})},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt32NotRootString",
|
||||
|
@ -608,7 +608,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A int32 `json:"a,string"`
|
||||
}{A: 1})},
|
||||
}{A: -1})},
|
||||
},
|
||||
|
||||
// PtrHeadInt32PtrNotRoot
|
||||
|
@ -620,7 +620,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A *int32 `json:"a"`
|
||||
}{A: int32ptr(1)})},
|
||||
}{A: int32ptr(-1)})},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt32PtrNotRootOmitEmpty",
|
||||
|
@ -630,7 +630,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A *int32 `json:"a,omitempty"`
|
||||
}{A: int32ptr(1)})},
|
||||
}{A: int32ptr(-1)})},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt32PtrNotRootString",
|
||||
|
@ -640,7 +640,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A *int32 `json:"a,string"`
|
||||
}{A: int32ptr(1)})},
|
||||
}{A: int32ptr(-1)})},
|
||||
},
|
||||
|
||||
// PtrHeadInt32PtrNilNotRoot
|
||||
|
@ -748,7 +748,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int32 `json:"a"`
|
||||
}{A: 1}, B: struct {
|
||||
}{A: -1}, B: struct {
|
||||
B int32 `json:"b"`
|
||||
}{B: 2}},
|
||||
},
|
||||
|
@ -763,7 +763,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int32 `json:"a,omitempty"`
|
||||
}{A: 1}, B: struct {
|
||||
}{A: -1}, B: struct {
|
||||
B int32 `json:"b,omitempty"`
|
||||
}{B: 2}},
|
||||
},
|
||||
|
@ -778,7 +778,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int32 `json:"a,string"`
|
||||
}{A: 1}, B: struct {
|
||||
}{A: -1}, B: struct {
|
||||
B int32 `json:"b,string"`
|
||||
}{B: 2}},
|
||||
},
|
||||
|
@ -795,7 +795,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A *int32 `json:"a"`
|
||||
}{A: int32ptr(1)}, B: struct {
|
||||
}{A: int32ptr(-1)}, B: struct {
|
||||
B *int32 `json:"b"`
|
||||
}{B: int32ptr(2)}},
|
||||
},
|
||||
|
@ -810,7 +810,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A *int32 `json:"a,omitempty"`
|
||||
}{A: int32ptr(1)}, B: struct {
|
||||
}{A: int32ptr(-1)}, B: struct {
|
||||
B *int32 `json:"b,omitempty"`
|
||||
}{B: int32ptr(2)}},
|
||||
},
|
||||
|
@ -825,7 +825,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A *int32 `json:"a,string"`
|
||||
}{A: int32ptr(1)}, B: struct {
|
||||
}{A: int32ptr(-1)}, B: struct {
|
||||
B *int32 `json:"b,string"`
|
||||
}{B: int32ptr(2)}},
|
||||
},
|
||||
|
@ -924,7 +924,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int32 `json:"a"`
|
||||
}{A: 1}, B: struct {
|
||||
}{A: -1}, B: struct {
|
||||
B int32 `json:"b"`
|
||||
}{B: 2}},
|
||||
},
|
||||
|
@ -939,7 +939,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int32 `json:"a,omitempty"`
|
||||
}{A: 1}, B: struct {
|
||||
}{A: -1}, B: struct {
|
||||
B int32 `json:"b,omitempty"`
|
||||
}{B: 2}},
|
||||
},
|
||||
|
@ -954,7 +954,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int32 `json:"a,string"`
|
||||
}{A: 1}, B: struct {
|
||||
}{A: -1}, B: struct {
|
||||
B int32 `json:"b,string"`
|
||||
}{B: 2}},
|
||||
},
|
||||
|
@ -971,7 +971,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A *int32 `json:"a"`
|
||||
}{A: int32ptr(1)}), B: &(struct {
|
||||
}{A: int32ptr(-1)}), B: &(struct {
|
||||
B *int32 `json:"b"`
|
||||
}{B: int32ptr(2)})},
|
||||
},
|
||||
|
@ -986,7 +986,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A *int32 `json:"a,omitempty"`
|
||||
}{A: int32ptr(1)}), B: &(struct {
|
||||
}{A: int32ptr(-1)}), B: &(struct {
|
||||
B *int32 `json:"b,omitempty"`
|
||||
}{B: int32ptr(2)})},
|
||||
},
|
||||
|
@ -1001,7 +1001,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A *int32 `json:"a,string"`
|
||||
}{A: int32ptr(1)}), B: &(struct {
|
||||
}{A: int32ptr(-1)}), B: &(struct {
|
||||
B *int32 `json:"b,string"`
|
||||
}{B: int32ptr(2)})},
|
||||
},
|
||||
|
@ -1091,7 +1091,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A int32 `json:"a"`
|
||||
B int32 `json:"b"`
|
||||
}{A: 1, B: 2}), B: &(struct {
|
||||
}{A: -1, B: 2}), B: &(struct {
|
||||
A int32 `json:"a"`
|
||||
B int32 `json:"b"`
|
||||
}{A: 3, B: 4})},
|
||||
|
@ -1110,7 +1110,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A int32 `json:"a,omitempty"`
|
||||
B int32 `json:"b,omitempty"`
|
||||
}{A: 1, B: 2}), B: &(struct {
|
||||
}{A: -1, B: 2}), B: &(struct {
|
||||
A int32 `json:"a,omitempty"`
|
||||
B int32 `json:"b,omitempty"`
|
||||
}{A: 3, B: 4})},
|
||||
|
@ -1129,7 +1129,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A int32 `json:"a,string"`
|
||||
B int32 `json:"b,string"`
|
||||
}{A: 1, B: 2}), B: &(struct {
|
||||
}{A: -1, B: 2}), B: &(struct {
|
||||
A int32 `json:"a,string"`
|
||||
B int32 `json:"b,string"`
|
||||
}{A: 3, B: 4})},
|
||||
|
@ -1232,7 +1232,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A *int32 `json:"a"`
|
||||
B *int32 `json:"b"`
|
||||
}{A: int32ptr(1), B: int32ptr(2)}), B: &(struct {
|
||||
}{A: int32ptr(-1), B: int32ptr(2)}), B: &(struct {
|
||||
A *int32 `json:"a"`
|
||||
B *int32 `json:"b"`
|
||||
}{A: int32ptr(3), B: int32ptr(4)})},
|
||||
|
@ -1251,7 +1251,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A *int32 `json:"a,omitempty"`
|
||||
B *int32 `json:"b,omitempty"`
|
||||
}{A: int32ptr(1), B: int32ptr(2)}), B: &(struct {
|
||||
}{A: int32ptr(-1), B: int32ptr(2)}), B: &(struct {
|
||||
A *int32 `json:"a,omitempty"`
|
||||
B *int32 `json:"b,omitempty"`
|
||||
}{A: int32ptr(3), B: int32ptr(4)})},
|
||||
|
@ -1270,7 +1270,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A *int32 `json:"a,string"`
|
||||
B *int32 `json:"b,string"`
|
||||
}{A: int32ptr(1), B: int32ptr(2)}), B: &(struct {
|
||||
}{A: int32ptr(-1), B: int32ptr(2)}), B: &(struct {
|
||||
A *int32 `json:"a,string"`
|
||||
B *int32 `json:"b,string"`
|
||||
}{A: int32ptr(3), B: int32ptr(4)})},
|
||||
|
@ -1365,7 +1365,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
structInt32
|
||||
B int32 `json:"b"`
|
||||
}{
|
||||
structInt32: structInt32{A: 1},
|
||||
structInt32: structInt32{A: -1},
|
||||
B: 2,
|
||||
},
|
||||
},
|
||||
|
@ -1375,7 +1375,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
structInt32OmitEmpty
|
||||
B int32 `json:"b,omitempty"`
|
||||
}{
|
||||
structInt32OmitEmpty: structInt32OmitEmpty{A: 1},
|
||||
structInt32OmitEmpty: structInt32OmitEmpty{A: -1},
|
||||
B: 2,
|
||||
},
|
||||
},
|
||||
|
@ -1385,7 +1385,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
structInt32String
|
||||
B int32 `json:"b,string"`
|
||||
}{
|
||||
structInt32String: structInt32String{A: 1},
|
||||
structInt32String: structInt32String{A: -1},
|
||||
B: 2,
|
||||
},
|
||||
},
|
||||
|
@ -1397,7 +1397,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
*structInt32
|
||||
B int32 `json:"b"`
|
||||
}{
|
||||
structInt32: &structInt32{A: 1},
|
||||
structInt32: &structInt32{A: -1},
|
||||
B: 2,
|
||||
},
|
||||
},
|
||||
|
@ -1407,7 +1407,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
*structInt32OmitEmpty
|
||||
B int32 `json:"b,omitempty"`
|
||||
}{
|
||||
structInt32OmitEmpty: &structInt32OmitEmpty{A: 1},
|
||||
structInt32OmitEmpty: &structInt32OmitEmpty{A: -1},
|
||||
B: 2,
|
||||
},
|
||||
},
|
||||
|
@ -1417,7 +1417,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
*structInt32String
|
||||
B int32 `json:"b,string"`
|
||||
}{
|
||||
structInt32String: &structInt32String{A: 1},
|
||||
structInt32String: &structInt32String{A: -1},
|
||||
B: 2,
|
||||
},
|
||||
},
|
||||
|
@ -1461,7 +1461,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
structInt32Ptr
|
||||
B *int32 `json:"b"`
|
||||
}{
|
||||
structInt32Ptr: structInt32Ptr{A: int32ptr(1)},
|
||||
structInt32Ptr: structInt32Ptr{A: int32ptr(-1)},
|
||||
B: int32ptr(2),
|
||||
},
|
||||
},
|
||||
|
@ -1471,7 +1471,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
structInt32PtrOmitEmpty
|
||||
B *int32 `json:"b,omitempty"`
|
||||
}{
|
||||
structInt32PtrOmitEmpty: structInt32PtrOmitEmpty{A: int32ptr(1)},
|
||||
structInt32PtrOmitEmpty: structInt32PtrOmitEmpty{A: int32ptr(-1)},
|
||||
B: int32ptr(2),
|
||||
},
|
||||
},
|
||||
|
@ -1481,7 +1481,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
structInt32PtrString
|
||||
B *int32 `json:"b,string"`
|
||||
}{
|
||||
structInt32PtrString: structInt32PtrString{A: int32ptr(1)},
|
||||
structInt32PtrString: structInt32PtrString{A: int32ptr(-1)},
|
||||
B: int32ptr(2),
|
||||
},
|
||||
},
|
||||
|
@ -1525,7 +1525,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
*structInt32Ptr
|
||||
B *int32 `json:"b"`
|
||||
}{
|
||||
structInt32Ptr: &structInt32Ptr{A: int32ptr(1)},
|
||||
structInt32Ptr: &structInt32Ptr{A: int32ptr(-1)},
|
||||
B: int32ptr(2),
|
||||
},
|
||||
},
|
||||
|
@ -1535,7 +1535,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
*structInt32PtrOmitEmpty
|
||||
B *int32 `json:"b,omitempty"`
|
||||
}{
|
||||
structInt32PtrOmitEmpty: &structInt32PtrOmitEmpty{A: int32ptr(1)},
|
||||
structInt32PtrOmitEmpty: &structInt32PtrOmitEmpty{A: int32ptr(-1)},
|
||||
B: int32ptr(2),
|
||||
},
|
||||
},
|
||||
|
@ -1545,7 +1545,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
*structInt32PtrString
|
||||
B *int32 `json:"b,string"`
|
||||
}{
|
||||
structInt32PtrString: &structInt32PtrString{A: int32ptr(1)},
|
||||
structInt32PtrString: &structInt32PtrString{A: int32ptr(-1)},
|
||||
B: int32ptr(2),
|
||||
},
|
||||
},
|
||||
|
@ -1588,7 +1588,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
data: struct {
|
||||
structInt32
|
||||
}{
|
||||
structInt32: structInt32{A: 1},
|
||||
structInt32: structInt32{A: -1},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1596,7 +1596,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
data: struct {
|
||||
structInt32OmitEmpty
|
||||
}{
|
||||
structInt32OmitEmpty: structInt32OmitEmpty{A: 1},
|
||||
structInt32OmitEmpty: structInt32OmitEmpty{A: -1},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1604,7 +1604,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
data: struct {
|
||||
structInt32String
|
||||
}{
|
||||
structInt32String: structInt32String{A: 1},
|
||||
structInt32String: structInt32String{A: -1},
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -1614,7 +1614,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
data: struct {
|
||||
*structInt32
|
||||
}{
|
||||
structInt32: &structInt32{A: 1},
|
||||
structInt32: &structInt32{A: -1},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1622,7 +1622,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
data: struct {
|
||||
*structInt32OmitEmpty
|
||||
}{
|
||||
structInt32OmitEmpty: &structInt32OmitEmpty{A: 1},
|
||||
structInt32OmitEmpty: &structInt32OmitEmpty{A: -1},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1630,7 +1630,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
data: struct {
|
||||
*structInt32String
|
||||
}{
|
||||
structInt32String: &structInt32String{A: 1},
|
||||
structInt32String: &structInt32String{A: -1},
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -1666,7 +1666,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
data: struct {
|
||||
structInt32Ptr
|
||||
}{
|
||||
structInt32Ptr: structInt32Ptr{A: int32ptr(1)},
|
||||
structInt32Ptr: structInt32Ptr{A: int32ptr(-1)},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1674,7 +1674,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
data: struct {
|
||||
structInt32PtrOmitEmpty
|
||||
}{
|
||||
structInt32PtrOmitEmpty: structInt32PtrOmitEmpty{A: int32ptr(1)},
|
||||
structInt32PtrOmitEmpty: structInt32PtrOmitEmpty{A: int32ptr(-1)},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1682,7 +1682,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
data: struct {
|
||||
structInt32PtrString
|
||||
}{
|
||||
structInt32PtrString: structInt32PtrString{A: int32ptr(1)},
|
||||
structInt32PtrString: structInt32PtrString{A: int32ptr(-1)},
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -1718,7 +1718,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
data: struct {
|
||||
*structInt32Ptr
|
||||
}{
|
||||
structInt32Ptr: &structInt32Ptr{A: int32ptr(1)},
|
||||
structInt32Ptr: &structInt32Ptr{A: int32ptr(-1)},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1726,7 +1726,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
data: struct {
|
||||
*structInt32PtrOmitEmpty
|
||||
}{
|
||||
structInt32PtrOmitEmpty: &structInt32PtrOmitEmpty{A: int32ptr(1)},
|
||||
structInt32PtrOmitEmpty: &structInt32PtrOmitEmpty{A: int32ptr(-1)},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1734,7 +1734,7 @@ func TestCoverInt32(t *testing.T) {
|
|||
data: struct {
|
||||
*structInt32PtrString
|
||||
}{
|
||||
structInt32PtrString: &structInt32PtrString{A: int32ptr(1)},
|
||||
structInt32PtrString: &structInt32PtrString{A: int32ptr(-1)},
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -57,19 +57,19 @@ func TestCoverInt64(t *testing.T) {
|
|||
name: "HeadInt64",
|
||||
data: struct {
|
||||
A int64 `json:"a"`
|
||||
}{A: 1},
|
||||
}{A: -1},
|
||||
},
|
||||
{
|
||||
name: "HeadInt64OmitEmpty",
|
||||
data: struct {
|
||||
A int64 `json:"a,omitempty"`
|
||||
}{A: 1},
|
||||
}{A: -1},
|
||||
},
|
||||
{
|
||||
name: "HeadInt64String",
|
||||
data: struct {
|
||||
A int64 `json:"a,string"`
|
||||
}{A: 1},
|
||||
}{A: -1},
|
||||
},
|
||||
|
||||
// HeadInt64Ptr
|
||||
|
@ -77,19 +77,19 @@ func TestCoverInt64(t *testing.T) {
|
|||
name: "HeadInt64Ptr",
|
||||
data: struct {
|
||||
A *int64 `json:"a"`
|
||||
}{A: int64ptr(1)},
|
||||
}{A: int64ptr(-1)},
|
||||
},
|
||||
{
|
||||
name: "HeadInt64PtrOmitEmpty",
|
||||
data: struct {
|
||||
A *int64 `json:"a,omitempty"`
|
||||
}{A: int64ptr(1)},
|
||||
}{A: int64ptr(-1)},
|
||||
},
|
||||
{
|
||||
name: "HeadInt64PtrString",
|
||||
data: struct {
|
||||
A *int64 `json:"a,string"`
|
||||
}{A: int64ptr(1)},
|
||||
}{A: int64ptr(-1)},
|
||||
},
|
||||
|
||||
// HeadInt64PtrNil
|
||||
|
@ -137,19 +137,19 @@ func TestCoverInt64(t *testing.T) {
|
|||
name: "PtrHeadInt64",
|
||||
data: &struct {
|
||||
A int64 `json:"a"`
|
||||
}{A: 1},
|
||||
}{A: -1},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt64OmitEmpty",
|
||||
data: &struct {
|
||||
A int64 `json:"a,omitempty"`
|
||||
}{A: 1},
|
||||
}{A: -1},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt64String",
|
||||
data: &struct {
|
||||
A int64 `json:"a,string"`
|
||||
}{A: 1},
|
||||
}{A: -1},
|
||||
},
|
||||
|
||||
// PtrHeadInt64Ptr
|
||||
|
@ -157,19 +157,19 @@ func TestCoverInt64(t *testing.T) {
|
|||
name: "PtrHeadInt64Ptr",
|
||||
data: &struct {
|
||||
A *int64 `json:"a"`
|
||||
}{A: int64ptr(1)},
|
||||
}{A: int64ptr(-1)},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt64PtrOmitEmpty",
|
||||
data: &struct {
|
||||
A *int64 `json:"a,omitempty"`
|
||||
}{A: int64ptr(1)},
|
||||
}{A: int64ptr(-1)},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt64PtrString",
|
||||
data: &struct {
|
||||
A *int64 `json:"a,string"`
|
||||
}{A: int64ptr(1)},
|
||||
}{A: int64ptr(-1)},
|
||||
},
|
||||
|
||||
// PtrHeadInt64PtrNil
|
||||
|
@ -245,7 +245,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
A int64 `json:"a"`
|
||||
B int64 `json:"b"`
|
||||
C int64 `json:"c"`
|
||||
}{A: 1, B: 2, C: 3},
|
||||
}{A: -1, B: 2, C: 3},
|
||||
},
|
||||
{
|
||||
name: "HeadInt64MultiFieldsOmitEmpty",
|
||||
|
@ -253,7 +253,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
A int64 `json:"a,omitempty"`
|
||||
B int64 `json:"b,omitempty"`
|
||||
C int64 `json:"c,omitempty"`
|
||||
}{A: 1, B: 2, C: 3},
|
||||
}{A: -1, B: 2, C: 3},
|
||||
},
|
||||
{
|
||||
name: "HeadInt64MultiFieldsString",
|
||||
|
@ -261,7 +261,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
A int64 `json:"a,string"`
|
||||
B int64 `json:"b,string"`
|
||||
C int64 `json:"c,string"`
|
||||
}{A: 1, B: 2, C: 3},
|
||||
}{A: -1, B: 2, C: 3},
|
||||
},
|
||||
|
||||
// HeadInt64PtrMultiFields
|
||||
|
@ -271,7 +271,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
A *int64 `json:"a"`
|
||||
B *int64 `json:"b"`
|
||||
C *int64 `json:"c"`
|
||||
}{A: int64ptr(1), B: int64ptr(2), C: int64ptr(3)},
|
||||
}{A: int64ptr(-1), B: int64ptr(2), C: int64ptr(3)},
|
||||
},
|
||||
{
|
||||
name: "HeadInt64PtrMultiFieldsOmitEmpty",
|
||||
|
@ -279,7 +279,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
A *int64 `json:"a,omitempty"`
|
||||
B *int64 `json:"b,omitempty"`
|
||||
C *int64 `json:"c,omitempty"`
|
||||
}{A: int64ptr(1), B: int64ptr(2), C: int64ptr(3)},
|
||||
}{A: int64ptr(-1), B: int64ptr(2), C: int64ptr(3)},
|
||||
},
|
||||
{
|
||||
name: "HeadInt64PtrMultiFieldsString",
|
||||
|
@ -287,7 +287,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
A *int64 `json:"a,string"`
|
||||
B *int64 `json:"b,string"`
|
||||
C *int64 `json:"c,string"`
|
||||
}{A: int64ptr(1), B: int64ptr(2), C: int64ptr(3)},
|
||||
}{A: int64ptr(-1), B: int64ptr(2), C: int64ptr(3)},
|
||||
},
|
||||
|
||||
// HeadInt64PtrNilMultiFields
|
||||
|
@ -345,21 +345,21 @@ func TestCoverInt64(t *testing.T) {
|
|||
data: &struct {
|
||||
A int64 `json:"a"`
|
||||
B int64 `json:"b"`
|
||||
}{A: 1, B: 2},
|
||||
}{A: -1, B: 2},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt64MultiFieldsOmitEmpty",
|
||||
data: &struct {
|
||||
A int64 `json:"a,omitempty"`
|
||||
B int64 `json:"b,omitempty"`
|
||||
}{A: 1, B: 2},
|
||||
}{A: -1, B: 2},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt64MultiFieldsString",
|
||||
data: &struct {
|
||||
A int64 `json:"a,string"`
|
||||
B int64 `json:"b,string"`
|
||||
}{A: 1, B: 2},
|
||||
}{A: -1, B: 2},
|
||||
},
|
||||
|
||||
// PtrHeadInt64PtrMultiFields
|
||||
|
@ -368,21 +368,21 @@ func TestCoverInt64(t *testing.T) {
|
|||
data: &struct {
|
||||
A *int64 `json:"a"`
|
||||
B *int64 `json:"b"`
|
||||
}{A: int64ptr(1), B: int64ptr(2)},
|
||||
}{A: int64ptr(-1), B: int64ptr(2)},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt64PtrMultiFieldsOmitEmpty",
|
||||
data: &struct {
|
||||
A *int64 `json:"a,omitempty"`
|
||||
B *int64 `json:"b,omitempty"`
|
||||
}{A: int64ptr(1), B: int64ptr(2)},
|
||||
}{A: int64ptr(-1), B: int64ptr(2)},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt64PtrMultiFieldsString",
|
||||
data: &struct {
|
||||
A *int64 `json:"a,string"`
|
||||
B *int64 `json:"b,string"`
|
||||
}{A: int64ptr(1), B: int64ptr(2)},
|
||||
}{A: int64ptr(-1), B: int64ptr(2)},
|
||||
},
|
||||
|
||||
// PtrHeadInt64PtrNilMultiFields
|
||||
|
@ -466,7 +466,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int64 `json:"a"`
|
||||
}{A: 1}},
|
||||
}{A: -1}},
|
||||
},
|
||||
{
|
||||
name: "HeadInt64NotRootOmitEmpty",
|
||||
|
@ -476,7 +476,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int64 `json:"a,omitempty"`
|
||||
}{A: 1}},
|
||||
}{A: -1}},
|
||||
},
|
||||
{
|
||||
name: "HeadInt64NotRootString",
|
||||
|
@ -486,7 +486,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int64 `json:"a,string"`
|
||||
}{A: 1}},
|
||||
}{A: -1}},
|
||||
},
|
||||
|
||||
// HeadInt64PtrNotRoot
|
||||
|
@ -498,7 +498,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A *int64 `json:"a"`
|
||||
}{int64ptr(1)}},
|
||||
}{int64ptr(-1)}},
|
||||
},
|
||||
{
|
||||
name: "HeadInt64PtrNotRootOmitEmpty",
|
||||
|
@ -508,7 +508,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A *int64 `json:"a,omitempty"`
|
||||
}{int64ptr(1)}},
|
||||
}{int64ptr(-1)}},
|
||||
},
|
||||
{
|
||||
name: "HeadInt64PtrNotRootString",
|
||||
|
@ -518,7 +518,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A *int64 `json:"a,string"`
|
||||
}{int64ptr(1)}},
|
||||
}{int64ptr(-1)}},
|
||||
},
|
||||
|
||||
// HeadInt64PtrNilNotRoot
|
||||
|
@ -588,7 +588,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A int64 `json:"a"`
|
||||
}{A: 1})},
|
||||
}{A: -1})},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt64NotRootOmitEmpty",
|
||||
|
@ -598,7 +598,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A int64 `json:"a,omitempty"`
|
||||
}{A: 1})},
|
||||
}{A: -1})},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt64NotRootString",
|
||||
|
@ -608,7 +608,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A int64 `json:"a,string"`
|
||||
}{A: 1})},
|
||||
}{A: -1})},
|
||||
},
|
||||
|
||||
// PtrHeadInt64PtrNotRoot
|
||||
|
@ -620,7 +620,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A *int64 `json:"a"`
|
||||
}{A: int64ptr(1)})},
|
||||
}{A: int64ptr(-1)})},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt64PtrNotRootOmitEmpty",
|
||||
|
@ -630,7 +630,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A *int64 `json:"a,omitempty"`
|
||||
}{A: int64ptr(1)})},
|
||||
}{A: int64ptr(-1)})},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt64PtrNotRootString",
|
||||
|
@ -640,7 +640,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A *int64 `json:"a,string"`
|
||||
}{A: int64ptr(1)})},
|
||||
}{A: int64ptr(-1)})},
|
||||
},
|
||||
|
||||
// PtrHeadInt64PtrNilNotRoot
|
||||
|
@ -748,7 +748,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int64 `json:"a"`
|
||||
}{A: 1}, B: struct {
|
||||
}{A: -1}, B: struct {
|
||||
B int64 `json:"b"`
|
||||
}{B: 2}},
|
||||
},
|
||||
|
@ -763,7 +763,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int64 `json:"a,omitempty"`
|
||||
}{A: 1}, B: struct {
|
||||
}{A: -1}, B: struct {
|
||||
B int64 `json:"b,omitempty"`
|
||||
}{B: 2}},
|
||||
},
|
||||
|
@ -778,7 +778,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int64 `json:"a,string"`
|
||||
}{A: 1}, B: struct {
|
||||
}{A: -1}, B: struct {
|
||||
B int64 `json:"b,string"`
|
||||
}{B: 2}},
|
||||
},
|
||||
|
@ -795,7 +795,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A *int64 `json:"a"`
|
||||
}{A: int64ptr(1)}, B: struct {
|
||||
}{A: int64ptr(-1)}, B: struct {
|
||||
B *int64 `json:"b"`
|
||||
}{B: int64ptr(2)}},
|
||||
},
|
||||
|
@ -810,7 +810,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A *int64 `json:"a,omitempty"`
|
||||
}{A: int64ptr(1)}, B: struct {
|
||||
}{A: int64ptr(-1)}, B: struct {
|
||||
B *int64 `json:"b,omitempty"`
|
||||
}{B: int64ptr(2)}},
|
||||
},
|
||||
|
@ -825,7 +825,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A *int64 `json:"a,string"`
|
||||
}{A: int64ptr(1)}, B: struct {
|
||||
}{A: int64ptr(-1)}, B: struct {
|
||||
B *int64 `json:"b,string"`
|
||||
}{B: int64ptr(2)}},
|
||||
},
|
||||
|
@ -924,7 +924,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int64 `json:"a"`
|
||||
}{A: 1}, B: struct {
|
||||
}{A: -1}, B: struct {
|
||||
B int64 `json:"b"`
|
||||
}{B: 2}},
|
||||
},
|
||||
|
@ -939,7 +939,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int64 `json:"a,omitempty"`
|
||||
}{A: 1}, B: struct {
|
||||
}{A: -1}, B: struct {
|
||||
B int64 `json:"b,omitempty"`
|
||||
}{B: 2}},
|
||||
},
|
||||
|
@ -954,7 +954,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int64 `json:"a,string"`
|
||||
}{A: 1}, B: struct {
|
||||
}{A: -1}, B: struct {
|
||||
B int64 `json:"b,string"`
|
||||
}{B: 2}},
|
||||
},
|
||||
|
@ -971,7 +971,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A *int64 `json:"a"`
|
||||
}{A: int64ptr(1)}), B: &(struct {
|
||||
}{A: int64ptr(-1)}), B: &(struct {
|
||||
B *int64 `json:"b"`
|
||||
}{B: int64ptr(2)})},
|
||||
},
|
||||
|
@ -986,7 +986,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A *int64 `json:"a,omitempty"`
|
||||
}{A: int64ptr(1)}), B: &(struct {
|
||||
}{A: int64ptr(-1)}), B: &(struct {
|
||||
B *int64 `json:"b,omitempty"`
|
||||
}{B: int64ptr(2)})},
|
||||
},
|
||||
|
@ -1001,7 +1001,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A *int64 `json:"a,string"`
|
||||
}{A: int64ptr(1)}), B: &(struct {
|
||||
}{A: int64ptr(-1)}), B: &(struct {
|
||||
B *int64 `json:"b,string"`
|
||||
}{B: int64ptr(2)})},
|
||||
},
|
||||
|
@ -1091,7 +1091,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A int64 `json:"a"`
|
||||
B int64 `json:"b"`
|
||||
}{A: 1, B: 2}), B: &(struct {
|
||||
}{A: -1, B: 2}), B: &(struct {
|
||||
A int64 `json:"a"`
|
||||
B int64 `json:"b"`
|
||||
}{A: 3, B: 4})},
|
||||
|
@ -1110,7 +1110,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A int64 `json:"a,omitempty"`
|
||||
B int64 `json:"b,omitempty"`
|
||||
}{A: 1, B: 2}), B: &(struct {
|
||||
}{A: -1, B: 2}), B: &(struct {
|
||||
A int64 `json:"a,omitempty"`
|
||||
B int64 `json:"b,omitempty"`
|
||||
}{A: 3, B: 4})},
|
||||
|
@ -1129,7 +1129,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A int64 `json:"a,string"`
|
||||
B int64 `json:"b,string"`
|
||||
}{A: 1, B: 2}), B: &(struct {
|
||||
}{A: -1, B: 2}), B: &(struct {
|
||||
A int64 `json:"a,string"`
|
||||
B int64 `json:"b,string"`
|
||||
}{A: 3, B: 4})},
|
||||
|
@ -1232,7 +1232,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A *int64 `json:"a"`
|
||||
B *int64 `json:"b"`
|
||||
}{A: int64ptr(1), B: int64ptr(2)}), B: &(struct {
|
||||
}{A: int64ptr(-1), B: int64ptr(2)}), B: &(struct {
|
||||
A *int64 `json:"a"`
|
||||
B *int64 `json:"b"`
|
||||
}{A: int64ptr(3), B: int64ptr(4)})},
|
||||
|
@ -1251,7 +1251,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A *int64 `json:"a,omitempty"`
|
||||
B *int64 `json:"b,omitempty"`
|
||||
}{A: int64ptr(1), B: int64ptr(2)}), B: &(struct {
|
||||
}{A: int64ptr(-1), B: int64ptr(2)}), B: &(struct {
|
||||
A *int64 `json:"a,omitempty"`
|
||||
B *int64 `json:"b,omitempty"`
|
||||
}{A: int64ptr(3), B: int64ptr(4)})},
|
||||
|
@ -1270,7 +1270,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A *int64 `json:"a,string"`
|
||||
B *int64 `json:"b,string"`
|
||||
}{A: int64ptr(1), B: int64ptr(2)}), B: &(struct {
|
||||
}{A: int64ptr(-1), B: int64ptr(2)}), B: &(struct {
|
||||
A *int64 `json:"a,string"`
|
||||
B *int64 `json:"b,string"`
|
||||
}{A: int64ptr(3), B: int64ptr(4)})},
|
||||
|
@ -1365,7 +1365,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
structInt64
|
||||
B int64 `json:"b"`
|
||||
}{
|
||||
structInt64: structInt64{A: 1},
|
||||
structInt64: structInt64{A: -1},
|
||||
B: 2,
|
||||
},
|
||||
},
|
||||
|
@ -1375,7 +1375,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
structInt64OmitEmpty
|
||||
B int64 `json:"b,omitempty"`
|
||||
}{
|
||||
structInt64OmitEmpty: structInt64OmitEmpty{A: 1},
|
||||
structInt64OmitEmpty: structInt64OmitEmpty{A: -1},
|
||||
B: 2,
|
||||
},
|
||||
},
|
||||
|
@ -1385,7 +1385,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
structInt64String
|
||||
B int64 `json:"b,string"`
|
||||
}{
|
||||
structInt64String: structInt64String{A: 1},
|
||||
structInt64String: structInt64String{A: -1},
|
||||
B: 2,
|
||||
},
|
||||
},
|
||||
|
@ -1397,7 +1397,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
*structInt64
|
||||
B int64 `json:"b"`
|
||||
}{
|
||||
structInt64: &structInt64{A: 1},
|
||||
structInt64: &structInt64{A: -1},
|
||||
B: 2,
|
||||
},
|
||||
},
|
||||
|
@ -1407,7 +1407,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
*structInt64OmitEmpty
|
||||
B int64 `json:"b,omitempty"`
|
||||
}{
|
||||
structInt64OmitEmpty: &structInt64OmitEmpty{A: 1},
|
||||
structInt64OmitEmpty: &structInt64OmitEmpty{A: -1},
|
||||
B: 2,
|
||||
},
|
||||
},
|
||||
|
@ -1417,7 +1417,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
*structInt64String
|
||||
B int64 `json:"b,string"`
|
||||
}{
|
||||
structInt64String: &structInt64String{A: 1},
|
||||
structInt64String: &structInt64String{A: -1},
|
||||
B: 2,
|
||||
},
|
||||
},
|
||||
|
@ -1461,7 +1461,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
structInt64Ptr
|
||||
B *int64 `json:"b"`
|
||||
}{
|
||||
structInt64Ptr: structInt64Ptr{A: int64ptr(1)},
|
||||
structInt64Ptr: structInt64Ptr{A: int64ptr(-1)},
|
||||
B: int64ptr(2),
|
||||
},
|
||||
},
|
||||
|
@ -1471,7 +1471,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
structInt64PtrOmitEmpty
|
||||
B *int64 `json:"b,omitempty"`
|
||||
}{
|
||||
structInt64PtrOmitEmpty: structInt64PtrOmitEmpty{A: int64ptr(1)},
|
||||
structInt64PtrOmitEmpty: structInt64PtrOmitEmpty{A: int64ptr(-1)},
|
||||
B: int64ptr(2),
|
||||
},
|
||||
},
|
||||
|
@ -1481,7 +1481,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
structInt64PtrString
|
||||
B *int64 `json:"b,string"`
|
||||
}{
|
||||
structInt64PtrString: structInt64PtrString{A: int64ptr(1)},
|
||||
structInt64PtrString: structInt64PtrString{A: int64ptr(-1)},
|
||||
B: int64ptr(2),
|
||||
},
|
||||
},
|
||||
|
@ -1525,7 +1525,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
*structInt64Ptr
|
||||
B *int64 `json:"b"`
|
||||
}{
|
||||
structInt64Ptr: &structInt64Ptr{A: int64ptr(1)},
|
||||
structInt64Ptr: &structInt64Ptr{A: int64ptr(-1)},
|
||||
B: int64ptr(2),
|
||||
},
|
||||
},
|
||||
|
@ -1535,7 +1535,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
*structInt64PtrOmitEmpty
|
||||
B *int64 `json:"b,omitempty"`
|
||||
}{
|
||||
structInt64PtrOmitEmpty: &structInt64PtrOmitEmpty{A: int64ptr(1)},
|
||||
structInt64PtrOmitEmpty: &structInt64PtrOmitEmpty{A: int64ptr(-1)},
|
||||
B: int64ptr(2),
|
||||
},
|
||||
},
|
||||
|
@ -1545,7 +1545,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
*structInt64PtrString
|
||||
B *int64 `json:"b,string"`
|
||||
}{
|
||||
structInt64PtrString: &structInt64PtrString{A: int64ptr(1)},
|
||||
structInt64PtrString: &structInt64PtrString{A: int64ptr(-1)},
|
||||
B: int64ptr(2),
|
||||
},
|
||||
},
|
||||
|
@ -1588,7 +1588,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
data: struct {
|
||||
structInt64
|
||||
}{
|
||||
structInt64: structInt64{A: 1},
|
||||
structInt64: structInt64{A: -1},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1596,7 +1596,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
data: struct {
|
||||
structInt64OmitEmpty
|
||||
}{
|
||||
structInt64OmitEmpty: structInt64OmitEmpty{A: 1},
|
||||
structInt64OmitEmpty: structInt64OmitEmpty{A: -1},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1604,7 +1604,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
data: struct {
|
||||
structInt64String
|
||||
}{
|
||||
structInt64String: structInt64String{A: 1},
|
||||
structInt64String: structInt64String{A: -1},
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -1614,7 +1614,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
data: struct {
|
||||
*structInt64
|
||||
}{
|
||||
structInt64: &structInt64{A: 1},
|
||||
structInt64: &structInt64{A: -1},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1622,7 +1622,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
data: struct {
|
||||
*structInt64OmitEmpty
|
||||
}{
|
||||
structInt64OmitEmpty: &structInt64OmitEmpty{A: 1},
|
||||
structInt64OmitEmpty: &structInt64OmitEmpty{A: -1},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1630,7 +1630,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
data: struct {
|
||||
*structInt64String
|
||||
}{
|
||||
structInt64String: &structInt64String{A: 1},
|
||||
structInt64String: &structInt64String{A: -1},
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -1666,7 +1666,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
data: struct {
|
||||
structInt64Ptr
|
||||
}{
|
||||
structInt64Ptr: structInt64Ptr{A: int64ptr(1)},
|
||||
structInt64Ptr: structInt64Ptr{A: int64ptr(-1)},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1674,7 +1674,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
data: struct {
|
||||
structInt64PtrOmitEmpty
|
||||
}{
|
||||
structInt64PtrOmitEmpty: structInt64PtrOmitEmpty{A: int64ptr(1)},
|
||||
structInt64PtrOmitEmpty: structInt64PtrOmitEmpty{A: int64ptr(-1)},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1682,7 +1682,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
data: struct {
|
||||
structInt64PtrString
|
||||
}{
|
||||
structInt64PtrString: structInt64PtrString{A: int64ptr(1)},
|
||||
structInt64PtrString: structInt64PtrString{A: int64ptr(-1)},
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -1718,7 +1718,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
data: struct {
|
||||
*structInt64Ptr
|
||||
}{
|
||||
structInt64Ptr: &structInt64Ptr{A: int64ptr(1)},
|
||||
structInt64Ptr: &structInt64Ptr{A: int64ptr(-1)},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1726,7 +1726,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
data: struct {
|
||||
*structInt64PtrOmitEmpty
|
||||
}{
|
||||
structInt64PtrOmitEmpty: &structInt64PtrOmitEmpty{A: int64ptr(1)},
|
||||
structInt64PtrOmitEmpty: &structInt64PtrOmitEmpty{A: int64ptr(-1)},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1734,7 +1734,7 @@ func TestCoverInt64(t *testing.T) {
|
|||
data: struct {
|
||||
*structInt64PtrString
|
||||
}{
|
||||
structInt64PtrString: &structInt64PtrString{A: int64ptr(1)},
|
||||
structInt64PtrString: &structInt64PtrString{A: int64ptr(-1)},
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -57,19 +57,19 @@ func TestCoverInt8(t *testing.T) {
|
|||
name: "HeadInt8",
|
||||
data: struct {
|
||||
A int8 `json:"a"`
|
||||
}{A: 1},
|
||||
}{A: -1},
|
||||
},
|
||||
{
|
||||
name: "HeadInt8OmitEmpty",
|
||||
data: struct {
|
||||
A int8 `json:"a,omitempty"`
|
||||
}{A: 1},
|
||||
}{A: -1},
|
||||
},
|
||||
{
|
||||
name: "HeadInt8String",
|
||||
data: struct {
|
||||
A int8 `json:"a,string"`
|
||||
}{A: 1},
|
||||
}{A: -1},
|
||||
},
|
||||
|
||||
// HeadInt8Ptr
|
||||
|
@ -77,19 +77,19 @@ func TestCoverInt8(t *testing.T) {
|
|||
name: "HeadInt8Ptr",
|
||||
data: struct {
|
||||
A *int8 `json:"a"`
|
||||
}{A: int8ptr(1)},
|
||||
}{A: int8ptr(-1)},
|
||||
},
|
||||
{
|
||||
name: "HeadInt8PtrOmitEmpty",
|
||||
data: struct {
|
||||
A *int8 `json:"a,omitempty"`
|
||||
}{A: int8ptr(1)},
|
||||
}{A: int8ptr(-1)},
|
||||
},
|
||||
{
|
||||
name: "HeadInt8PtrString",
|
||||
data: struct {
|
||||
A *int8 `json:"a,string"`
|
||||
}{A: int8ptr(1)},
|
||||
}{A: int8ptr(-1)},
|
||||
},
|
||||
|
||||
// HeadInt8PtrNil
|
||||
|
@ -137,19 +137,19 @@ func TestCoverInt8(t *testing.T) {
|
|||
name: "PtrHeadInt8",
|
||||
data: &struct {
|
||||
A int8 `json:"a"`
|
||||
}{A: 1},
|
||||
}{A: -1},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt8OmitEmpty",
|
||||
data: &struct {
|
||||
A int8 `json:"a,omitempty"`
|
||||
}{A: 1},
|
||||
}{A: -1},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt8String",
|
||||
data: &struct {
|
||||
A int8 `json:"a,string"`
|
||||
}{A: 1},
|
||||
}{A: -1},
|
||||
},
|
||||
|
||||
// PtrHeadInt8Ptr
|
||||
|
@ -157,19 +157,19 @@ func TestCoverInt8(t *testing.T) {
|
|||
name: "PtrHeadInt8Ptr",
|
||||
data: &struct {
|
||||
A *int8 `json:"a"`
|
||||
}{A: int8ptr(1)},
|
||||
}{A: int8ptr(-1)},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt8PtrOmitEmpty",
|
||||
data: &struct {
|
||||
A *int8 `json:"a,omitempty"`
|
||||
}{A: int8ptr(1)},
|
||||
}{A: int8ptr(-1)},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt8PtrString",
|
||||
data: &struct {
|
||||
A *int8 `json:"a,string"`
|
||||
}{A: int8ptr(1)},
|
||||
}{A: int8ptr(-1)},
|
||||
},
|
||||
|
||||
// PtrHeadInt8PtrNil
|
||||
|
@ -245,7 +245,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
A int8 `json:"a"`
|
||||
B int8 `json:"b"`
|
||||
C int8 `json:"c"`
|
||||
}{A: 1, B: 2, C: 3},
|
||||
}{A: -1, B: 2, C: 3},
|
||||
},
|
||||
{
|
||||
name: "HeadInt8MultiFieldsOmitEmpty",
|
||||
|
@ -253,7 +253,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
A int8 `json:"a,omitempty"`
|
||||
B int8 `json:"b,omitempty"`
|
||||
C int8 `json:"c,omitempty"`
|
||||
}{A: 1, B: 2, C: 3},
|
||||
}{A: -1, B: 2, C: 3},
|
||||
},
|
||||
{
|
||||
name: "HeadInt8MultiFieldsString",
|
||||
|
@ -261,7 +261,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
A int8 `json:"a,string"`
|
||||
B int8 `json:"b,string"`
|
||||
C int8 `json:"c,string"`
|
||||
}{A: 1, B: 2, C: 3},
|
||||
}{A: -1, B: 2, C: 3},
|
||||
},
|
||||
|
||||
// HeadInt8PtrMultiFields
|
||||
|
@ -271,7 +271,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
A *int8 `json:"a"`
|
||||
B *int8 `json:"b"`
|
||||
C *int8 `json:"c"`
|
||||
}{A: int8ptr(1), B: int8ptr(2), C: int8ptr(3)},
|
||||
}{A: int8ptr(-1), B: int8ptr(2), C: int8ptr(3)},
|
||||
},
|
||||
{
|
||||
name: "HeadInt8PtrMultiFieldsOmitEmpty",
|
||||
|
@ -279,7 +279,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
A *int8 `json:"a,omitempty"`
|
||||
B *int8 `json:"b,omitempty"`
|
||||
C *int8 `json:"c,omitempty"`
|
||||
}{A: int8ptr(1), B: int8ptr(2), C: int8ptr(3)},
|
||||
}{A: int8ptr(-1), B: int8ptr(2), C: int8ptr(3)},
|
||||
},
|
||||
{
|
||||
name: "HeadInt8PtrMultiFieldsString",
|
||||
|
@ -287,7 +287,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
A *int8 `json:"a,string"`
|
||||
B *int8 `json:"b,string"`
|
||||
C *int8 `json:"c,string"`
|
||||
}{A: int8ptr(1), B: int8ptr(2), C: int8ptr(3)},
|
||||
}{A: int8ptr(-1), B: int8ptr(2), C: int8ptr(3)},
|
||||
},
|
||||
|
||||
// HeadInt8PtrNilMultiFields
|
||||
|
@ -345,21 +345,21 @@ func TestCoverInt8(t *testing.T) {
|
|||
data: &struct {
|
||||
A int8 `json:"a"`
|
||||
B int8 `json:"b"`
|
||||
}{A: 1, B: 2},
|
||||
}{A: -1, B: 2},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt8MultiFieldsOmitEmpty",
|
||||
data: &struct {
|
||||
A int8 `json:"a,omitempty"`
|
||||
B int8 `json:"b,omitempty"`
|
||||
}{A: 1, B: 2},
|
||||
}{A: -1, B: 2},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt8MultiFieldsString",
|
||||
data: &struct {
|
||||
A int8 `json:"a,string"`
|
||||
B int8 `json:"b,string"`
|
||||
}{A: 1, B: 2},
|
||||
}{A: -1, B: 2},
|
||||
},
|
||||
|
||||
// PtrHeadInt8PtrMultiFields
|
||||
|
@ -368,21 +368,21 @@ func TestCoverInt8(t *testing.T) {
|
|||
data: &struct {
|
||||
A *int8 `json:"a"`
|
||||
B *int8 `json:"b"`
|
||||
}{A: int8ptr(1), B: int8ptr(2)},
|
||||
}{A: int8ptr(-1), B: int8ptr(2)},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt8PtrMultiFieldsOmitEmpty",
|
||||
data: &struct {
|
||||
A *int8 `json:"a,omitempty"`
|
||||
B *int8 `json:"b,omitempty"`
|
||||
}{A: int8ptr(1), B: int8ptr(2)},
|
||||
}{A: int8ptr(-1), B: int8ptr(2)},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt8PtrMultiFieldsString",
|
||||
data: &struct {
|
||||
A *int8 `json:"a,string"`
|
||||
B *int8 `json:"b,string"`
|
||||
}{A: int8ptr(1), B: int8ptr(2)},
|
||||
}{A: int8ptr(-1), B: int8ptr(2)},
|
||||
},
|
||||
|
||||
// PtrHeadInt8PtrNilMultiFields
|
||||
|
@ -466,7 +466,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int8 `json:"a"`
|
||||
}{A: 1}},
|
||||
}{A: -1}},
|
||||
},
|
||||
{
|
||||
name: "HeadInt8NotRootOmitEmpty",
|
||||
|
@ -476,7 +476,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int8 `json:"a,omitempty"`
|
||||
}{A: 1}},
|
||||
}{A: -1}},
|
||||
},
|
||||
{
|
||||
name: "HeadInt8NotRootString",
|
||||
|
@ -486,7 +486,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int8 `json:"a,string"`
|
||||
}{A: 1}},
|
||||
}{A: -1}},
|
||||
},
|
||||
|
||||
// HeadInt8PtrNotRoot
|
||||
|
@ -498,7 +498,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A *int8 `json:"a"`
|
||||
}{int8ptr(1)}},
|
||||
}{int8ptr(-1)}},
|
||||
},
|
||||
{
|
||||
name: "HeadInt8PtrNotRootOmitEmpty",
|
||||
|
@ -508,7 +508,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A *int8 `json:"a,omitempty"`
|
||||
}{int8ptr(1)}},
|
||||
}{int8ptr(-1)}},
|
||||
},
|
||||
{
|
||||
name: "HeadInt8PtrNotRootString",
|
||||
|
@ -518,7 +518,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A *int8 `json:"a,string"`
|
||||
}{int8ptr(1)}},
|
||||
}{int8ptr(-1)}},
|
||||
},
|
||||
|
||||
// HeadInt8PtrNilNotRoot
|
||||
|
@ -588,7 +588,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A int8 `json:"a"`
|
||||
}{A: 1})},
|
||||
}{A: -1})},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt8NotRootOmitEmpty",
|
||||
|
@ -598,7 +598,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A int8 `json:"a,omitempty"`
|
||||
}{A: 1})},
|
||||
}{A: -1})},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt8NotRootString",
|
||||
|
@ -608,7 +608,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A int8 `json:"a,string"`
|
||||
}{A: 1})},
|
||||
}{A: -1})},
|
||||
},
|
||||
|
||||
// PtrHeadInt8PtrNotRoot
|
||||
|
@ -620,7 +620,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A *int8 `json:"a"`
|
||||
}{A: int8ptr(1)})},
|
||||
}{A: int8ptr(-1)})},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt8PtrNotRootOmitEmpty",
|
||||
|
@ -630,7 +630,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A *int8 `json:"a,omitempty"`
|
||||
}{A: int8ptr(1)})},
|
||||
}{A: int8ptr(-1)})},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadInt8PtrNotRootString",
|
||||
|
@ -640,7 +640,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A *int8 `json:"a,string"`
|
||||
}{A: int8ptr(1)})},
|
||||
}{A: int8ptr(-1)})},
|
||||
},
|
||||
|
||||
// PtrHeadInt8PtrNilNotRoot
|
||||
|
@ -748,7 +748,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int8 `json:"a"`
|
||||
}{A: 1}, B: struct {
|
||||
}{A: -1}, B: struct {
|
||||
B int8 `json:"b"`
|
||||
}{B: 2}},
|
||||
},
|
||||
|
@ -763,7 +763,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int8 `json:"a,omitempty"`
|
||||
}{A: 1}, B: struct {
|
||||
}{A: -1}, B: struct {
|
||||
B int8 `json:"b,omitempty"`
|
||||
}{B: 2}},
|
||||
},
|
||||
|
@ -778,7 +778,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int8 `json:"a,string"`
|
||||
}{A: 1}, B: struct {
|
||||
}{A: -1}, B: struct {
|
||||
B int8 `json:"b,string"`
|
||||
}{B: 2}},
|
||||
},
|
||||
|
@ -795,7 +795,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A *int8 `json:"a"`
|
||||
}{A: int8ptr(1)}, B: struct {
|
||||
}{A: int8ptr(-1)}, B: struct {
|
||||
B *int8 `json:"b"`
|
||||
}{B: int8ptr(2)}},
|
||||
},
|
||||
|
@ -810,7 +810,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A *int8 `json:"a,omitempty"`
|
||||
}{A: int8ptr(1)}, B: struct {
|
||||
}{A: int8ptr(-1)}, B: struct {
|
||||
B *int8 `json:"b,omitempty"`
|
||||
}{B: int8ptr(2)}},
|
||||
},
|
||||
|
@ -825,7 +825,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A *int8 `json:"a,string"`
|
||||
}{A: int8ptr(1)}, B: struct {
|
||||
}{A: int8ptr(-1)}, B: struct {
|
||||
B *int8 `json:"b,string"`
|
||||
}{B: int8ptr(2)}},
|
||||
},
|
||||
|
@ -924,7 +924,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int8 `json:"a"`
|
||||
}{A: 1}, B: struct {
|
||||
}{A: -1}, B: struct {
|
||||
B int8 `json:"b"`
|
||||
}{B: 2}},
|
||||
},
|
||||
|
@ -939,7 +939,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int8 `json:"a,omitempty"`
|
||||
}{A: 1}, B: struct {
|
||||
}{A: -1}, B: struct {
|
||||
B int8 `json:"b,omitempty"`
|
||||
}{B: 2}},
|
||||
},
|
||||
|
@ -954,7 +954,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int8 `json:"a,string"`
|
||||
}{A: 1}, B: struct {
|
||||
}{A: -1}, B: struct {
|
||||
B int8 `json:"b,string"`
|
||||
}{B: 2}},
|
||||
},
|
||||
|
@ -971,7 +971,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A *int8 `json:"a"`
|
||||
}{A: int8ptr(1)}), B: &(struct {
|
||||
}{A: int8ptr(-1)}), B: &(struct {
|
||||
B *int8 `json:"b"`
|
||||
}{B: int8ptr(2)})},
|
||||
},
|
||||
|
@ -986,7 +986,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A *int8 `json:"a,omitempty"`
|
||||
}{A: int8ptr(1)}), B: &(struct {
|
||||
}{A: int8ptr(-1)}), B: &(struct {
|
||||
B *int8 `json:"b,omitempty"`
|
||||
}{B: int8ptr(2)})},
|
||||
},
|
||||
|
@ -1001,7 +1001,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A *int8 `json:"a,string"`
|
||||
}{A: int8ptr(1)}), B: &(struct {
|
||||
}{A: int8ptr(-1)}), B: &(struct {
|
||||
B *int8 `json:"b,string"`
|
||||
}{B: int8ptr(2)})},
|
||||
},
|
||||
|
@ -1091,7 +1091,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A int8 `json:"a"`
|
||||
B int8 `json:"b"`
|
||||
}{A: 1, B: 2}), B: &(struct {
|
||||
}{A: -1, B: 2}), B: &(struct {
|
||||
A int8 `json:"a"`
|
||||
B int8 `json:"b"`
|
||||
}{A: 3, B: 4})},
|
||||
|
@ -1110,7 +1110,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A int8 `json:"a,omitempty"`
|
||||
B int8 `json:"b,omitempty"`
|
||||
}{A: 1, B: 2}), B: &(struct {
|
||||
}{A: -1, B: 2}), B: &(struct {
|
||||
A int8 `json:"a,omitempty"`
|
||||
B int8 `json:"b,omitempty"`
|
||||
}{A: 3, B: 4})},
|
||||
|
@ -1129,7 +1129,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A int8 `json:"a,string"`
|
||||
B int8 `json:"b,string"`
|
||||
}{A: 1, B: 2}), B: &(struct {
|
||||
}{A: -1, B: 2}), B: &(struct {
|
||||
A int8 `json:"a,string"`
|
||||
B int8 `json:"b,string"`
|
||||
}{A: 3, B: 4})},
|
||||
|
@ -1232,7 +1232,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A *int8 `json:"a"`
|
||||
B *int8 `json:"b"`
|
||||
}{A: int8ptr(1), B: int8ptr(2)}), B: &(struct {
|
||||
}{A: int8ptr(-1), B: int8ptr(2)}), B: &(struct {
|
||||
A *int8 `json:"a"`
|
||||
B *int8 `json:"b"`
|
||||
}{A: int8ptr(3), B: int8ptr(4)})},
|
||||
|
@ -1251,7 +1251,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A *int8 `json:"a,omitempty"`
|
||||
B *int8 `json:"b,omitempty"`
|
||||
}{A: int8ptr(1), B: int8ptr(2)}), B: &(struct {
|
||||
}{A: int8ptr(-1), B: int8ptr(2)}), B: &(struct {
|
||||
A *int8 `json:"a,omitempty"`
|
||||
B *int8 `json:"b,omitempty"`
|
||||
}{A: int8ptr(3), B: int8ptr(4)})},
|
||||
|
@ -1270,7 +1270,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A *int8 `json:"a,string"`
|
||||
B *int8 `json:"b,string"`
|
||||
}{A: int8ptr(1), B: int8ptr(2)}), B: &(struct {
|
||||
}{A: int8ptr(-1), B: int8ptr(2)}), B: &(struct {
|
||||
A *int8 `json:"a,string"`
|
||||
B *int8 `json:"b,string"`
|
||||
}{A: int8ptr(3), B: int8ptr(4)})},
|
||||
|
@ -1365,7 +1365,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
structInt8
|
||||
B int8 `json:"b"`
|
||||
}{
|
||||
structInt8: structInt8{A: 1},
|
||||
structInt8: structInt8{A: -1},
|
||||
B: 2,
|
||||
},
|
||||
},
|
||||
|
@ -1375,7 +1375,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
structInt8OmitEmpty
|
||||
B int8 `json:"b,omitempty"`
|
||||
}{
|
||||
structInt8OmitEmpty: structInt8OmitEmpty{A: 1},
|
||||
structInt8OmitEmpty: structInt8OmitEmpty{A: -1},
|
||||
B: 2,
|
||||
},
|
||||
},
|
||||
|
@ -1385,7 +1385,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
structInt8String
|
||||
B int8 `json:"b,string"`
|
||||
}{
|
||||
structInt8String: structInt8String{A: 1},
|
||||
structInt8String: structInt8String{A: -1},
|
||||
B: 2,
|
||||
},
|
||||
},
|
||||
|
@ -1397,7 +1397,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
*structInt8
|
||||
B int8 `json:"b"`
|
||||
}{
|
||||
structInt8: &structInt8{A: 1},
|
||||
structInt8: &structInt8{A: -1},
|
||||
B: 2,
|
||||
},
|
||||
},
|
||||
|
@ -1407,7 +1407,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
*structInt8OmitEmpty
|
||||
B int8 `json:"b,omitempty"`
|
||||
}{
|
||||
structInt8OmitEmpty: &structInt8OmitEmpty{A: 1},
|
||||
structInt8OmitEmpty: &structInt8OmitEmpty{A: -1},
|
||||
B: 2,
|
||||
},
|
||||
},
|
||||
|
@ -1417,7 +1417,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
*structInt8String
|
||||
B int8 `json:"b,string"`
|
||||
}{
|
||||
structInt8String: &structInt8String{A: 1},
|
||||
structInt8String: &structInt8String{A: -1},
|
||||
B: 2,
|
||||
},
|
||||
},
|
||||
|
@ -1461,7 +1461,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
structInt8Ptr
|
||||
B *int8 `json:"b"`
|
||||
}{
|
||||
structInt8Ptr: structInt8Ptr{A: int8ptr(1)},
|
||||
structInt8Ptr: structInt8Ptr{A: int8ptr(-1)},
|
||||
B: int8ptr(2),
|
||||
},
|
||||
},
|
||||
|
@ -1471,7 +1471,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
structInt8PtrOmitEmpty
|
||||
B *int8 `json:"b,omitempty"`
|
||||
}{
|
||||
structInt8PtrOmitEmpty: structInt8PtrOmitEmpty{A: int8ptr(1)},
|
||||
structInt8PtrOmitEmpty: structInt8PtrOmitEmpty{A: int8ptr(-1)},
|
||||
B: int8ptr(2),
|
||||
},
|
||||
},
|
||||
|
@ -1481,7 +1481,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
structInt8PtrString
|
||||
B *int8 `json:"b,string"`
|
||||
}{
|
||||
structInt8PtrString: structInt8PtrString{A: int8ptr(1)},
|
||||
structInt8PtrString: structInt8PtrString{A: int8ptr(-1)},
|
||||
B: int8ptr(2),
|
||||
},
|
||||
},
|
||||
|
@ -1525,7 +1525,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
*structInt8Ptr
|
||||
B *int8 `json:"b"`
|
||||
}{
|
||||
structInt8Ptr: &structInt8Ptr{A: int8ptr(1)},
|
||||
structInt8Ptr: &structInt8Ptr{A: int8ptr(-1)},
|
||||
B: int8ptr(2),
|
||||
},
|
||||
},
|
||||
|
@ -1535,7 +1535,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
*structInt8PtrOmitEmpty
|
||||
B *int8 `json:"b,omitempty"`
|
||||
}{
|
||||
structInt8PtrOmitEmpty: &structInt8PtrOmitEmpty{A: int8ptr(1)},
|
||||
structInt8PtrOmitEmpty: &structInt8PtrOmitEmpty{A: int8ptr(-1)},
|
||||
B: int8ptr(2),
|
||||
},
|
||||
},
|
||||
|
@ -1545,7 +1545,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
*structInt8PtrString
|
||||
B *int8 `json:"b,string"`
|
||||
}{
|
||||
structInt8PtrString: &structInt8PtrString{A: int8ptr(1)},
|
||||
structInt8PtrString: &structInt8PtrString{A: int8ptr(-1)},
|
||||
B: int8ptr(2),
|
||||
},
|
||||
},
|
||||
|
@ -1588,7 +1588,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
data: struct {
|
||||
structInt8
|
||||
}{
|
||||
structInt8: structInt8{A: 1},
|
||||
structInt8: structInt8{A: -1},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1596,7 +1596,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
data: struct {
|
||||
structInt8OmitEmpty
|
||||
}{
|
||||
structInt8OmitEmpty: structInt8OmitEmpty{A: 1},
|
||||
structInt8OmitEmpty: structInt8OmitEmpty{A: -1},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1604,7 +1604,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
data: struct {
|
||||
structInt8String
|
||||
}{
|
||||
structInt8String: structInt8String{A: 1},
|
||||
structInt8String: structInt8String{A: -1},
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -1614,7 +1614,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
data: struct {
|
||||
*structInt8
|
||||
}{
|
||||
structInt8: &structInt8{A: 1},
|
||||
structInt8: &structInt8{A: -1},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1622,7 +1622,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
data: struct {
|
||||
*structInt8OmitEmpty
|
||||
}{
|
||||
structInt8OmitEmpty: &structInt8OmitEmpty{A: 1},
|
||||
structInt8OmitEmpty: &structInt8OmitEmpty{A: -1},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1630,7 +1630,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
data: struct {
|
||||
*structInt8String
|
||||
}{
|
||||
structInt8String: &structInt8String{A: 1},
|
||||
structInt8String: &structInt8String{A: -1},
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -1666,7 +1666,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
data: struct {
|
||||
structInt8Ptr
|
||||
}{
|
||||
structInt8Ptr: structInt8Ptr{A: int8ptr(1)},
|
||||
structInt8Ptr: structInt8Ptr{A: int8ptr(-1)},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1674,7 +1674,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
data: struct {
|
||||
structInt8PtrOmitEmpty
|
||||
}{
|
||||
structInt8PtrOmitEmpty: structInt8PtrOmitEmpty{A: int8ptr(1)},
|
||||
structInt8PtrOmitEmpty: structInt8PtrOmitEmpty{A: int8ptr(-1)},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1682,7 +1682,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
data: struct {
|
||||
structInt8PtrString
|
||||
}{
|
||||
structInt8PtrString: structInt8PtrString{A: int8ptr(1)},
|
||||
structInt8PtrString: structInt8PtrString{A: int8ptr(-1)},
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -1718,7 +1718,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
data: struct {
|
||||
*structInt8Ptr
|
||||
}{
|
||||
structInt8Ptr: &structInt8Ptr{A: int8ptr(1)},
|
||||
structInt8Ptr: &structInt8Ptr{A: int8ptr(-1)},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1726,7 +1726,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
data: struct {
|
||||
*structInt8PtrOmitEmpty
|
||||
}{
|
||||
structInt8PtrOmitEmpty: &structInt8PtrOmitEmpty{A: int8ptr(1)},
|
||||
structInt8PtrOmitEmpty: &structInt8PtrOmitEmpty{A: int8ptr(-1)},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1734,7 +1734,7 @@ func TestCoverInt8(t *testing.T) {
|
|||
data: struct {
|
||||
*structInt8PtrString
|
||||
}{
|
||||
structInt8PtrString: &structInt8PtrString{A: int8ptr(1)},
|
||||
structInt8PtrString: &structInt8PtrString{A: int8ptr(-1)},
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -57,19 +57,19 @@ func TestCoverInt(t *testing.T) {
|
|||
name: "HeadInt",
|
||||
data: struct {
|
||||
A int `json:"a"`
|
||||
}{A: 1},
|
||||
}{A: -1},
|
||||
},
|
||||
{
|
||||
name: "HeadIntOmitEmpty",
|
||||
data: struct {
|
||||
A int `json:"a,omitempty"`
|
||||
}{A: 1},
|
||||
}{A: -1},
|
||||
},
|
||||
{
|
||||
name: "HeadIntString",
|
||||
data: struct {
|
||||
A int `json:"a,string"`
|
||||
}{A: 1},
|
||||
}{A: -1},
|
||||
},
|
||||
|
||||
// HeadIntPtr
|
||||
|
@ -77,19 +77,19 @@ func TestCoverInt(t *testing.T) {
|
|||
name: "HeadIntPtr",
|
||||
data: struct {
|
||||
A *int `json:"a"`
|
||||
}{A: intptr(1)},
|
||||
}{A: intptr(-1)},
|
||||
},
|
||||
{
|
||||
name: "HeadIntPtrOmitEmpty",
|
||||
data: struct {
|
||||
A *int `json:"a,omitempty"`
|
||||
}{A: intptr(1)},
|
||||
}{A: intptr(-1)},
|
||||
},
|
||||
{
|
||||
name: "HeadIntPtrString",
|
||||
data: struct {
|
||||
A *int `json:"a,string"`
|
||||
}{A: intptr(1)},
|
||||
}{A: intptr(-1)},
|
||||
},
|
||||
|
||||
// HeadIntPtrNil
|
||||
|
@ -137,19 +137,19 @@ func TestCoverInt(t *testing.T) {
|
|||
name: "PtrHeadInt",
|
||||
data: &struct {
|
||||
A int `json:"a"`
|
||||
}{A: 1},
|
||||
}{A: -1},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadIntOmitEmpty",
|
||||
data: &struct {
|
||||
A int `json:"a,omitempty"`
|
||||
}{A: 1},
|
||||
}{A: -1},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadIntString",
|
||||
data: &struct {
|
||||
A int `json:"a,string"`
|
||||
}{A: 1},
|
||||
}{A: -1},
|
||||
},
|
||||
|
||||
// PtrHeadIntPtr
|
||||
|
@ -157,19 +157,19 @@ func TestCoverInt(t *testing.T) {
|
|||
name: "PtrHeadIntPtr",
|
||||
data: &struct {
|
||||
A *int `json:"a"`
|
||||
}{A: intptr(1)},
|
||||
}{A: intptr(-1)},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadIntPtrOmitEmpty",
|
||||
data: &struct {
|
||||
A *int `json:"a,omitempty"`
|
||||
}{A: intptr(1)},
|
||||
}{A: intptr(-1)},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadIntPtrString",
|
||||
data: &struct {
|
||||
A *int `json:"a,string"`
|
||||
}{A: intptr(1)},
|
||||
}{A: intptr(-1)},
|
||||
},
|
||||
|
||||
// PtrHeadIntPtrNil
|
||||
|
@ -245,7 +245,7 @@ func TestCoverInt(t *testing.T) {
|
|||
A int `json:"a"`
|
||||
B int `json:"b"`
|
||||
C int `json:"c"`
|
||||
}{A: 1, B: 2, C: 3},
|
||||
}{A: -1, B: 2, C: 3},
|
||||
},
|
||||
{
|
||||
name: "HeadIntMultiFieldsOmitEmpty",
|
||||
|
@ -253,7 +253,7 @@ func TestCoverInt(t *testing.T) {
|
|||
A int `json:"a,omitempty"`
|
||||
B int `json:"b,omitempty"`
|
||||
C int `json:"c,omitempty"`
|
||||
}{A: 1, B: 2, C: 3},
|
||||
}{A: -1, B: 2, C: 3},
|
||||
},
|
||||
{
|
||||
name: "HeadIntMultiFieldsString",
|
||||
|
@ -261,7 +261,7 @@ func TestCoverInt(t *testing.T) {
|
|||
A int `json:"a,string"`
|
||||
B int `json:"b,string"`
|
||||
C int `json:"c,string"`
|
||||
}{A: 1, B: 2, C: 3},
|
||||
}{A: -1, B: 2, C: 3},
|
||||
},
|
||||
|
||||
// HeadIntPtrMultiFields
|
||||
|
@ -271,7 +271,7 @@ func TestCoverInt(t *testing.T) {
|
|||
A *int `json:"a"`
|
||||
B *int `json:"b"`
|
||||
C *int `json:"c"`
|
||||
}{A: intptr(1), B: intptr(2), C: intptr(3)},
|
||||
}{A: intptr(-1), B: intptr(2), C: intptr(3)},
|
||||
},
|
||||
{
|
||||
name: "HeadIntPtrMultiFieldsOmitEmpty",
|
||||
|
@ -279,7 +279,7 @@ func TestCoverInt(t *testing.T) {
|
|||
A *int `json:"a,omitempty"`
|
||||
B *int `json:"b,omitempty"`
|
||||
C *int `json:"c,omitempty"`
|
||||
}{A: intptr(1), B: intptr(2), C: intptr(3)},
|
||||
}{A: intptr(-1), B: intptr(2), C: intptr(3)},
|
||||
},
|
||||
{
|
||||
name: "HeadIntPtrMultiFieldsString",
|
||||
|
@ -287,7 +287,7 @@ func TestCoverInt(t *testing.T) {
|
|||
A *int `json:"a,string"`
|
||||
B *int `json:"b,string"`
|
||||
C *int `json:"c,string"`
|
||||
}{A: intptr(1), B: intptr(2), C: intptr(3)},
|
||||
}{A: intptr(-1), B: intptr(2), C: intptr(3)},
|
||||
},
|
||||
|
||||
// HeadIntPtrNilMultiFields
|
||||
|
@ -345,21 +345,21 @@ func TestCoverInt(t *testing.T) {
|
|||
data: &struct {
|
||||
A int `json:"a"`
|
||||
B int `json:"b"`
|
||||
}{A: 1, B: 2},
|
||||
}{A: -1, B: 2},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadIntMultiFieldsOmitEmpty",
|
||||
data: &struct {
|
||||
A int `json:"a,omitempty"`
|
||||
B int `json:"b,omitempty"`
|
||||
}{A: 1, B: 2},
|
||||
}{A: -1, B: 2},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadIntMultiFieldsString",
|
||||
data: &struct {
|
||||
A int `json:"a,string"`
|
||||
B int `json:"b,string"`
|
||||
}{A: 1, B: 2},
|
||||
}{A: -1, B: 2},
|
||||
},
|
||||
|
||||
// PtrHeadIntPtrMultiFields
|
||||
|
@ -368,21 +368,21 @@ func TestCoverInt(t *testing.T) {
|
|||
data: &struct {
|
||||
A *int `json:"a"`
|
||||
B *int `json:"b"`
|
||||
}{A: intptr(1), B: intptr(2)},
|
||||
}{A: intptr(-1), B: intptr(2)},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadIntPtrMultiFieldsOmitEmpty",
|
||||
data: &struct {
|
||||
A *int `json:"a,omitempty"`
|
||||
B *int `json:"b,omitempty"`
|
||||
}{A: intptr(1), B: intptr(2)},
|
||||
}{A: intptr(-1), B: intptr(2)},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadIntPtrMultiFieldsString",
|
||||
data: &struct {
|
||||
A *int `json:"a,string"`
|
||||
B *int `json:"b,string"`
|
||||
}{A: intptr(1), B: intptr(2)},
|
||||
}{A: intptr(-1), B: intptr(2)},
|
||||
},
|
||||
|
||||
// PtrHeadIntPtrNilMultiFields
|
||||
|
@ -466,7 +466,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int `json:"a"`
|
||||
}{A: 1}},
|
||||
}{A: -1}},
|
||||
},
|
||||
{
|
||||
name: "HeadIntNotRootOmitEmpty",
|
||||
|
@ -476,7 +476,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int `json:"a,omitempty"`
|
||||
}{A: 1}},
|
||||
}{A: -1}},
|
||||
},
|
||||
{
|
||||
name: "HeadIntNotRootString",
|
||||
|
@ -486,7 +486,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int `json:"a,string"`
|
||||
}{A: 1}},
|
||||
}{A: -1}},
|
||||
},
|
||||
|
||||
// HeadIntPtrNotRoot
|
||||
|
@ -498,7 +498,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A *int `json:"a"`
|
||||
}{intptr(1)}},
|
||||
}{intptr(-1)}},
|
||||
},
|
||||
{
|
||||
name: "HeadIntPtrNotRootOmitEmpty",
|
||||
|
@ -508,7 +508,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A *int `json:"a,omitempty"`
|
||||
}{intptr(1)}},
|
||||
}{intptr(-1)}},
|
||||
},
|
||||
{
|
||||
name: "HeadIntPtrNotRootString",
|
||||
|
@ -518,7 +518,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A *int `json:"a,string"`
|
||||
}{intptr(1)}},
|
||||
}{intptr(-1)}},
|
||||
},
|
||||
|
||||
// HeadIntPtrNilNotRoot
|
||||
|
@ -588,7 +588,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A int `json:"a"`
|
||||
}{A: 1})},
|
||||
}{A: -1})},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadIntNotRootOmitEmpty",
|
||||
|
@ -598,7 +598,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A int `json:"a,omitempty"`
|
||||
}{A: 1})},
|
||||
}{A: -1})},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadIntNotRootString",
|
||||
|
@ -608,7 +608,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A int `json:"a,string"`
|
||||
}{A: 1})},
|
||||
}{A: -1})},
|
||||
},
|
||||
|
||||
// PtrHeadIntPtrNotRoot
|
||||
|
@ -620,7 +620,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A *int `json:"a"`
|
||||
}{A: intptr(1)})},
|
||||
}{A: intptr(-1)})},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadIntPtrNotRootOmitEmpty",
|
||||
|
@ -630,7 +630,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A *int `json:"a,omitempty"`
|
||||
}{A: intptr(1)})},
|
||||
}{A: intptr(-1)})},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadIntPtrNotRootString",
|
||||
|
@ -640,7 +640,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A *int `json:"a,string"`
|
||||
}{A: intptr(1)})},
|
||||
}{A: intptr(-1)})},
|
||||
},
|
||||
|
||||
// PtrHeadIntPtrNilNotRoot
|
||||
|
@ -748,7 +748,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int `json:"a"`
|
||||
}{A: 1}, B: struct {
|
||||
}{A: -1}, B: struct {
|
||||
B int `json:"b"`
|
||||
}{B: 2}},
|
||||
},
|
||||
|
@ -763,7 +763,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int `json:"a,omitempty"`
|
||||
}{A: 1}, B: struct {
|
||||
}{A: -1}, B: struct {
|
||||
B int `json:"b,omitempty"`
|
||||
}{B: 2}},
|
||||
},
|
||||
|
@ -778,7 +778,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int `json:"a,string"`
|
||||
}{A: 1}, B: struct {
|
||||
}{A: -1}, B: struct {
|
||||
B int `json:"b,string"`
|
||||
}{B: 2}},
|
||||
},
|
||||
|
@ -795,7 +795,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A *int `json:"a"`
|
||||
}{A: intptr(1)}, B: struct {
|
||||
}{A: intptr(-1)}, B: struct {
|
||||
B *int `json:"b"`
|
||||
}{B: intptr(2)}},
|
||||
},
|
||||
|
@ -810,7 +810,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A *int `json:"a,omitempty"`
|
||||
}{A: intptr(1)}, B: struct {
|
||||
}{A: intptr(-1)}, B: struct {
|
||||
B *int `json:"b,omitempty"`
|
||||
}{B: intptr(2)}},
|
||||
},
|
||||
|
@ -825,7 +825,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A *int `json:"a,string"`
|
||||
}{A: intptr(1)}, B: struct {
|
||||
}{A: intptr(-1)}, B: struct {
|
||||
B *int `json:"b,string"`
|
||||
}{B: intptr(2)}},
|
||||
},
|
||||
|
@ -924,7 +924,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int `json:"a"`
|
||||
}{A: 1}, B: struct {
|
||||
}{A: -1}, B: struct {
|
||||
B int `json:"b"`
|
||||
}{B: 2}},
|
||||
},
|
||||
|
@ -939,7 +939,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int `json:"a,omitempty"`
|
||||
}{A: 1}, B: struct {
|
||||
}{A: -1}, B: struct {
|
||||
B int `json:"b,omitempty"`
|
||||
}{B: 2}},
|
||||
},
|
||||
|
@ -954,7 +954,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}
|
||||
}{A: struct {
|
||||
A int `json:"a,string"`
|
||||
}{A: 1}, B: struct {
|
||||
}{A: -1}, B: struct {
|
||||
B int `json:"b,string"`
|
||||
}{B: 2}},
|
||||
},
|
||||
|
@ -971,7 +971,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A *int `json:"a"`
|
||||
}{A: intptr(1)}), B: &(struct {
|
||||
}{A: intptr(-1)}), B: &(struct {
|
||||
B *int `json:"b"`
|
||||
}{B: intptr(2)})},
|
||||
},
|
||||
|
@ -986,7 +986,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A *int `json:"a,omitempty"`
|
||||
}{A: intptr(1)}), B: &(struct {
|
||||
}{A: intptr(-1)}), B: &(struct {
|
||||
B *int `json:"b,omitempty"`
|
||||
}{B: intptr(2)})},
|
||||
},
|
||||
|
@ -1001,7 +1001,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}
|
||||
}{A: &(struct {
|
||||
A *int `json:"a,string"`
|
||||
}{A: intptr(1)}), B: &(struct {
|
||||
}{A: intptr(-1)}), B: &(struct {
|
||||
B *int `json:"b,string"`
|
||||
}{B: intptr(2)})},
|
||||
},
|
||||
|
@ -1091,7 +1091,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A int `json:"a"`
|
||||
B int `json:"b"`
|
||||
}{A: 1, B: 2}), B: &(struct {
|
||||
}{A: -1, B: 2}), B: &(struct {
|
||||
A int `json:"a"`
|
||||
B int `json:"b"`
|
||||
}{A: 3, B: 4})},
|
||||
|
@ -1110,7 +1110,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A int `json:"a,omitempty"`
|
||||
B int `json:"b,omitempty"`
|
||||
}{A: 1, B: 2}), B: &(struct {
|
||||
}{A: -1, B: 2}), B: &(struct {
|
||||
A int `json:"a,omitempty"`
|
||||
B int `json:"b,omitempty"`
|
||||
}{A: 3, B: 4})},
|
||||
|
@ -1129,7 +1129,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A int `json:"a,string"`
|
||||
B int `json:"b,string"`
|
||||
}{A: 1, B: 2}), B: &(struct {
|
||||
}{A: -1, B: 2}), B: &(struct {
|
||||
A int `json:"a,string"`
|
||||
B int `json:"b,string"`
|
||||
}{A: 3, B: 4})},
|
||||
|
@ -1232,7 +1232,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A *int `json:"a"`
|
||||
B *int `json:"b"`
|
||||
}{A: intptr(1), B: intptr(2)}), B: &(struct {
|
||||
}{A: intptr(-1), B: intptr(2)}), B: &(struct {
|
||||
A *int `json:"a"`
|
||||
B *int `json:"b"`
|
||||
}{A: intptr(3), B: intptr(4)})},
|
||||
|
@ -1251,7 +1251,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A *int `json:"a,omitempty"`
|
||||
B *int `json:"b,omitempty"`
|
||||
}{A: intptr(1), B: intptr(2)}), B: &(struct {
|
||||
}{A: intptr(-1), B: intptr(2)}), B: &(struct {
|
||||
A *int `json:"a,omitempty"`
|
||||
B *int `json:"b,omitempty"`
|
||||
}{A: intptr(3), B: intptr(4)})},
|
||||
|
@ -1270,7 +1270,7 @@ func TestCoverInt(t *testing.T) {
|
|||
}{A: &(struct {
|
||||
A *int `json:"a,string"`
|
||||
B *int `json:"b,string"`
|
||||
}{A: intptr(1), B: intptr(2)}), B: &(struct {
|
||||
}{A: intptr(-1), B: intptr(2)}), B: &(struct {
|
||||
A *int `json:"a,string"`
|
||||
B *int `json:"b,string"`
|
||||
}{A: intptr(3), B: intptr(4)})},
|
||||
|
@ -1365,7 +1365,7 @@ func TestCoverInt(t *testing.T) {
|
|||
structInt
|
||||
B int `json:"b"`
|
||||
}{
|
||||
structInt: structInt{A: 1},
|
||||
structInt: structInt{A: -1},
|
||||
B: 2,
|
||||
},
|
||||
},
|
||||
|
@ -1375,7 +1375,7 @@ func TestCoverInt(t *testing.T) {
|
|||
structIntOmitEmpty
|
||||
B int `json:"b,omitempty"`
|
||||
}{
|
||||
structIntOmitEmpty: structIntOmitEmpty{A: 1},
|
||||
structIntOmitEmpty: structIntOmitEmpty{A: -1},
|
||||
B: 2,
|
||||
},
|
||||
},
|
||||
|
@ -1385,7 +1385,7 @@ func TestCoverInt(t *testing.T) {
|
|||
structIntString
|
||||
B int `json:"b,string"`
|
||||
}{
|
||||
structIntString: structIntString{A: 1},
|
||||
structIntString: structIntString{A: -1},
|
||||
B: 2,
|
||||
},
|
||||
},
|
||||
|
@ -1397,7 +1397,7 @@ func TestCoverInt(t *testing.T) {
|
|||
*structInt
|
||||
B int `json:"b"`
|
||||
}{
|
||||
structInt: &structInt{A: 1},
|
||||
structInt: &structInt{A: -1},
|
||||
B: 2,
|
||||
},
|
||||
},
|
||||
|
@ -1407,7 +1407,7 @@ func TestCoverInt(t *testing.T) {
|
|||
*structIntOmitEmpty
|
||||
B int `json:"b,omitempty"`
|
||||
}{
|
||||
structIntOmitEmpty: &structIntOmitEmpty{A: 1},
|
||||
structIntOmitEmpty: &structIntOmitEmpty{A: -1},
|
||||
B: 2,
|
||||
},
|
||||
},
|
||||
|
@ -1417,7 +1417,7 @@ func TestCoverInt(t *testing.T) {
|
|||
*structIntString
|
||||
B int `json:"b,string"`
|
||||
}{
|
||||
structIntString: &structIntString{A: 1},
|
||||
structIntString: &structIntString{A: -1},
|
||||
B: 2,
|
||||
},
|
||||
},
|
||||
|
@ -1461,7 +1461,7 @@ func TestCoverInt(t *testing.T) {
|
|||
structIntPtr
|
||||
B *int `json:"b"`
|
||||
}{
|
||||
structIntPtr: structIntPtr{A: intptr(1)},
|
||||
structIntPtr: structIntPtr{A: intptr(-1)},
|
||||
B: intptr(2),
|
||||
},
|
||||
},
|
||||
|
@ -1471,7 +1471,7 @@ func TestCoverInt(t *testing.T) {
|
|||
structIntPtrOmitEmpty
|
||||
B *int `json:"b,omitempty"`
|
||||
}{
|
||||
structIntPtrOmitEmpty: structIntPtrOmitEmpty{A: intptr(1)},
|
||||
structIntPtrOmitEmpty: structIntPtrOmitEmpty{A: intptr(-1)},
|
||||
B: intptr(2),
|
||||
},
|
||||
},
|
||||
|
@ -1481,7 +1481,7 @@ func TestCoverInt(t *testing.T) {
|
|||
structIntPtrString
|
||||
B *int `json:"b,string"`
|
||||
}{
|
||||
structIntPtrString: structIntPtrString{A: intptr(1)},
|
||||
structIntPtrString: structIntPtrString{A: intptr(-1)},
|
||||
B: intptr(2),
|
||||
},
|
||||
},
|
||||
|
@ -1525,7 +1525,7 @@ func TestCoverInt(t *testing.T) {
|
|||
*structIntPtr
|
||||
B *int `json:"b"`
|
||||
}{
|
||||
structIntPtr: &structIntPtr{A: intptr(1)},
|
||||
structIntPtr: &structIntPtr{A: intptr(-1)},
|
||||
B: intptr(2),
|
||||
},
|
||||
},
|
||||
|
@ -1535,7 +1535,7 @@ func TestCoverInt(t *testing.T) {
|
|||
*structIntPtrOmitEmpty
|
||||
B *int `json:"b,omitempty"`
|
||||
}{
|
||||
structIntPtrOmitEmpty: &structIntPtrOmitEmpty{A: intptr(1)},
|
||||
structIntPtrOmitEmpty: &structIntPtrOmitEmpty{A: intptr(-1)},
|
||||
B: intptr(2),
|
||||
},
|
||||
},
|
||||
|
@ -1545,7 +1545,7 @@ func TestCoverInt(t *testing.T) {
|
|||
*structIntPtrString
|
||||
B *int `json:"b,string"`
|
||||
}{
|
||||
structIntPtrString: &structIntPtrString{A: intptr(1)},
|
||||
structIntPtrString: &structIntPtrString{A: intptr(-1)},
|
||||
B: intptr(2),
|
||||
},
|
||||
},
|
||||
|
@ -1588,7 +1588,7 @@ func TestCoverInt(t *testing.T) {
|
|||
data: struct {
|
||||
structInt
|
||||
}{
|
||||
structInt: structInt{A: 1},
|
||||
structInt: structInt{A: -1},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1596,7 +1596,7 @@ func TestCoverInt(t *testing.T) {
|
|||
data: struct {
|
||||
structIntOmitEmpty
|
||||
}{
|
||||
structIntOmitEmpty: structIntOmitEmpty{A: 1},
|
||||
structIntOmitEmpty: structIntOmitEmpty{A: -1},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1604,7 +1604,7 @@ func TestCoverInt(t *testing.T) {
|
|||
data: struct {
|
||||
structIntString
|
||||
}{
|
||||
structIntString: structIntString{A: 1},
|
||||
structIntString: structIntString{A: -1},
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -1614,7 +1614,7 @@ func TestCoverInt(t *testing.T) {
|
|||
data: struct {
|
||||
*structInt
|
||||
}{
|
||||
structInt: &structInt{A: 1},
|
||||
structInt: &structInt{A: -1},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1622,7 +1622,7 @@ func TestCoverInt(t *testing.T) {
|
|||
data: struct {
|
||||
*structIntOmitEmpty
|
||||
}{
|
||||
structIntOmitEmpty: &structIntOmitEmpty{A: 1},
|
||||
structIntOmitEmpty: &structIntOmitEmpty{A: -1},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1630,7 +1630,7 @@ func TestCoverInt(t *testing.T) {
|
|||
data: struct {
|
||||
*structIntString
|
||||
}{
|
||||
structIntString: &structIntString{A: 1},
|
||||
structIntString: &structIntString{A: -1},
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -1666,7 +1666,7 @@ func TestCoverInt(t *testing.T) {
|
|||
data: struct {
|
||||
structIntPtr
|
||||
}{
|
||||
structIntPtr: structIntPtr{A: intptr(1)},
|
||||
structIntPtr: structIntPtr{A: intptr(-1)},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1674,7 +1674,7 @@ func TestCoverInt(t *testing.T) {
|
|||
data: struct {
|
||||
structIntPtrOmitEmpty
|
||||
}{
|
||||
structIntPtrOmitEmpty: structIntPtrOmitEmpty{A: intptr(1)},
|
||||
structIntPtrOmitEmpty: structIntPtrOmitEmpty{A: intptr(-1)},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1682,7 +1682,7 @@ func TestCoverInt(t *testing.T) {
|
|||
data: struct {
|
||||
structIntPtrString
|
||||
}{
|
||||
structIntPtrString: structIntPtrString{A: intptr(1)},
|
||||
structIntPtrString: structIntPtrString{A: intptr(-1)},
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -1718,7 +1718,7 @@ func TestCoverInt(t *testing.T) {
|
|||
data: struct {
|
||||
*structIntPtr
|
||||
}{
|
||||
structIntPtr: &structIntPtr{A: intptr(1)},
|
||||
structIntPtr: &structIntPtr{A: intptr(-1)},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1726,7 +1726,7 @@ func TestCoverInt(t *testing.T) {
|
|||
data: struct {
|
||||
*structIntPtrOmitEmpty
|
||||
}{
|
||||
structIntPtrOmitEmpty: &structIntPtrOmitEmpty{A: intptr(1)},
|
||||
structIntPtrOmitEmpty: &structIntPtrOmitEmpty{A: intptr(-1)},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1734,7 +1734,7 @@ func TestCoverInt(t *testing.T) {
|
|||
data: struct {
|
||||
*structIntPtrString
|
||||
}{
|
||||
structIntPtrString: &structIntPtrString{A: intptr(1)},
|
||||
structIntPtrString: &structIntPtrString{A: intptr(-1)},
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package json
|
|||
import (
|
||||
"encoding"
|
||||
"fmt"
|
||||
"math"
|
||||
"reflect"
|
||||
"strings"
|
||||
"unsafe"
|
||||
|
@ -393,122 +394,188 @@ func encodeCompileMarshalTextPtr(ctx *encodeCompileContext) (*opcode, error) {
|
|||
return code, nil
|
||||
}
|
||||
|
||||
const intSize = 32 << (^uint(0) >> 63)
|
||||
|
||||
func encodeCompileInt(ctx *encodeCompileContext) (*opcode, error) {
|
||||
code := newOpCode(ctx, opInt)
|
||||
switch intSize {
|
||||
case 32:
|
||||
code.mask = math.MaxUint32
|
||||
code.rshiftNum = 31
|
||||
default:
|
||||
code.mask = math.MaxUint64
|
||||
code.rshiftNum = 63
|
||||
}
|
||||
ctx.incIndex()
|
||||
return code, nil
|
||||
}
|
||||
|
||||
func encodeCompileInt8(ctx *encodeCompileContext) (*opcode, error) {
|
||||
code := newOpCode(ctx, opInt8)
|
||||
code := newOpCode(ctx, opInt)
|
||||
code.mask = math.MaxUint8
|
||||
code.rshiftNum = 7
|
||||
ctx.incIndex()
|
||||
return code, nil
|
||||
}
|
||||
|
||||
func encodeCompileInt16(ctx *encodeCompileContext) (*opcode, error) {
|
||||
code := newOpCode(ctx, opInt16)
|
||||
code := newOpCode(ctx, opInt)
|
||||
code.mask = math.MaxUint16
|
||||
code.rshiftNum = 15
|
||||
ctx.incIndex()
|
||||
return code, nil
|
||||
}
|
||||
|
||||
func encodeCompileInt32(ctx *encodeCompileContext) (*opcode, error) {
|
||||
code := newOpCode(ctx, opInt32)
|
||||
code := newOpCode(ctx, opInt)
|
||||
code.mask = math.MaxUint32
|
||||
code.rshiftNum = 31
|
||||
ctx.incIndex()
|
||||
return code, nil
|
||||
}
|
||||
|
||||
func encodeCompileInt64(ctx *encodeCompileContext) (*opcode, error) {
|
||||
code := newOpCode(ctx, opInt64)
|
||||
code := newOpCode(ctx, opInt)
|
||||
code.mask = math.MaxUint64
|
||||
code.rshiftNum = 63
|
||||
ctx.incIndex()
|
||||
return code, nil
|
||||
}
|
||||
|
||||
func encodeCompileUint(ctx *encodeCompileContext) (*opcode, error) {
|
||||
code := newOpCode(ctx, opUint)
|
||||
switch intSize {
|
||||
case 32:
|
||||
code.mask = math.MaxUint32
|
||||
code.rshiftNum = 31
|
||||
default:
|
||||
code.mask = math.MaxUint64
|
||||
code.rshiftNum = 63
|
||||
}
|
||||
ctx.incIndex()
|
||||
return code, nil
|
||||
}
|
||||
|
||||
func encodeCompileUint8(ctx *encodeCompileContext) (*opcode, error) {
|
||||
code := newOpCode(ctx, opUint8)
|
||||
code := newOpCode(ctx, opUint)
|
||||
code.mask = math.MaxUint8
|
||||
code.rshiftNum = 7
|
||||
ctx.incIndex()
|
||||
return code, nil
|
||||
}
|
||||
|
||||
func encodeCompileUint16(ctx *encodeCompileContext) (*opcode, error) {
|
||||
code := newOpCode(ctx, opUint16)
|
||||
code := newOpCode(ctx, opUint)
|
||||
code.mask = math.MaxUint16
|
||||
code.rshiftNum = 15
|
||||
ctx.incIndex()
|
||||
return code, nil
|
||||
}
|
||||
|
||||
func encodeCompileUint32(ctx *encodeCompileContext) (*opcode, error) {
|
||||
code := newOpCode(ctx, opUint32)
|
||||
code := newOpCode(ctx, opUint)
|
||||
code.mask = math.MaxUint32
|
||||
code.rshiftNum = 31
|
||||
ctx.incIndex()
|
||||
return code, nil
|
||||
}
|
||||
|
||||
func encodeCompileUint64(ctx *encodeCompileContext) (*opcode, error) {
|
||||
code := newOpCode(ctx, opUint64)
|
||||
code := newOpCode(ctx, opUint)
|
||||
code.mask = math.MaxUint64
|
||||
code.rshiftNum = 63
|
||||
ctx.incIndex()
|
||||
return code, nil
|
||||
}
|
||||
|
||||
func encodeCompileIntString(ctx *encodeCompileContext) (*opcode, error) {
|
||||
code := newOpCode(ctx, opIntString)
|
||||
switch intSize {
|
||||
case 32:
|
||||
code.mask = math.MaxUint32
|
||||
code.rshiftNum = 31
|
||||
default:
|
||||
code.mask = math.MaxUint64
|
||||
code.rshiftNum = 63
|
||||
}
|
||||
ctx.incIndex()
|
||||
return code, nil
|
||||
}
|
||||
|
||||
func encodeCompileInt8String(ctx *encodeCompileContext) (*opcode, error) {
|
||||
code := newOpCode(ctx, opInt8String)
|
||||
code := newOpCode(ctx, opIntString)
|
||||
code.mask = math.MaxUint8
|
||||
code.rshiftNum = 7
|
||||
ctx.incIndex()
|
||||
return code, nil
|
||||
}
|
||||
|
||||
func encodeCompileInt16String(ctx *encodeCompileContext) (*opcode, error) {
|
||||
code := newOpCode(ctx, opInt16String)
|
||||
code := newOpCode(ctx, opIntString)
|
||||
code.mask = math.MaxUint16
|
||||
code.rshiftNum = 15
|
||||
ctx.incIndex()
|
||||
return code, nil
|
||||
}
|
||||
|
||||
func encodeCompileInt32String(ctx *encodeCompileContext) (*opcode, error) {
|
||||
code := newOpCode(ctx, opInt32String)
|
||||
code := newOpCode(ctx, opIntString)
|
||||
code.mask = math.MaxUint32
|
||||
code.rshiftNum = 31
|
||||
ctx.incIndex()
|
||||
return code, nil
|
||||
}
|
||||
|
||||
func encodeCompileInt64String(ctx *encodeCompileContext) (*opcode, error) {
|
||||
code := newOpCode(ctx, opInt64String)
|
||||
code := newOpCode(ctx, opIntString)
|
||||
code.mask = math.MaxUint64
|
||||
code.rshiftNum = 63
|
||||
ctx.incIndex()
|
||||
return code, nil
|
||||
}
|
||||
|
||||
func encodeCompileUintString(ctx *encodeCompileContext) (*opcode, error) {
|
||||
code := newOpCode(ctx, opUintString)
|
||||
switch intSize {
|
||||
case 32:
|
||||
code.mask = math.MaxUint32
|
||||
code.rshiftNum = 31
|
||||
default:
|
||||
code.mask = math.MaxUint64
|
||||
code.rshiftNum = 63
|
||||
}
|
||||
ctx.incIndex()
|
||||
return code, nil
|
||||
}
|
||||
|
||||
func encodeCompileUint8String(ctx *encodeCompileContext) (*opcode, error) {
|
||||
code := newOpCode(ctx, opUint8String)
|
||||
code := newOpCode(ctx, opUintString)
|
||||
code.mask = math.MaxUint8
|
||||
code.rshiftNum = 7
|
||||
ctx.incIndex()
|
||||
return code, nil
|
||||
}
|
||||
|
||||
func encodeCompileUint16String(ctx *encodeCompileContext) (*opcode, error) {
|
||||
code := newOpCode(ctx, opUint16String)
|
||||
code := newOpCode(ctx, opUintString)
|
||||
code.mask = math.MaxUint16
|
||||
code.rshiftNum = 15
|
||||
ctx.incIndex()
|
||||
return code, nil
|
||||
}
|
||||
|
||||
func encodeCompileUint32String(ctx *encodeCompileContext) (*opcode, error) {
|
||||
code := newOpCode(ctx, opUint32String)
|
||||
code := newOpCode(ctx, opUintString)
|
||||
code.mask = math.MaxUint32
|
||||
code.rshiftNum = 31
|
||||
ctx.incIndex()
|
||||
return code, nil
|
||||
}
|
||||
|
||||
func encodeCompileUint64String(ctx *encodeCompileContext) (*opcode, error) {
|
||||
code := newOpCode(ctx, opUint64String)
|
||||
code := newOpCode(ctx, opUintString)
|
||||
code.mask = math.MaxUint64
|
||||
code.rshiftNum = 63
|
||||
ctx.incIndex()
|
||||
return code, nil
|
||||
}
|
||||
|
@ -697,25 +764,12 @@ func encodeTypeToHeaderType(ctx *encodeCompileContext, code *opcode) opType {
|
|||
if ptrNum > 1 {
|
||||
switch code.next.op {
|
||||
case opInt:
|
||||
c.mask = code.next.mask
|
||||
c.rshiftNum = code.next.rshiftNum
|
||||
return opStructFieldHeadIntNPtr
|
||||
case opInt8:
|
||||
return opStructFieldHeadInt8NPtr
|
||||
case opInt16:
|
||||
return opStructFieldHeadInt16NPtr
|
||||
case opInt32:
|
||||
return opStructFieldHeadInt32NPtr
|
||||
case opInt64:
|
||||
return opStructFieldHeadInt64NPtr
|
||||
case opUint:
|
||||
c.mask = code.next.mask
|
||||
return opStructFieldHeadUintNPtr
|
||||
case opUint8:
|
||||
return opStructFieldHeadUint8NPtr
|
||||
case opUint16:
|
||||
return opStructFieldHeadUint16NPtr
|
||||
case opUint32:
|
||||
return opStructFieldHeadUint32NPtr
|
||||
case opUint64:
|
||||
return opStructFieldHeadUint64NPtr
|
||||
case opFloat32:
|
||||
return opStructFieldHeadFloat32NPtr
|
||||
case opFloat64:
|
||||
|
@ -728,25 +782,12 @@ func encodeTypeToHeaderType(ctx *encodeCompileContext, code *opcode) opType {
|
|||
} else {
|
||||
switch code.next.op {
|
||||
case opInt:
|
||||
c.mask = code.next.mask
|
||||
c.rshiftNum = code.next.rshiftNum
|
||||
return opStructFieldHeadIntPtr
|
||||
case opInt8:
|
||||
return opStructFieldHeadInt8Ptr
|
||||
case opInt16:
|
||||
return opStructFieldHeadInt16Ptr
|
||||
case opInt32:
|
||||
return opStructFieldHeadInt32Ptr
|
||||
case opInt64:
|
||||
return opStructFieldHeadInt64Ptr
|
||||
case opUint:
|
||||
c.mask = code.next.mask
|
||||
return opStructFieldHeadUintPtr
|
||||
case opUint8:
|
||||
return opStructFieldHeadUint8Ptr
|
||||
case opUint16:
|
||||
return opStructFieldHeadUint16Ptr
|
||||
case opUint32:
|
||||
return opStructFieldHeadUint32Ptr
|
||||
case opUint64:
|
||||
return opStructFieldHeadUint64Ptr
|
||||
case opFloat32:
|
||||
return opStructFieldHeadFloat32Ptr
|
||||
case opFloat64:
|
||||
|
@ -759,24 +800,8 @@ func encodeTypeToHeaderType(ctx *encodeCompileContext, code *opcode) opType {
|
|||
}
|
||||
case opInt:
|
||||
return opStructFieldHeadInt
|
||||
case opInt8:
|
||||
return opStructFieldHeadInt8
|
||||
case opInt16:
|
||||
return opStructFieldHeadInt16
|
||||
case opInt32:
|
||||
return opStructFieldHeadInt32
|
||||
case opInt64:
|
||||
return opStructFieldHeadInt64
|
||||
case opUint:
|
||||
return opStructFieldHeadUint
|
||||
case opUint8:
|
||||
return opStructFieldHeadUint8
|
||||
case opUint16:
|
||||
return opStructFieldHeadUint16
|
||||
case opUint32:
|
||||
return opStructFieldHeadUint32
|
||||
case opUint64:
|
||||
return opStructFieldHeadUint64
|
||||
case opFloat32:
|
||||
return opStructFieldHeadFloat32
|
||||
case opFloat64:
|
||||
|
@ -822,25 +847,12 @@ func encodeTypeToFieldType(ctx *encodeCompileContext, code *opcode) opType {
|
|||
if ptrNum > 1 {
|
||||
switch code.next.op {
|
||||
case opInt:
|
||||
c.mask = code.next.mask
|
||||
c.rshiftNum = code.next.rshiftNum
|
||||
return opStructFieldIntNPtr
|
||||
case opInt8:
|
||||
return opStructFieldInt8NPtr
|
||||
case opInt16:
|
||||
return opStructFieldInt16NPtr
|
||||
case opInt32:
|
||||
return opStructFieldInt32NPtr
|
||||
case opInt64:
|
||||
return opStructFieldInt64NPtr
|
||||
case opUint:
|
||||
c.mask = code.next.mask
|
||||
return opStructFieldUintNPtr
|
||||
case opUint8:
|
||||
return opStructFieldUint8NPtr
|
||||
case opUint16:
|
||||
return opStructFieldUint16NPtr
|
||||
case opUint32:
|
||||
return opStructFieldUint32NPtr
|
||||
case opUint64:
|
||||
return opStructFieldUint64NPtr
|
||||
case opFloat32:
|
||||
return opStructFieldFloat32NPtr
|
||||
case opFloat64:
|
||||
|
@ -853,25 +865,12 @@ func encodeTypeToFieldType(ctx *encodeCompileContext, code *opcode) opType {
|
|||
} else {
|
||||
switch code.next.op {
|
||||
case opInt:
|
||||
c.mask = code.next.mask
|
||||
c.rshiftNum = code.next.rshiftNum
|
||||
return opStructFieldIntPtr
|
||||
case opInt8:
|
||||
return opStructFieldInt8Ptr
|
||||
case opInt16:
|
||||
return opStructFieldInt16Ptr
|
||||
case opInt32:
|
||||
return opStructFieldInt32Ptr
|
||||
case opInt64:
|
||||
return opStructFieldInt64Ptr
|
||||
case opUint:
|
||||
c.mask = code.next.mask
|
||||
return opStructFieldUintPtr
|
||||
case opUint8:
|
||||
return opStructFieldUint8Ptr
|
||||
case opUint16:
|
||||
return opStructFieldUint16Ptr
|
||||
case opUint32:
|
||||
return opStructFieldUint32Ptr
|
||||
case opUint64:
|
||||
return opStructFieldUint64Ptr
|
||||
case opFloat32:
|
||||
return opStructFieldFloat32Ptr
|
||||
case opFloat64:
|
||||
|
@ -884,24 +883,8 @@ func encodeTypeToFieldType(ctx *encodeCompileContext, code *opcode) opType {
|
|||
}
|
||||
case opInt:
|
||||
return opStructFieldInt
|
||||
case opInt8:
|
||||
return opStructFieldInt8
|
||||
case opInt16:
|
||||
return opStructFieldInt16
|
||||
case opInt32:
|
||||
return opStructFieldInt32
|
||||
case opInt64:
|
||||
return opStructFieldInt64
|
||||
case opUint:
|
||||
return opStructFieldUint
|
||||
case opUint8:
|
||||
return opStructFieldUint8
|
||||
case opUint16:
|
||||
return opStructFieldUint16
|
||||
case opUint32:
|
||||
return opStructFieldUint32
|
||||
case opUint64:
|
||||
return opStructFieldUint64
|
||||
case opFloat32:
|
||||
return opStructFieldFloat32
|
||||
case opFloat64:
|
||||
|
@ -969,6 +952,8 @@ func encodeStructHeader(ctx *encodeCompileContext, fieldCode *opcode, valueCode
|
|||
fieldCode.indent--
|
||||
op := encodeOptimizeStructHeader(ctx, valueCode, tag)
|
||||
fieldCode.op = op
|
||||
fieldCode.mask = valueCode.mask
|
||||
fieldCode.rshiftNum = valueCode.rshiftNum
|
||||
fieldCode.ptrNum = valueCode.ptrNum
|
||||
switch op {
|
||||
case opStructFieldHead,
|
||||
|
@ -995,6 +980,8 @@ func encodeStructField(ctx *encodeCompileContext, fieldCode *opcode, valueCode *
|
|||
op := encodeOptimizeStructField(ctx, valueCode, tag)
|
||||
fieldCode.op = op
|
||||
fieldCode.ptrNum = valueCode.ptrNum
|
||||
fieldCode.mask = valueCode.mask
|
||||
fieldCode.rshiftNum = valueCode.rshiftNum
|
||||
switch op {
|
||||
case opStructField,
|
||||
opStructFieldSlice,
|
||||
|
|
|
@ -49,15 +49,9 @@ var intBELookup = [100]uint16{
|
|||
|
||||
var intLookup = [2]*[100]uint16{&intLELookup, &intBELookup}
|
||||
|
||||
func appendInt(b []byte, n int64) []byte {
|
||||
return formatInteger(b, uint64(n), n < 0)
|
||||
}
|
||||
|
||||
func appendUint(b []byte, n uint64) []byte {
|
||||
return formatInteger(b, n, false)
|
||||
}
|
||||
|
||||
func formatInteger(out []byte, n uint64, negative bool) []byte {
|
||||
func appendInt(out []byte, u64 uint64, code *opcode) []byte {
|
||||
n := u64 & code.mask
|
||||
negative := (u64>>code.rshiftNum)&1 == 1
|
||||
if !negative {
|
||||
if n < 10 {
|
||||
return append(out, byte(n+'0'))
|
||||
|
@ -66,7 +60,7 @@ func formatInteger(out []byte, n uint64, negative bool) []byte {
|
|||
return append(out, byte(u), byte(u>>8))
|
||||
}
|
||||
} else {
|
||||
n = -n
|
||||
n = -n & code.mask
|
||||
}
|
||||
|
||||
lookup := intLookup[endianness]
|
||||
|
@ -96,3 +90,35 @@ func formatInteger(out []byte, n uint64, negative bool) []byte {
|
|||
|
||||
return append(out, b[i:]...)
|
||||
}
|
||||
|
||||
func appendUint(out []byte, u64 uint64, code *opcode) []byte {
|
||||
n := u64 & code.mask
|
||||
if n < 10 {
|
||||
return append(out, byte(n+'0'))
|
||||
} else if n < 100 {
|
||||
u := intLELookup[n]
|
||||
return append(out, byte(u), byte(u>>8))
|
||||
}
|
||||
|
||||
lookup := intLookup[endianness]
|
||||
|
||||
var b [22]byte
|
||||
u := (*[11]uint16)(unsafe.Pointer(&b))
|
||||
i := 11
|
||||
|
||||
for n >= 100 {
|
||||
j := n % 100
|
||||
n /= 100
|
||||
i--
|
||||
u[i] = lookup[j]
|
||||
}
|
||||
|
||||
i--
|
||||
u[i] = lookup[n]
|
||||
|
||||
i *= 2 // convert to byte index
|
||||
if n < 10 {
|
||||
i++ // remove leading zero
|
||||
}
|
||||
return append(out, b[i:]...)
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@ type opcode struct {
|
|||
isTaggedKey bool // whether tagged key
|
||||
anonymousKey bool // whether anonymous key
|
||||
root bool // whether root
|
||||
rshiftNum uint8 // use to take bit for judging whether negative integer or not
|
||||
mask uint64 // mask for number
|
||||
indent int // indent number
|
||||
|
||||
idx uintptr // offset to access ptr
|
||||
|
@ -84,6 +86,8 @@ func (c *opcode) copy(codeMap map[uintptr]*opcode) *opcode {
|
|||
escapedKey: c.escapedKey,
|
||||
displayKey: c.displayKey,
|
||||
ptrNum: c.ptrNum,
|
||||
mask: c.mask,
|
||||
rshiftNum: c.rshiftNum,
|
||||
isTaggedKey: c.isTaggedKey,
|
||||
anonymousKey: c.anonymousKey,
|
||||
root: c.root,
|
||||
|
|
4967
encode_vm.go
4967
encode_vm.go
File diff suppressed because it is too large
Load Diff
4958
encode_vm_escaped.go
4958
encode_vm_escaped.go
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
5424
encode_vm_indent.go
5424
encode_vm_indent.go
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue