Skip to content

Commit

Permalink
test: replace redundant functions with generics
Browse files Browse the repository at this point in the history
  • Loading branch information
jszwec committed Feb 14, 2023
1 parent ddb9b0b commit 19d1a89
Show file tree
Hide file tree
Showing 4 changed files with 160 additions and 176 deletions.
32 changes: 16 additions & 16 deletions csvutil_race_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,35 @@ func TestCacheDataRaces(t *testing.T) {

v := TypeF{
Int: 1,
Pint: pint(2),
Pint: ptr(2),
Int8: 3,
Pint8: pint8(4),
Pint8: ptr[int8](4),
Int16: 5,
Pint16: pint16(6),
Pint16: ptr[int16](6),
Int32: 7,
Pint32: pint32(8),
Pint32: ptr[int32](8),
Int64: 9,
Pint64: pint64(10),
Pint64: ptr[int64](10),
UInt: 11,
Puint: puint(12),
Puint: ptr[uint](12),
Uint8: 13,
Puint8: puint8(14),
Puint8: ptr[uint8](14),
Uint16: 15,
Puint16: puint16(16),
Puint16: ptr[uint16](16),
Uint32: 17,
Puint32: puint32(18),
Puint32: ptr[uint32](18),
Uint64: 19,
Puint64: puint64(20),
Puint64: ptr[uint64](20),
Float32: 21,
Pfloat32: pfloat32(22),
Pfloat32: ptr[float32](22),
Float64: 23,
Pfloat64: pfloat64(24),
Pfloat64: ptr[float64](24),
String: "25",
PString: pstring("26"),
PString: ptr("26"),
Bool: true,
Pbool: pbool(true),
V: ppint(100),
Pv: pinterface(ppint(200)),
Pbool: ptr(true),
V: pptr(100),
Pv: ptr[any](pptr(200)),
Binary: Binary,
PBinary: &Binary,
}
Expand Down
16 changes: 8 additions & 8 deletions csvutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ func TestMarshal(t *testing.T) {
{
desc: "*int64",
expected: "csvutil: Marshal(invalid type *int64)",
v: pint64(1),
v: ptr[int64](1),
},
{
desc: "[]int64",
Expand Down Expand Up @@ -698,7 +698,7 @@ func TestHeader(t *testing.T) {
"uint",
"puint",
"uint8",
"puint8",
"ptr[uint8](",
"uint16",
"puint16",
"uint32",
Expand Down Expand Up @@ -737,7 +737,7 @@ func TestHeader(t *testing.T) {
"uint",
"puint",
"uint8",
"puint8",
"ptr[uint8](",
"uint16",
"puint16",
"uint32",
Expand Down Expand Up @@ -776,7 +776,7 @@ func TestHeader(t *testing.T) {
"uint",
"puint",
"uint8",
"puint8",
"ptr[uint8](",
"uint16",
"puint16",
"uint32",
Expand Down Expand Up @@ -841,15 +841,15 @@ func TestParity(t *testing.T) {
in := []A{
{
Int: 0,
Pint: pint(0),
Pint: ptr(0),
OmitInt: 0,
OmitPint: pint(0),
OmitPint: ptr(0),
},
{
Int: 1,
Pint: pint(1),
Pint: ptr(1),
OmitInt: 1,
OmitPint: pint(1),
OmitPint: ptr(1),
},
{
Int: 0,
Expand Down
Loading

0 comments on commit 19d1a89

Please sign in to comment.