Add test case for float64 type

This commit is contained in:
Masaaki Goshima 2021-05-08 22:41:17 +09:00
parent 3fa9900acb
commit 440e24181b
1 changed files with 547 additions and 1 deletions

View File

@ -17,6 +17,9 @@ func TestCoverFloat64(t *testing.T) {
type structFloat64String struct { type structFloat64String struct {
A float64 `json:"a,string"` A float64 `json:"a,string"`
} }
type structFloat64StringOmitEmpty struct {
A float64 `json:"a,string,omitempty"`
}
type structFloat64Ptr struct { type structFloat64Ptr struct {
A *float64 `json:"a"` A *float64 `json:"a"`
@ -27,6 +30,9 @@ func TestCoverFloat64(t *testing.T) {
type structFloat64PtrString struct { type structFloat64PtrString struct {
A *float64 `json:"a,string"` A *float64 `json:"a,string"`
} }
type structFloat64PtrStringOmitEmpty struct {
A *float64 `json:"a,string,omitempty"`
}
tests := []struct { tests := []struct {
name string name string
@ -72,6 +78,12 @@ func TestCoverFloat64(t *testing.T) {
A float64 `json:"a,string"` A float64 `json:"a,string"`
}{}, }{},
}, },
{
name: "HeadFloat64ZeroStringOmitEmpty",
data: struct {
A float64 `json:"a,string,omitempty"`
}{},
},
// HeadFloat64 // HeadFloat64
{ {
@ -92,6 +104,12 @@ func TestCoverFloat64(t *testing.T) {
A float64 `json:"a,string"` A float64 `json:"a,string"`
}{A: 1}, }{A: 1},
}, },
{
name: "HeadFloat64StringOmitEmpty",
data: struct {
A float64 `json:"a,string,omitempty"`
}{A: 1},
},
// HeadFloat64Ptr // HeadFloat64Ptr
{ {
@ -112,6 +130,12 @@ func TestCoverFloat64(t *testing.T) {
A *float64 `json:"a,string"` A *float64 `json:"a,string"`
}{A: float64ptr(1)}, }{A: float64ptr(1)},
}, },
{
name: "HeadFloat64PtrStringOmitEmpty",
data: struct {
A *float64 `json:"a,string,omitempty"`
}{A: float64ptr(1)},
},
// HeadFloat64PtrNil // HeadFloat64PtrNil
{ {
@ -132,6 +156,12 @@ func TestCoverFloat64(t *testing.T) {
A *float64 `json:"a,string"` A *float64 `json:"a,string"`
}{A: nil}, }{A: nil},
}, },
{
name: "HeadFloat64PtrNilStringOmitEmpty",
data: struct {
A *float64 `json:"a,string,omitempty"`
}{A: nil},
},
// PtrHeadFloat64Zero // PtrHeadFloat64Zero
{ {
@ -152,6 +182,12 @@ func TestCoverFloat64(t *testing.T) {
A float64 `json:"a,string"` A float64 `json:"a,string"`
}{}, }{},
}, },
{
name: "PtrHeadFloat64ZeroStringOmitEmpty",
data: &struct {
A float64 `json:"a,string,omitempty"`
}{},
},
// PtrHeadFloat64 // PtrHeadFloat64
{ {
@ -172,6 +208,12 @@ func TestCoverFloat64(t *testing.T) {
A float64 `json:"a,string"` A float64 `json:"a,string"`
}{A: 1}, }{A: 1},
}, },
{
name: "PtrHeadFloat64StringOmitEmpty",
data: &struct {
A float64 `json:"a,string,omitempty"`
}{A: 1},
},
// PtrHeadFloat64Ptr // PtrHeadFloat64Ptr
{ {
@ -192,6 +234,12 @@ func TestCoverFloat64(t *testing.T) {
A *float64 `json:"a,string"` A *float64 `json:"a,string"`
}{A: float64ptr(1)}, }{A: float64ptr(1)},
}, },
{
name: "PtrHeadFloat64PtrStringOmitEmpty",
data: &struct {
A *float64 `json:"a,string,omitempty"`
}{A: float64ptr(1)},
},
// PtrHeadFloat64PtrNil // PtrHeadFloat64PtrNil
{ {
@ -212,6 +260,12 @@ func TestCoverFloat64(t *testing.T) {
A *float64 `json:"a,string"` A *float64 `json:"a,string"`
}{A: nil}, }{A: nil},
}, },
{
name: "PtrHeadFloat64PtrNilStringOmitEmpty",
data: &struct {
A *float64 `json:"a,string,omitempty"`
}{A: nil},
},
// PtrHeadFloat64Nil // PtrHeadFloat64Nil
{ {
@ -232,6 +286,12 @@ func TestCoverFloat64(t *testing.T) {
A *float64 `json:"a,string"` A *float64 `json:"a,string"`
})(nil), })(nil),
}, },
{
name: "PtrHeadFloat64NilStringOmitEmpty",
data: (*struct {
A *float64 `json:"a,string,omitempty"`
})(nil),
},
// HeadFloat64ZeroMultiFields // HeadFloat64ZeroMultiFields
{ {
@ -251,13 +311,21 @@ func TestCoverFloat64(t *testing.T) {
}{}, }{},
}, },
{ {
name: "HeadFloat64ZeroMultiFields", name: "HeadFloat64ZeroMultiFieldsString",
data: struct { data: struct {
A float64 `json:"a,string"` A float64 `json:"a,string"`
B float64 `json:"b,string"` B float64 `json:"b,string"`
C float64 `json:"c,string"` C float64 `json:"c,string"`
}{}, }{},
}, },
{
name: "HeadFloat64ZeroMultiFieldsStringOmitEmpty",
data: struct {
A float64 `json:"a,string,omitempty"`
B float64 `json:"b,string,omitempty"`
C float64 `json:"c,string,omitempty"`
}{},
},
// HeadFloat64MultiFields // HeadFloat64MultiFields
{ {
@ -284,6 +352,14 @@ func TestCoverFloat64(t *testing.T) {
C float64 `json:"c,string"` C float64 `json:"c,string"`
}{A: 1, B: 2, C: 3}, }{A: 1, B: 2, C: 3},
}, },
{
name: "HeadFloat64MultiFieldsStringOmitEmpty",
data: struct {
A float64 `json:"a,string,omitempty"`
B float64 `json:"b,string,omitempty"`
C float64 `json:"c,string,omitempty"`
}{A: 1, B: 2, C: 3},
},
// HeadFloat64PtrMultiFields // HeadFloat64PtrMultiFields
{ {
@ -310,6 +386,14 @@ func TestCoverFloat64(t *testing.T) {
C *float64 `json:"c,string"` C *float64 `json:"c,string"`
}{A: float64ptr(1), B: float64ptr(2), C: float64ptr(3)}, }{A: float64ptr(1), B: float64ptr(2), C: float64ptr(3)},
}, },
{
name: "HeadFloat64PtrMultiFieldsStringOmitEmpty",
data: struct {
A *float64 `json:"a,string,omitempty"`
B *float64 `json:"b,string,omitempty"`
C *float64 `json:"c,string,omitempty"`
}{A: float64ptr(1), B: float64ptr(2), C: float64ptr(3)},
},
// HeadFloat64PtrNilMultiFields // HeadFloat64PtrNilMultiFields
{ {
@ -336,6 +420,14 @@ func TestCoverFloat64(t *testing.T) {
C *float64 `json:"c,string"` C *float64 `json:"c,string"`
}{A: nil, B: nil, C: nil}, }{A: nil, B: nil, C: nil},
}, },
{
name: "HeadFloat64PtrNilMultiFieldsStringOmitEmpty",
data: struct {
A *float64 `json:"a,string,omitempty"`
B *float64 `json:"b,string,omitempty"`
C *float64 `json:"c,string,omitempty"`
}{A: nil, B: nil, C: nil},
},
// PtrHeadFloat64ZeroMultiFields // PtrHeadFloat64ZeroMultiFields
{ {
@ -359,6 +451,13 @@ func TestCoverFloat64(t *testing.T) {
B float64 `json:"b,string"` B float64 `json:"b,string"`
}{}, }{},
}, },
{
name: "PtrHeadFloat64ZeroMultiFieldsStringOmitEmpty",
data: &struct {
A float64 `json:"a,string,omitempty"`
B float64 `json:"b,string,omitempty"`
}{},
},
// PtrHeadFloat64MultiFields // PtrHeadFloat64MultiFields
{ {
@ -382,6 +481,13 @@ func TestCoverFloat64(t *testing.T) {
B float64 `json:"b,string"` B float64 `json:"b,string"`
}{A: 1, B: 2}, }{A: 1, B: 2},
}, },
{
name: "PtrHeadFloat64MultiFieldsStringOmitEmpty",
data: &struct {
A float64 `json:"a,string,omitempty"`
B float64 `json:"b,string,omitempty"`
}{A: 1, B: 2},
},
// PtrHeadFloat64PtrMultiFields // PtrHeadFloat64PtrMultiFields
{ {
@ -405,6 +511,13 @@ func TestCoverFloat64(t *testing.T) {
B *float64 `json:"b,string"` B *float64 `json:"b,string"`
}{A: float64ptr(1), B: float64ptr(2)}, }{A: float64ptr(1), B: float64ptr(2)},
}, },
{
name: "PtrHeadFloat64PtrMultiFieldsStringOmitEmpty",
data: &struct {
A *float64 `json:"a,string,omitempty"`
B *float64 `json:"b,string,omitempty"`
}{A: float64ptr(1), B: float64ptr(2)},
},
// PtrHeadFloat64PtrNilMultiFields // PtrHeadFloat64PtrNilMultiFields
{ {
@ -428,6 +541,13 @@ func TestCoverFloat64(t *testing.T) {
B *float64 `json:"b,string"` B *float64 `json:"b,string"`
}{A: nil, B: nil}, }{A: nil, B: nil},
}, },
{
name: "PtrHeadFloat64PtrNilMultiFieldsStringOmitEmpty",
data: &struct {
A *float64 `json:"a,string,omitempty"`
B *float64 `json:"b,string,omitempty"`
}{A: nil, B: nil},
},
// PtrHeadFloat64NilMultiFields // PtrHeadFloat64NilMultiFields
{ {
@ -451,6 +571,13 @@ func TestCoverFloat64(t *testing.T) {
B *float64 `json:"b,string"` B *float64 `json:"b,string"`
})(nil), })(nil),
}, },
{
name: "PtrHeadFloat64NilMultiFieldsStringOmitEmpty",
data: (*struct {
A *float64 `json:"a,string,omitempty"`
B *float64 `json:"b,string,omitempty"`
})(nil),
},
// HeadFloat64ZeroNotRoot // HeadFloat64ZeroNotRoot
{ {
@ -477,6 +604,14 @@ func TestCoverFloat64(t *testing.T) {
} }
}{}, }{},
}, },
{
name: "HeadFloat64ZeroNotRootStringOmitEmpty",
data: struct {
A struct {
A float64 `json:"a,string,omitempty"`
}
}{},
},
// HeadFloat64NotRoot // HeadFloat64NotRoot
{ {
@ -509,6 +644,16 @@ func TestCoverFloat64(t *testing.T) {
A float64 `json:"a,string"` A float64 `json:"a,string"`
}{A: 1}}, }{A: 1}},
}, },
{
name: "HeadFloat64NotRootStringOmitEmpty",
data: struct {
A struct {
A float64 `json:"a,string,omitempty"`
}
}{A: struct {
A float64 `json:"a,string,omitempty"`
}{A: 1}},
},
// HeadFloat64PtrNotRoot // HeadFloat64PtrNotRoot
{ {
@ -541,6 +686,16 @@ func TestCoverFloat64(t *testing.T) {
A *float64 `json:"a,string"` A *float64 `json:"a,string"`
}{float64ptr(1)}}, }{float64ptr(1)}},
}, },
{
name: "HeadFloat64PtrNotRootStringOmitEmpty",
data: struct {
A struct {
A *float64 `json:"a,string,omitempty"`
}
}{A: struct {
A *float64 `json:"a,string,omitempty"`
}{float64ptr(1)}},
},
// HeadFloat64PtrNilNotRoot // HeadFloat64PtrNilNotRoot
{ {
@ -567,6 +722,14 @@ func TestCoverFloat64(t *testing.T) {
} }
}{}, }{},
}, },
{
name: "HeadFloat64PtrNilNotRootStringOmitEmpty",
data: struct {
A struct {
A *float64 `json:"a,string,omitempty"`
}
}{},
},
// PtrHeadFloat64ZeroNotRoot // PtrHeadFloat64ZeroNotRoot
{ {
@ -599,6 +762,16 @@ func TestCoverFloat64(t *testing.T) {
A float64 `json:"a,string"` A float64 `json:"a,string"`
})}, })},
}, },
{
name: "PtrHeadFloat64ZeroNotRootStringOmitEmpty",
data: struct {
A *struct {
A float64 `json:"a,string,omitempty"`
}
}{A: new(struct {
A float64 `json:"a,string,omitempty"`
})},
},
// PtrHeadFloat64NotRoot // PtrHeadFloat64NotRoot
{ {
@ -631,6 +804,16 @@ func TestCoverFloat64(t *testing.T) {
A float64 `json:"a,string"` A float64 `json:"a,string"`
}{A: 1})}, }{A: 1})},
}, },
{
name: "PtrHeadFloat64NotRootStringOmitEmpty",
data: struct {
A *struct {
A float64 `json:"a,string,omitempty"`
}
}{A: &(struct {
A float64 `json:"a,string,omitempty"`
}{A: 1})},
},
// PtrHeadFloat64PtrNotRoot // PtrHeadFloat64PtrNotRoot
{ {
@ -663,6 +846,16 @@ func TestCoverFloat64(t *testing.T) {
A *float64 `json:"a,string"` A *float64 `json:"a,string"`
}{A: float64ptr(1)})}, }{A: float64ptr(1)})},
}, },
{
name: "PtrHeadFloat64PtrNotRootStringOmitEmpty",
data: struct {
A *struct {
A *float64 `json:"a,string,omitempty"`
}
}{A: &(struct {
A *float64 `json:"a,string,omitempty"`
}{A: float64ptr(1)})},
},
// PtrHeadFloat64PtrNilNotRoot // PtrHeadFloat64PtrNilNotRoot
{ {
@ -695,6 +888,16 @@ func TestCoverFloat64(t *testing.T) {
A *float64 `json:"a,string"` A *float64 `json:"a,string"`
}{A: nil})}, }{A: nil})},
}, },
{
name: "PtrHeadFloat64PtrNilNotRootStringOmitEmpty",
data: struct {
A *struct {
A *float64 `json:"a,string,omitempty"`
}
}{A: &(struct {
A *float64 `json:"a,string,omitempty"`
}{A: nil})},
},
// PtrHeadFloat64NilNotRoot // PtrHeadFloat64NilNotRoot
{ {
@ -721,6 +924,14 @@ func TestCoverFloat64(t *testing.T) {
} `json:",string"` } `json:",string"`
}{A: nil}, }{A: nil},
}, },
{
name: "PtrHeadFloat64NilNotRootStringOmitEmpty",
data: struct {
A *struct {
A *float64 `json:"a,string,omitempty"`
} `json:",string,omitempty"`
}{A: nil},
},
// HeadFloat64ZeroMultiFieldsNotRoot // HeadFloat64ZeroMultiFieldsNotRoot
{ {
@ -756,6 +967,17 @@ func TestCoverFloat64(t *testing.T) {
} }
}{}, }{},
}, },
{
name: "HeadFloat64ZeroMultiFieldsNotRootStringOmitEmpty",
data: struct {
A struct {
A float64 `json:"a,string,omitempty"`
}
B struct {
B float64 `json:"b,string,omitempty"`
}
}{},
},
// HeadFloat64MultiFieldsNotRoot // HeadFloat64MultiFieldsNotRoot
{ {
@ -803,6 +1025,21 @@ func TestCoverFloat64(t *testing.T) {
B float64 `json:"b,string"` B float64 `json:"b,string"`
}{B: 2}}, }{B: 2}},
}, },
{
name: "HeadFloat64MultiFieldsNotRootStringOmitEmpty",
data: struct {
A struct {
A float64 `json:"a,string,omitempty"`
}
B struct {
B float64 `json:"b,string,omitempty"`
}
}{A: struct {
A float64 `json:"a,string,omitempty"`
}{A: 1}, B: struct {
B float64 `json:"b,string,omitempty"`
}{B: 2}},
},
// HeadFloat64PtrMultiFieldsNotRoot // HeadFloat64PtrMultiFieldsNotRoot
{ {
@ -850,6 +1087,21 @@ func TestCoverFloat64(t *testing.T) {
B *float64 `json:"b,string"` B *float64 `json:"b,string"`
}{B: float64ptr(2)}}, }{B: float64ptr(2)}},
}, },
{
name: "HeadFloat64PtrMultiFieldsNotRootStringOmitEmpty",
data: struct {
A struct {
A *float64 `json:"a,string,omitempty"`
}
B struct {
B *float64 `json:"b,string,omitempty"`
}
}{A: struct {
A *float64 `json:"a,string,omitempty"`
}{A: float64ptr(1)}, B: struct {
B *float64 `json:"b,string,omitempty"`
}{B: float64ptr(2)}},
},
// HeadFloat64PtrNilMultiFieldsNotRoot // HeadFloat64PtrNilMultiFieldsNotRoot
{ {
@ -897,6 +1149,21 @@ func TestCoverFloat64(t *testing.T) {
B *float64 `json:"b,string"` B *float64 `json:"b,string"`
}{B: nil}}, }{B: nil}},
}, },
{
name: "HeadFloat64PtrNilMultiFieldsNotRootStringOmitEmpty",
data: struct {
A struct {
A *float64 `json:"a,string,omitempty"`
}
B struct {
B *float64 `json:"b,string,omitempty"`
}
}{A: struct {
A *float64 `json:"a,string,omitempty"`
}{A: nil}, B: struct {
B *float64 `json:"b,string,omitempty"`
}{B: nil}},
},
// PtrHeadFloat64ZeroMultiFieldsNotRoot // PtrHeadFloat64ZeroMultiFieldsNotRoot
{ {
@ -932,6 +1199,17 @@ func TestCoverFloat64(t *testing.T) {
} }
}{}, }{},
}, },
{
name: "PtrHeadFloat64ZeroMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A struct {
A float64 `json:"a,string,omitempty"`
}
B struct {
B float64 `json:"b,string,omitempty"`
}
}{},
},
// PtrHeadFloat64MultiFieldsNotRoot // PtrHeadFloat64MultiFieldsNotRoot
{ {
@ -979,6 +1257,21 @@ func TestCoverFloat64(t *testing.T) {
B float64 `json:"b,string"` B float64 `json:"b,string"`
}{B: 2}}, }{B: 2}},
}, },
{
name: "PtrHeadFloat64MultiFieldsNotRootStringOmitEmpty",
data: &struct {
A struct {
A float64 `json:"a,string,omitempty"`
}
B struct {
B float64 `json:"b,string,omitempty"`
}
}{A: struct {
A float64 `json:"a,string,omitempty"`
}{A: 1}, B: struct {
B float64 `json:"b,string,omitempty"`
}{B: 2}},
},
// PtrHeadFloat64PtrMultiFieldsNotRoot // PtrHeadFloat64PtrMultiFieldsNotRoot
{ {
@ -1026,6 +1319,21 @@ func TestCoverFloat64(t *testing.T) {
B *float64 `json:"b,string"` B *float64 `json:"b,string"`
}{B: float64ptr(2)})}, }{B: float64ptr(2)})},
}, },
{
name: "PtrHeadFloat64PtrMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A *float64 `json:"a,string,omitempty"`
}
B *struct {
B *float64 `json:"b,string,omitempty"`
}
}{A: &(struct {
A *float64 `json:"a,string,omitempty"`
}{A: float64ptr(1)}), B: &(struct {
B *float64 `json:"b,string,omitempty"`
}{B: float64ptr(2)})},
},
// PtrHeadFloat64PtrNilMultiFieldsNotRoot // PtrHeadFloat64PtrNilMultiFieldsNotRoot
{ {
@ -1061,6 +1369,17 @@ func TestCoverFloat64(t *testing.T) {
} `json:",string"` } `json:",string"`
}{A: nil, B: nil}, }{A: nil, B: nil},
}, },
{
name: "PtrHeadFloat64PtrNilMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A *float64 `json:"a,string,omitempty"`
} `json:",string,omitempty"`
B *struct {
B *float64 `json:"b,string,omitempty"`
} `json:",string,omitempty"`
}{A: nil, B: nil},
},
// PtrHeadFloat64NilMultiFieldsNotRoot // PtrHeadFloat64NilMultiFieldsNotRoot
{ {
@ -1096,6 +1415,17 @@ func TestCoverFloat64(t *testing.T) {
} }
})(nil), })(nil),
}, },
{
name: "PtrHeadFloat64NilMultiFieldsNotRootStringOmitEmpty",
data: (*struct {
A *struct {
A *float64 `json:"a,string,omitempty"`
}
B *struct {
B *float64 `json:"b,string,omitempty"`
}
})(nil),
},
// PtrHeadFloat64DoubleMultiFieldsNotRoot // PtrHeadFloat64DoubleMultiFieldsNotRoot
{ {
@ -1155,6 +1485,25 @@ func TestCoverFloat64(t *testing.T) {
B float64 `json:"b,string"` B float64 `json:"b,string"`
}{A: 3, B: 4})}, }{A: 3, B: 4})},
}, },
{
name: "PtrHeadFloat64DoubleMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A float64 `json:"a,string,omitempty"`
B float64 `json:"b,string,omitempty"`
}
B *struct {
A float64 `json:"a,string,omitempty"`
B float64 `json:"b,string,omitempty"`
}
}{A: &(struct {
A float64 `json:"a,string,omitempty"`
B float64 `json:"b,string,omitempty"`
}{A: 1, B: 2}), B: &(struct {
A float64 `json:"a,string,omitempty"`
B float64 `json:"b,string,omitempty"`
}{A: 3, B: 4})},
},
// PtrHeadFloat64NilDoubleMultiFieldsNotRoot // PtrHeadFloat64NilDoubleMultiFieldsNotRoot
{ {
@ -1196,6 +1545,19 @@ func TestCoverFloat64(t *testing.T) {
} }
}{A: nil, B: nil}, }{A: nil, B: nil},
}, },
{
name: "PtrHeadFloat64NilDoubleMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A float64 `json:"a,string,omitempty"`
B float64 `json:"b,string,omitempty"`
}
B *struct {
A float64 `json:"a,string,omitempty"`
B float64 `json:"b,string,omitempty"`
}
}{A: nil, B: nil},
},
// PtrHeadFloat64NilDoubleMultiFieldsNotRoot // PtrHeadFloat64NilDoubleMultiFieldsNotRoot
{ {
@ -1237,6 +1599,19 @@ func TestCoverFloat64(t *testing.T) {
} }
})(nil), })(nil),
}, },
{
name: "PtrHeadFloat64NilDoubleMultiFieldsNotRootStringOmitEmpty",
data: (*struct {
A *struct {
A float64 `json:"a,string,omitempty"`
B float64 `json:"b,string,omitempty"`
}
B *struct {
A float64 `json:"a,string,omitempty"`
B float64 `json:"b,string,omitempty"`
}
})(nil),
},
// PtrHeadFloat64PtrDoubleMultiFieldsNotRoot // PtrHeadFloat64PtrDoubleMultiFieldsNotRoot
{ {
@ -1296,6 +1671,25 @@ func TestCoverFloat64(t *testing.T) {
B *float64 `json:"b,string"` B *float64 `json:"b,string"`
}{A: float64ptr(3), B: float64ptr(4)})}, }{A: float64ptr(3), B: float64ptr(4)})},
}, },
{
name: "PtrHeadFloat64PtrDoubleMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A *float64 `json:"a,string,omitempty"`
B *float64 `json:"b,string,omitempty"`
}
B *struct {
A *float64 `json:"a,string,omitempty"`
B *float64 `json:"b,string,omitempty"`
}
}{A: &(struct {
A *float64 `json:"a,string,omitempty"`
B *float64 `json:"b,string,omitempty"`
}{A: float64ptr(1), B: float64ptr(2)}), B: &(struct {
A *float64 `json:"a,string,omitempty"`
B *float64 `json:"b,string,omitempty"`
}{A: float64ptr(3), B: float64ptr(4)})},
},
// PtrHeadFloat64PtrNilDoubleMultiFieldsNotRoot // PtrHeadFloat64PtrNilDoubleMultiFieldsNotRoot
{ {
@ -1337,6 +1731,19 @@ func TestCoverFloat64(t *testing.T) {
} }
}{A: nil, B: nil}, }{A: nil, B: nil},
}, },
{
name: "PtrHeadFloat64PtrNilDoubleMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A *float64 `json:"a,string,omitempty"`
B *float64 `json:"b,string,omitempty"`
}
B *struct {
A *float64 `json:"a,string,omitempty"`
B *float64 `json:"b,string,omitempty"`
}
}{A: nil, B: nil},
},
// PtrHeadFloat64PtrNilDoubleMultiFieldsNotRoot // PtrHeadFloat64PtrNilDoubleMultiFieldsNotRoot
{ {
@ -1378,6 +1785,19 @@ func TestCoverFloat64(t *testing.T) {
} }
})(nil), })(nil),
}, },
{
name: "PtrHeadFloat64PtrNilDoubleMultiFieldsNotRootStringOmitEmpty",
data: (*struct {
A *struct {
A *float64 `json:"a,string,omitempty"`
B *float64 `json:"b,string,omitempty"`
}
B *struct {
A *float64 `json:"a,string,omitempty"`
B *float64 `json:"b,string,omitempty"`
}
})(nil),
},
// AnonymousHeadFloat64 // AnonymousHeadFloat64
{ {
@ -1410,6 +1830,16 @@ func TestCoverFloat64(t *testing.T) {
B: 2, B: 2,
}, },
}, },
{
name: "AnonymousHeadFloat64StringOmitEmpty",
data: struct {
structFloat64StringOmitEmpty
B float64 `json:"b,string,omitempty"`
}{
structFloat64StringOmitEmpty: structFloat64StringOmitEmpty{A: 1},
B: 2,
},
},
// PtrAnonymousHeadFloat64 // PtrAnonymousHeadFloat64
{ {
@ -1442,6 +1872,16 @@ func TestCoverFloat64(t *testing.T) {
B: 2, B: 2,
}, },
}, },
{
name: "PtrAnonymousHeadFloat64StringOmitEmpty",
data: struct {
*structFloat64StringOmitEmpty
B float64 `json:"b,string,omitempty"`
}{
structFloat64StringOmitEmpty: &structFloat64StringOmitEmpty{A: 1},
B: 2,
},
},
// NilPtrAnonymousHeadFloat64 // NilPtrAnonymousHeadFloat64
{ {
@ -1474,6 +1914,16 @@ func TestCoverFloat64(t *testing.T) {
B: 2, B: 2,
}, },
}, },
{
name: "NilPtrAnonymousHeadFloat64StringOmitEmpty",
data: struct {
*structFloat64StringOmitEmpty
B float64 `json:"b,string,omitempty"`
}{
structFloat64StringOmitEmpty: nil,
B: 2,
},
},
// AnonymousHeadFloat64Ptr // AnonymousHeadFloat64Ptr
{ {
@ -1506,6 +1956,16 @@ func TestCoverFloat64(t *testing.T) {
B: float64ptr(2), B: float64ptr(2),
}, },
}, },
{
name: "AnonymousHeadFloat64PtrStringOmitEmpty",
data: struct {
structFloat64PtrStringOmitEmpty
B *float64 `json:"b,string,omitempty"`
}{
structFloat64PtrStringOmitEmpty: structFloat64PtrStringOmitEmpty{A: float64ptr(1)},
B: float64ptr(2),
},
},
// AnonymousHeadFloat64PtrNil // AnonymousHeadFloat64PtrNil
{ {
@ -1538,6 +1998,16 @@ func TestCoverFloat64(t *testing.T) {
B: float64ptr(2), B: float64ptr(2),
}, },
}, },
{
name: "AnonymousHeadFloat64PtrNilStringOmitEmpty",
data: struct {
structFloat64PtrStringOmitEmpty
B *float64 `json:"b,string,omitempty"`
}{
structFloat64PtrStringOmitEmpty: structFloat64PtrStringOmitEmpty{A: nil},
B: float64ptr(2),
},
},
// PtrAnonymousHeadFloat64Ptr // PtrAnonymousHeadFloat64Ptr
{ {
@ -1570,6 +2040,16 @@ func TestCoverFloat64(t *testing.T) {
B: float64ptr(2), B: float64ptr(2),
}, },
}, },
{
name: "PtrAnonymousHeadFloat64PtrStringOmitEmpty",
data: struct {
*structFloat64PtrStringOmitEmpty
B *float64 `json:"b,string,omitempty"`
}{
structFloat64PtrStringOmitEmpty: &structFloat64PtrStringOmitEmpty{A: float64ptr(1)},
B: float64ptr(2),
},
},
// NilPtrAnonymousHeadFloat64Ptr // NilPtrAnonymousHeadFloat64Ptr
{ {
@ -1602,6 +2082,16 @@ func TestCoverFloat64(t *testing.T) {
B: float64ptr(2), B: float64ptr(2),
}, },
}, },
{
name: "NilPtrAnonymousHeadFloat64PtrStringOmitEmpty",
data: struct {
*structFloat64PtrStringOmitEmpty
B *float64 `json:"b,string,omitempty"`
}{
structFloat64PtrStringOmitEmpty: nil,
B: float64ptr(2),
},
},
// AnonymousHeadFloat64Only // AnonymousHeadFloat64Only
{ {
@ -1628,6 +2118,14 @@ func TestCoverFloat64(t *testing.T) {
structFloat64String: structFloat64String{A: 1}, structFloat64String: structFloat64String{A: 1},
}, },
}, },
{
name: "AnonymousHeadFloat64OnlyStringOmitEmpty",
data: struct {
structFloat64StringOmitEmpty
}{
structFloat64StringOmitEmpty: structFloat64StringOmitEmpty{A: 1},
},
},
// PtrAnonymousHeadFloat64Only // PtrAnonymousHeadFloat64Only
{ {
@ -1654,6 +2152,14 @@ func TestCoverFloat64(t *testing.T) {
structFloat64String: &structFloat64String{A: 1}, structFloat64String: &structFloat64String{A: 1},
}, },
}, },
{
name: "PtrAnonymousHeadFloat64OnlyStringOmitEmpty",
data: struct {
*structFloat64StringOmitEmpty
}{
structFloat64StringOmitEmpty: &structFloat64StringOmitEmpty{A: 1},
},
},
// NilPtrAnonymousHeadFloat64Only // NilPtrAnonymousHeadFloat64Only
{ {
@ -1680,6 +2186,14 @@ func TestCoverFloat64(t *testing.T) {
structFloat64String: nil, structFloat64String: nil,
}, },
}, },
{
name: "NilPtrAnonymousHeadFloat64OnlyStringOmitEmpty",
data: struct {
*structFloat64StringOmitEmpty
}{
structFloat64StringOmitEmpty: nil,
},
},
// AnonymousHeadFloat64PtrOnly // AnonymousHeadFloat64PtrOnly
{ {
@ -1706,6 +2220,14 @@ func TestCoverFloat64(t *testing.T) {
structFloat64PtrString: structFloat64PtrString{A: float64ptr(1)}, structFloat64PtrString: structFloat64PtrString{A: float64ptr(1)},
}, },
}, },
{
name: "AnonymousHeadFloat64PtrOnlyStringOmitEmpty",
data: struct {
structFloat64PtrStringOmitEmpty
}{
structFloat64PtrStringOmitEmpty: structFloat64PtrStringOmitEmpty{A: float64ptr(1)},
},
},
// AnonymousHeadFloat64PtrNilOnly // AnonymousHeadFloat64PtrNilOnly
{ {
@ -1732,6 +2254,14 @@ func TestCoverFloat64(t *testing.T) {
structFloat64PtrString: structFloat64PtrString{A: nil}, structFloat64PtrString: structFloat64PtrString{A: nil},
}, },
}, },
{
name: "AnonymousHeadFloat64PtrNilOnlyStringOmitEmpty",
data: struct {
structFloat64PtrStringOmitEmpty
}{
structFloat64PtrStringOmitEmpty: structFloat64PtrStringOmitEmpty{A: nil},
},
},
// PtrAnonymousHeadFloat64PtrOnly // PtrAnonymousHeadFloat64PtrOnly
{ {
@ -1758,6 +2288,14 @@ func TestCoverFloat64(t *testing.T) {
structFloat64PtrString: &structFloat64PtrString{A: float64ptr(1)}, structFloat64PtrString: &structFloat64PtrString{A: float64ptr(1)},
}, },
}, },
{
name: "PtrAnonymousHeadFloat64PtrOnlyStringOmitEmpty",
data: struct {
*structFloat64PtrStringOmitEmpty
}{
structFloat64PtrStringOmitEmpty: &structFloat64PtrStringOmitEmpty{A: float64ptr(1)},
},
},
// NilPtrAnonymousHeadFloat64PtrOnly // NilPtrAnonymousHeadFloat64PtrOnly
{ {
@ -1784,6 +2322,14 @@ func TestCoverFloat64(t *testing.T) {
structFloat64PtrString: nil, structFloat64PtrString: nil,
}, },
}, },
{
name: "NilPtrAnonymousHeadFloat64PtrOnlyStringOmitEmpty",
data: struct {
*structFloat64PtrStringOmitEmpty
}{
structFloat64PtrStringOmitEmpty: nil,
},
},
} }
for _, test := range tests { for _, test := range tests {
for _, indent := range []bool{true, false} { for _, indent := range []bool{true, false} {