Add test case for float32 type

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

View File

@ -17,6 +17,9 @@ func TestCoverFloat32(t *testing.T) {
type structFloat32String struct { type structFloat32String struct {
A float32 `json:"a,string"` A float32 `json:"a,string"`
} }
type structFloat32StringOmitEmpty struct {
A float32 `json:"a,string,omitempty"`
}
type structFloat32Ptr struct { type structFloat32Ptr struct {
A *float32 `json:"a"` A *float32 `json:"a"`
@ -27,6 +30,9 @@ func TestCoverFloat32(t *testing.T) {
type structFloat32PtrString struct { type structFloat32PtrString struct {
A *float32 `json:"a,string"` A *float32 `json:"a,string"`
} }
type structFloat32PtrStringOmitEmpty struct {
A *float32 `json:"a,string,omitempty"`
}
tests := []struct { tests := []struct {
name string name string
@ -72,6 +78,12 @@ func TestCoverFloat32(t *testing.T) {
A float32 `json:"a,string"` A float32 `json:"a,string"`
}{}, }{},
}, },
{
name: "HeadFloat32ZeroStringOmitEmpty",
data: struct {
A float32 `json:"a,string,omitempty"`
}{},
},
// HeadFloat32 // HeadFloat32
{ {
@ -92,6 +104,12 @@ func TestCoverFloat32(t *testing.T) {
A float32 `json:"a,string"` A float32 `json:"a,string"`
}{A: 1}, }{A: 1},
}, },
{
name: "HeadFloat32StringOmitEmpty",
data: struct {
A float32 `json:"a,string,omitempty"`
}{A: 1},
},
// HeadFloat32Ptr // HeadFloat32Ptr
{ {
@ -112,6 +130,12 @@ func TestCoverFloat32(t *testing.T) {
A *float32 `json:"a,string"` A *float32 `json:"a,string"`
}{A: float32ptr(1)}, }{A: float32ptr(1)},
}, },
{
name: "HeadFloat32PtrStringOmitEmpty",
data: struct {
A *float32 `json:"a,string,omitempty"`
}{A: float32ptr(1)},
},
// HeadFloat32PtrNil // HeadFloat32PtrNil
{ {
@ -132,6 +156,12 @@ func TestCoverFloat32(t *testing.T) {
A *float32 `json:"a,string"` A *float32 `json:"a,string"`
}{A: nil}, }{A: nil},
}, },
{
name: "HeadFloat32PtrNilStringOmitEmpty",
data: struct {
A *float32 `json:"a,string,omitempty"`
}{A: nil},
},
// PtrHeadFloat32Zero // PtrHeadFloat32Zero
{ {
@ -152,6 +182,12 @@ func TestCoverFloat32(t *testing.T) {
A float32 `json:"a,string"` A float32 `json:"a,string"`
}{}, }{},
}, },
{
name: "PtrHeadFloat32ZeroStringOmitEmpty",
data: &struct {
A float32 `json:"a,string,omitempty"`
}{},
},
// PtrHeadFloat32 // PtrHeadFloat32
{ {
@ -172,6 +208,12 @@ func TestCoverFloat32(t *testing.T) {
A float32 `json:"a,string"` A float32 `json:"a,string"`
}{A: 1}, }{A: 1},
}, },
{
name: "PtrHeadFloat32StringOmitEmpty",
data: &struct {
A float32 `json:"a,string,omitempty"`
}{A: 1},
},
// PtrHeadFloat32Ptr // PtrHeadFloat32Ptr
{ {
@ -192,6 +234,12 @@ func TestCoverFloat32(t *testing.T) {
A *float32 `json:"a,string"` A *float32 `json:"a,string"`
}{A: float32ptr(1)}, }{A: float32ptr(1)},
}, },
{
name: "PtrHeadFloat32PtrStringOmitEmpty",
data: &struct {
A *float32 `json:"a,string,omitempty"`
}{A: float32ptr(1)},
},
// PtrHeadFloat32PtrNil // PtrHeadFloat32PtrNil
{ {
@ -212,6 +260,12 @@ func TestCoverFloat32(t *testing.T) {
A *float32 `json:"a,string"` A *float32 `json:"a,string"`
}{A: nil}, }{A: nil},
}, },
{
name: "PtrHeadFloat32PtrNilStringOmitEmpty",
data: &struct {
A *float32 `json:"a,string,omitempty"`
}{A: nil},
},
// PtrHeadFloat32Nil // PtrHeadFloat32Nil
{ {
@ -232,6 +286,12 @@ func TestCoverFloat32(t *testing.T) {
A *float32 `json:"a,string"` A *float32 `json:"a,string"`
})(nil), })(nil),
}, },
{
name: "PtrHeadFloat32NilStringOmitEmpty",
data: (*struct {
A *float32 `json:"a,string,omitempty"`
})(nil),
},
// HeadFloat32ZeroMultiFields // HeadFloat32ZeroMultiFields
{ {
@ -251,13 +311,21 @@ func TestCoverFloat32(t *testing.T) {
}{}, }{},
}, },
{ {
name: "HeadFloat32ZeroMultiFields", name: "HeadFloat32ZeroMultiFieldsString",
data: struct { data: struct {
A float32 `json:"a,string"` A float32 `json:"a,string"`
B float32 `json:"b,string"` B float32 `json:"b,string"`
C float32 `json:"c,string"` C float32 `json:"c,string"`
}{}, }{},
}, },
{
name: "HeadFloat32ZeroMultiFieldsStringOmitEmpty",
data: struct {
A float32 `json:"a,string,omitempty"`
B float32 `json:"b,string,omitempty"`
C float32 `json:"c,string,omitempty"`
}{},
},
// HeadFloat32MultiFields // HeadFloat32MultiFields
{ {
@ -284,6 +352,14 @@ func TestCoverFloat32(t *testing.T) {
C float32 `json:"c,string"` C float32 `json:"c,string"`
}{A: 1, B: 2, C: 3}, }{A: 1, B: 2, C: 3},
}, },
{
name: "HeadFloat32MultiFieldsStringOmitEmpty",
data: struct {
A float32 `json:"a,string,omitempty"`
B float32 `json:"b,string,omitempty"`
C float32 `json:"c,string,omitempty"`
}{A: 1, B: 2, C: 3},
},
// HeadFloat32PtrMultiFields // HeadFloat32PtrMultiFields
{ {
@ -310,6 +386,14 @@ func TestCoverFloat32(t *testing.T) {
C *float32 `json:"c,string"` C *float32 `json:"c,string"`
}{A: float32ptr(1), B: float32ptr(2), C: float32ptr(3)}, }{A: float32ptr(1), B: float32ptr(2), C: float32ptr(3)},
}, },
{
name: "HeadFloat32PtrMultiFieldsStringOmitEmpty",
data: struct {
A *float32 `json:"a,string,omitempty"`
B *float32 `json:"b,string,omitempty"`
C *float32 `json:"c,string,omitempty"`
}{A: float32ptr(1), B: float32ptr(2), C: float32ptr(3)},
},
// HeadFloat32PtrNilMultiFields // HeadFloat32PtrNilMultiFields
{ {
@ -336,6 +420,14 @@ func TestCoverFloat32(t *testing.T) {
C *float32 `json:"c,string"` C *float32 `json:"c,string"`
}{A: nil, B: nil, C: nil}, }{A: nil, B: nil, C: nil},
}, },
{
name: "HeadFloat32PtrNilMultiFieldsStringOmitEmpty",
data: struct {
A *float32 `json:"a,string,omitempty"`
B *float32 `json:"b,string,omitempty"`
C *float32 `json:"c,string,omitempty"`
}{A: nil, B: nil, C: nil},
},
// PtrHeadFloat32ZeroMultiFields // PtrHeadFloat32ZeroMultiFields
{ {
@ -359,6 +451,13 @@ func TestCoverFloat32(t *testing.T) {
B float32 `json:"b,string"` B float32 `json:"b,string"`
}{}, }{},
}, },
{
name: "PtrHeadFloat32ZeroMultiFieldsStringOmitEmpty",
data: &struct {
A float32 `json:"a,string,omitempty"`
B float32 `json:"b,string,omitempty"`
}{},
},
// PtrHeadFloat32MultiFields // PtrHeadFloat32MultiFields
{ {
@ -382,6 +481,13 @@ func TestCoverFloat32(t *testing.T) {
B float32 `json:"b,string"` B float32 `json:"b,string"`
}{A: 1, B: 2}, }{A: 1, B: 2},
}, },
{
name: "PtrHeadFloat32MultiFieldsStringOmitEmpty",
data: &struct {
A float32 `json:"a,string,omitempty"`
B float32 `json:"b,string,omitempty"`
}{A: 1, B: 2},
},
// PtrHeadFloat32PtrMultiFields // PtrHeadFloat32PtrMultiFields
{ {
@ -405,6 +511,13 @@ func TestCoverFloat32(t *testing.T) {
B *float32 `json:"b,string"` B *float32 `json:"b,string"`
}{A: float32ptr(1), B: float32ptr(2)}, }{A: float32ptr(1), B: float32ptr(2)},
}, },
{
name: "PtrHeadFloat32PtrMultiFieldsStringOmitEmpty",
data: &struct {
A *float32 `json:"a,string,omitempty"`
B *float32 `json:"b,string,omitempty"`
}{A: float32ptr(1), B: float32ptr(2)},
},
// PtrHeadFloat32PtrNilMultiFields // PtrHeadFloat32PtrNilMultiFields
{ {
@ -428,6 +541,13 @@ func TestCoverFloat32(t *testing.T) {
B *float32 `json:"b,string"` B *float32 `json:"b,string"`
}{A: nil, B: nil}, }{A: nil, B: nil},
}, },
{
name: "PtrHeadFloat32PtrNilMultiFieldsStringOmitEmpty",
data: &struct {
A *float32 `json:"a,string,omitempty"`
B *float32 `json:"b,string,omitempty"`
}{A: nil, B: nil},
},
// PtrHeadFloat32NilMultiFields // PtrHeadFloat32NilMultiFields
{ {
@ -451,6 +571,13 @@ func TestCoverFloat32(t *testing.T) {
B *float32 `json:"b,string"` B *float32 `json:"b,string"`
})(nil), })(nil),
}, },
{
name: "PtrHeadFloat32NilMultiFieldsStringOmitEmpty",
data: (*struct {
A *float32 `json:"a,string,omitempty"`
B *float32 `json:"b,string,omitempty"`
})(nil),
},
// HeadFloat32ZeroNotRoot // HeadFloat32ZeroNotRoot
{ {
@ -477,6 +604,14 @@ func TestCoverFloat32(t *testing.T) {
} }
}{}, }{},
}, },
{
name: "HeadFloat32ZeroNotRootStringOmitEmpty",
data: struct {
A struct {
A float32 `json:"a,string,omitempty"`
}
}{},
},
// HeadFloat32NotRoot // HeadFloat32NotRoot
{ {
@ -509,6 +644,16 @@ func TestCoverFloat32(t *testing.T) {
A float32 `json:"a,string"` A float32 `json:"a,string"`
}{A: 1}}, }{A: 1}},
}, },
{
name: "HeadFloat32NotRootStringOmitEmpty",
data: struct {
A struct {
A float32 `json:"a,string,omitempty"`
}
}{A: struct {
A float32 `json:"a,string,omitempty"`
}{A: 1}},
},
// HeadFloat32PtrNotRoot // HeadFloat32PtrNotRoot
{ {
@ -541,6 +686,16 @@ func TestCoverFloat32(t *testing.T) {
A *float32 `json:"a,string"` A *float32 `json:"a,string"`
}{float32ptr(1)}}, }{float32ptr(1)}},
}, },
{
name: "HeadFloat32PtrNotRootStringOmitEmpty",
data: struct {
A struct {
A *float32 `json:"a,string,omitempty"`
}
}{A: struct {
A *float32 `json:"a,string,omitempty"`
}{float32ptr(1)}},
},
// HeadFloat32PtrNilNotRoot // HeadFloat32PtrNilNotRoot
{ {
@ -567,6 +722,14 @@ func TestCoverFloat32(t *testing.T) {
} }
}{}, }{},
}, },
{
name: "HeadFloat32PtrNilNotRootStringOmitEmpty",
data: struct {
A struct {
A *float32 `json:"a,string,omitempty"`
}
}{},
},
// PtrHeadFloat32ZeroNotRoot // PtrHeadFloat32ZeroNotRoot
{ {
@ -599,6 +762,16 @@ func TestCoverFloat32(t *testing.T) {
A float32 `json:"a,string"` A float32 `json:"a,string"`
})}, })},
}, },
{
name: "PtrHeadFloat32ZeroNotRootStringOmitEmpty",
data: struct {
A *struct {
A float32 `json:"a,string,omitempty"`
}
}{A: new(struct {
A float32 `json:"a,string,omitempty"`
})},
},
// PtrHeadFloat32NotRoot // PtrHeadFloat32NotRoot
{ {
@ -631,6 +804,16 @@ func TestCoverFloat32(t *testing.T) {
A float32 `json:"a,string"` A float32 `json:"a,string"`
}{A: 1})}, }{A: 1})},
}, },
{
name: "PtrHeadFloat32NotRootStringOmitEmpty",
data: struct {
A *struct {
A float32 `json:"a,string,omitempty"`
}
}{A: &(struct {
A float32 `json:"a,string,omitempty"`
}{A: 1})},
},
// PtrHeadFloat32PtrNotRoot // PtrHeadFloat32PtrNotRoot
{ {
@ -663,6 +846,16 @@ func TestCoverFloat32(t *testing.T) {
A *float32 `json:"a,string"` A *float32 `json:"a,string"`
}{A: float32ptr(1)})}, }{A: float32ptr(1)})},
}, },
{
name: "PtrHeadFloat32PtrNotRootStringOmitEmpty",
data: struct {
A *struct {
A *float32 `json:"a,string,omitempty"`
}
}{A: &(struct {
A *float32 `json:"a,string,omitempty"`
}{A: float32ptr(1)})},
},
// PtrHeadFloat32PtrNilNotRoot // PtrHeadFloat32PtrNilNotRoot
{ {
@ -695,6 +888,16 @@ func TestCoverFloat32(t *testing.T) {
A *float32 `json:"a,string"` A *float32 `json:"a,string"`
}{A: nil})}, }{A: nil})},
}, },
{
name: "PtrHeadFloat32PtrNilNotRootStringOmitEmpty",
data: struct {
A *struct {
A *float32 `json:"a,string,omitempty"`
}
}{A: &(struct {
A *float32 `json:"a,string,omitempty"`
}{A: nil})},
},
// PtrHeadFloat32NilNotRoot // PtrHeadFloat32NilNotRoot
{ {
@ -721,6 +924,14 @@ func TestCoverFloat32(t *testing.T) {
} `json:",string"` } `json:",string"`
}{A: nil}, }{A: nil},
}, },
{
name: "PtrHeadFloat32NilNotRootStringOmitEmpty",
data: struct {
A *struct {
A *float32 `json:"a,string,omitempty"`
} `json:",string,omitempty"`
}{A: nil},
},
// HeadFloat32ZeroMultiFieldsNotRoot // HeadFloat32ZeroMultiFieldsNotRoot
{ {
@ -756,6 +967,17 @@ func TestCoverFloat32(t *testing.T) {
} }
}{}, }{},
}, },
{
name: "HeadFloat32ZeroMultiFieldsNotRootStringOmitEmpty",
data: struct {
A struct {
A float32 `json:"a,string,omitempty"`
}
B struct {
B float32 `json:"b,string,omitempty"`
}
}{},
},
// HeadFloat32MultiFieldsNotRoot // HeadFloat32MultiFieldsNotRoot
{ {
@ -803,6 +1025,21 @@ func TestCoverFloat32(t *testing.T) {
B float32 `json:"b,string"` B float32 `json:"b,string"`
}{B: 2}}, }{B: 2}},
}, },
{
name: "HeadFloat32MultiFieldsNotRootStringOmitEmpty",
data: struct {
A struct {
A float32 `json:"a,string,omitempty"`
}
B struct {
B float32 `json:"b,string,omitempty"`
}
}{A: struct {
A float32 `json:"a,string,omitempty"`
}{A: 1}, B: struct {
B float32 `json:"b,string,omitempty"`
}{B: 2}},
},
// HeadFloat32PtrMultiFieldsNotRoot // HeadFloat32PtrMultiFieldsNotRoot
{ {
@ -850,6 +1087,21 @@ func TestCoverFloat32(t *testing.T) {
B *float32 `json:"b,string"` B *float32 `json:"b,string"`
}{B: float32ptr(2)}}, }{B: float32ptr(2)}},
}, },
{
name: "HeadFloat32PtrMultiFieldsNotRootStringOmitEmpty",
data: struct {
A struct {
A *float32 `json:"a,string,omitempty"`
}
B struct {
B *float32 `json:"b,string,omitempty"`
}
}{A: struct {
A *float32 `json:"a,string,omitempty"`
}{A: float32ptr(1)}, B: struct {
B *float32 `json:"b,string,omitempty"`
}{B: float32ptr(2)}},
},
// HeadFloat32PtrNilMultiFieldsNotRoot // HeadFloat32PtrNilMultiFieldsNotRoot
{ {
@ -897,6 +1149,21 @@ func TestCoverFloat32(t *testing.T) {
B *float32 `json:"b,string"` B *float32 `json:"b,string"`
}{B: nil}}, }{B: nil}},
}, },
{
name: "HeadFloat32PtrNilMultiFieldsNotRootStringOmitEmpty",
data: struct {
A struct {
A *float32 `json:"a,string,omitempty"`
}
B struct {
B *float32 `json:"b,string,omitempty"`
}
}{A: struct {
A *float32 `json:"a,string,omitempty"`
}{A: nil}, B: struct {
B *float32 `json:"b,string,omitempty"`
}{B: nil}},
},
// PtrHeadFloat32ZeroMultiFieldsNotRoot // PtrHeadFloat32ZeroMultiFieldsNotRoot
{ {
@ -932,6 +1199,17 @@ func TestCoverFloat32(t *testing.T) {
} }
}{}, }{},
}, },
{
name: "PtrHeadFloat32ZeroMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A struct {
A float32 `json:"a,string,omitempty"`
}
B struct {
B float32 `json:"b,string,omitempty"`
}
}{},
},
// PtrHeadFloat32MultiFieldsNotRoot // PtrHeadFloat32MultiFieldsNotRoot
{ {
@ -979,6 +1257,21 @@ func TestCoverFloat32(t *testing.T) {
B float32 `json:"b,string"` B float32 `json:"b,string"`
}{B: 2}}, }{B: 2}},
}, },
{
name: "PtrHeadFloat32MultiFieldsNotRootStringOmitEmpty",
data: &struct {
A struct {
A float32 `json:"a,string,omitempty"`
}
B struct {
B float32 `json:"b,string,omitempty"`
}
}{A: struct {
A float32 `json:"a,string,omitempty"`
}{A: 1}, B: struct {
B float32 `json:"b,string,omitempty"`
}{B: 2}},
},
// PtrHeadFloat32PtrMultiFieldsNotRoot // PtrHeadFloat32PtrMultiFieldsNotRoot
{ {
@ -1026,6 +1319,21 @@ func TestCoverFloat32(t *testing.T) {
B *float32 `json:"b,string"` B *float32 `json:"b,string"`
}{B: float32ptr(2)})}, }{B: float32ptr(2)})},
}, },
{
name: "PtrHeadFloat32PtrMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A *float32 `json:"a,string,omitempty"`
}
B *struct {
B *float32 `json:"b,string,omitempty"`
}
}{A: &(struct {
A *float32 `json:"a,string,omitempty"`
}{A: float32ptr(1)}), B: &(struct {
B *float32 `json:"b,string,omitempty"`
}{B: float32ptr(2)})},
},
// PtrHeadFloat32PtrNilMultiFieldsNotRoot // PtrHeadFloat32PtrNilMultiFieldsNotRoot
{ {
@ -1061,6 +1369,17 @@ func TestCoverFloat32(t *testing.T) {
} `json:",string"` } `json:",string"`
}{A: nil, B: nil}, }{A: nil, B: nil},
}, },
{
name: "PtrHeadFloat32PtrNilMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A *float32 `json:"a,string,omitempty"`
} `json:",string,omitempty"`
B *struct {
B *float32 `json:"b,string,omitempty"`
} `json:",string,omitempty"`
}{A: nil, B: nil},
},
// PtrHeadFloat32NilMultiFieldsNotRoot // PtrHeadFloat32NilMultiFieldsNotRoot
{ {
@ -1096,6 +1415,17 @@ func TestCoverFloat32(t *testing.T) {
} }
})(nil), })(nil),
}, },
{
name: "PtrHeadFloat32NilMultiFieldsNotRootStringOmitEmpty",
data: (*struct {
A *struct {
A *float32 `json:"a,string,omitempty"`
}
B *struct {
B *float32 `json:"b,string,omitempty"`
}
})(nil),
},
// PtrHeadFloat32DoubleMultiFieldsNotRoot // PtrHeadFloat32DoubleMultiFieldsNotRoot
{ {
@ -1155,6 +1485,25 @@ func TestCoverFloat32(t *testing.T) {
B float32 `json:"b,string"` B float32 `json:"b,string"`
}{A: 3, B: 4})}, }{A: 3, B: 4})},
}, },
{
name: "PtrHeadFloat32DoubleMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A float32 `json:"a,string,omitempty"`
B float32 `json:"b,string,omitempty"`
}
B *struct {
A float32 `json:"a,string,omitempty"`
B float32 `json:"b,string,omitempty"`
}
}{A: &(struct {
A float32 `json:"a,string,omitempty"`
B float32 `json:"b,string,omitempty"`
}{A: 1, B: 2}), B: &(struct {
A float32 `json:"a,string,omitempty"`
B float32 `json:"b,string,omitempty"`
}{A: 3, B: 4})},
},
// PtrHeadFloat32NilDoubleMultiFieldsNotRoot // PtrHeadFloat32NilDoubleMultiFieldsNotRoot
{ {
@ -1196,6 +1545,19 @@ func TestCoverFloat32(t *testing.T) {
} }
}{A: nil, B: nil}, }{A: nil, B: nil},
}, },
{
name: "PtrHeadFloat32NilDoubleMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A float32 `json:"a,string,omitempty"`
B float32 `json:"b,string,omitempty"`
}
B *struct {
A float32 `json:"a,string,omitempty"`
B float32 `json:"b,string,omitempty"`
}
}{A: nil, B: nil},
},
// PtrHeadFloat32NilDoubleMultiFieldsNotRoot // PtrHeadFloat32NilDoubleMultiFieldsNotRoot
{ {
@ -1237,6 +1599,19 @@ func TestCoverFloat32(t *testing.T) {
} }
})(nil), })(nil),
}, },
{
name: "PtrHeadFloat32NilDoubleMultiFieldsNotRootStringOmitEmpty",
data: (*struct {
A *struct {
A float32 `json:"a,string,omitempty"`
B float32 `json:"b,string,omitempty"`
}
B *struct {
A float32 `json:"a,string,omitempty"`
B float32 `json:"b,string,omitempty"`
}
})(nil),
},
// PtrHeadFloat32PtrDoubleMultiFieldsNotRoot // PtrHeadFloat32PtrDoubleMultiFieldsNotRoot
{ {
@ -1296,6 +1671,25 @@ func TestCoverFloat32(t *testing.T) {
B *float32 `json:"b,string"` B *float32 `json:"b,string"`
}{A: float32ptr(3), B: float32ptr(4)})}, }{A: float32ptr(3), B: float32ptr(4)})},
}, },
{
name: "PtrHeadFloat32PtrDoubleMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A *float32 `json:"a,string,omitempty"`
B *float32 `json:"b,string,omitempty"`
}
B *struct {
A *float32 `json:"a,string,omitempty"`
B *float32 `json:"b,string,omitempty"`
}
}{A: &(struct {
A *float32 `json:"a,string,omitempty"`
B *float32 `json:"b,string,omitempty"`
}{A: float32ptr(1), B: float32ptr(2)}), B: &(struct {
A *float32 `json:"a,string,omitempty"`
B *float32 `json:"b,string,omitempty"`
}{A: float32ptr(3), B: float32ptr(4)})},
},
// PtrHeadFloat32PtrNilDoubleMultiFieldsNotRoot // PtrHeadFloat32PtrNilDoubleMultiFieldsNotRoot
{ {
@ -1337,6 +1731,19 @@ func TestCoverFloat32(t *testing.T) {
} }
}{A: nil, B: nil}, }{A: nil, B: nil},
}, },
{
name: "PtrHeadFloat32PtrNilDoubleMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A *float32 `json:"a,string,omitempty"`
B *float32 `json:"b,string,omitempty"`
}
B *struct {
A *float32 `json:"a,string,omitempty"`
B *float32 `json:"b,string,omitempty"`
}
}{A: nil, B: nil},
},
// PtrHeadFloat32PtrNilDoubleMultiFieldsNotRoot // PtrHeadFloat32PtrNilDoubleMultiFieldsNotRoot
{ {
@ -1378,6 +1785,19 @@ func TestCoverFloat32(t *testing.T) {
} }
})(nil), })(nil),
}, },
{
name: "PtrHeadFloat32PtrNilDoubleMultiFieldsNotRootStringOmitEmpty",
data: (*struct {
A *struct {
A *float32 `json:"a,string,omitempty"`
B *float32 `json:"b,string,omitempty"`
}
B *struct {
A *float32 `json:"a,string,omitempty"`
B *float32 `json:"b,string,omitempty"`
}
})(nil),
},
// AnonymousHeadFloat32 // AnonymousHeadFloat32
{ {
@ -1410,6 +1830,16 @@ func TestCoverFloat32(t *testing.T) {
B: 2, B: 2,
}, },
}, },
{
name: "AnonymousHeadFloat32StringOmitEmpty",
data: struct {
structFloat32StringOmitEmpty
B float32 `json:"b,string,omitempty"`
}{
structFloat32StringOmitEmpty: structFloat32StringOmitEmpty{A: 1},
B: 2,
},
},
// PtrAnonymousHeadFloat32 // PtrAnonymousHeadFloat32
{ {
@ -1442,6 +1872,16 @@ func TestCoverFloat32(t *testing.T) {
B: 2, B: 2,
}, },
}, },
{
name: "PtrAnonymousHeadFloat32StringOmitEmpty",
data: struct {
*structFloat32StringOmitEmpty
B float32 `json:"b,string,omitempty"`
}{
structFloat32StringOmitEmpty: &structFloat32StringOmitEmpty{A: 1},
B: 2,
},
},
// NilPtrAnonymousHeadFloat32 // NilPtrAnonymousHeadFloat32
{ {
@ -1474,6 +1914,16 @@ func TestCoverFloat32(t *testing.T) {
B: 2, B: 2,
}, },
}, },
{
name: "NilPtrAnonymousHeadFloat32StringOmitEmpty",
data: struct {
*structFloat32StringOmitEmpty
B float32 `json:"b,string,omitempty"`
}{
structFloat32StringOmitEmpty: nil,
B: 2,
},
},
// AnonymousHeadFloat32Ptr // AnonymousHeadFloat32Ptr
{ {
@ -1506,6 +1956,16 @@ func TestCoverFloat32(t *testing.T) {
B: float32ptr(2), B: float32ptr(2),
}, },
}, },
{
name: "AnonymousHeadFloat32PtrStringOmitEmpty",
data: struct {
structFloat32PtrStringOmitEmpty
B *float32 `json:"b,string,omitempty"`
}{
structFloat32PtrStringOmitEmpty: structFloat32PtrStringOmitEmpty{A: float32ptr(1)},
B: float32ptr(2),
},
},
// AnonymousHeadFloat32PtrNil // AnonymousHeadFloat32PtrNil
{ {
@ -1538,6 +1998,16 @@ func TestCoverFloat32(t *testing.T) {
B: float32ptr(2), B: float32ptr(2),
}, },
}, },
{
name: "AnonymousHeadFloat32PtrNilStringOmitEmpty",
data: struct {
structFloat32PtrStringOmitEmpty
B *float32 `json:"b,string,omitempty"`
}{
structFloat32PtrStringOmitEmpty: structFloat32PtrStringOmitEmpty{A: nil},
B: float32ptr(2),
},
},
// PtrAnonymousHeadFloat32Ptr // PtrAnonymousHeadFloat32Ptr
{ {
@ -1570,6 +2040,16 @@ func TestCoverFloat32(t *testing.T) {
B: float32ptr(2), B: float32ptr(2),
}, },
}, },
{
name: "PtrAnonymousHeadFloat32PtrStringOmitEmpty",
data: struct {
*structFloat32PtrStringOmitEmpty
B *float32 `json:"b,string,omitempty"`
}{
structFloat32PtrStringOmitEmpty: &structFloat32PtrStringOmitEmpty{A: float32ptr(1)},
B: float32ptr(2),
},
},
// NilPtrAnonymousHeadFloat32Ptr // NilPtrAnonymousHeadFloat32Ptr
{ {
@ -1602,6 +2082,16 @@ func TestCoverFloat32(t *testing.T) {
B: float32ptr(2), B: float32ptr(2),
}, },
}, },
{
name: "NilPtrAnonymousHeadFloat32PtrStringOmitEmpty",
data: struct {
*structFloat32PtrStringOmitEmpty
B *float32 `json:"b,string,omitempty"`
}{
structFloat32PtrStringOmitEmpty: nil,
B: float32ptr(2),
},
},
// AnonymousHeadFloat32Only // AnonymousHeadFloat32Only
{ {
@ -1628,6 +2118,14 @@ func TestCoverFloat32(t *testing.T) {
structFloat32String: structFloat32String{A: 1}, structFloat32String: structFloat32String{A: 1},
}, },
}, },
{
name: "AnonymousHeadFloat32OnlyStringOmitEmpty",
data: struct {
structFloat32StringOmitEmpty
}{
structFloat32StringOmitEmpty: structFloat32StringOmitEmpty{A: 1},
},
},
// PtrAnonymousHeadFloat32Only // PtrAnonymousHeadFloat32Only
{ {
@ -1654,6 +2152,14 @@ func TestCoverFloat32(t *testing.T) {
structFloat32String: &structFloat32String{A: 1}, structFloat32String: &structFloat32String{A: 1},
}, },
}, },
{
name: "PtrAnonymousHeadFloat32OnlyStringOmitEmpty",
data: struct {
*structFloat32StringOmitEmpty
}{
structFloat32StringOmitEmpty: &structFloat32StringOmitEmpty{A: 1},
},
},
// NilPtrAnonymousHeadFloat32Only // NilPtrAnonymousHeadFloat32Only
{ {
@ -1680,6 +2186,14 @@ func TestCoverFloat32(t *testing.T) {
structFloat32String: nil, structFloat32String: nil,
}, },
}, },
{
name: "NilPtrAnonymousHeadFloat32OnlyStringOmitEmpty",
data: struct {
*structFloat32StringOmitEmpty
}{
structFloat32StringOmitEmpty: nil,
},
},
// AnonymousHeadFloat32PtrOnly // AnonymousHeadFloat32PtrOnly
{ {
@ -1706,6 +2220,14 @@ func TestCoverFloat32(t *testing.T) {
structFloat32PtrString: structFloat32PtrString{A: float32ptr(1)}, structFloat32PtrString: structFloat32PtrString{A: float32ptr(1)},
}, },
}, },
{
name: "AnonymousHeadFloat32PtrOnlyStringOmitEmpty",
data: struct {
structFloat32PtrStringOmitEmpty
}{
structFloat32PtrStringOmitEmpty: structFloat32PtrStringOmitEmpty{A: float32ptr(1)},
},
},
// AnonymousHeadFloat32PtrNilOnly // AnonymousHeadFloat32PtrNilOnly
{ {
@ -1732,6 +2254,14 @@ func TestCoverFloat32(t *testing.T) {
structFloat32PtrString: structFloat32PtrString{A: nil}, structFloat32PtrString: structFloat32PtrString{A: nil},
}, },
}, },
{
name: "AnonymousHeadFloat32PtrNilOnlyStringOmitEmpty",
data: struct {
structFloat32PtrStringOmitEmpty
}{
structFloat32PtrStringOmitEmpty: structFloat32PtrStringOmitEmpty{A: nil},
},
},
// PtrAnonymousHeadFloat32PtrOnly // PtrAnonymousHeadFloat32PtrOnly
{ {
@ -1758,6 +2288,14 @@ func TestCoverFloat32(t *testing.T) {
structFloat32PtrString: &structFloat32PtrString{A: float32ptr(1)}, structFloat32PtrString: &structFloat32PtrString{A: float32ptr(1)},
}, },
}, },
{
name: "PtrAnonymousHeadFloat32PtrOnlyStringOmitEmpty",
data: struct {
*structFloat32PtrStringOmitEmpty
}{
structFloat32PtrStringOmitEmpty: &structFloat32PtrStringOmitEmpty{A: float32ptr(1)},
},
},
// NilPtrAnonymousHeadFloat32PtrOnly // NilPtrAnonymousHeadFloat32PtrOnly
{ {
@ -1784,6 +2322,14 @@ func TestCoverFloat32(t *testing.T) {
structFloat32PtrString: nil, structFloat32PtrString: nil,
}, },
}, },
{
name: "NilPtrAnonymousHeadFloat32PtrOnlyStringOmitEmpty",
data: struct {
*structFloat32PtrStringOmitEmpty
}{
structFloat32PtrStringOmitEmpty: nil,
},
},
} }
for _, test := range tests { for _, test := range tests {
for _, indent := range []bool{true, false} { for _, indent := range []bool{true, false} {