Skip to content

Commit

Permalink
Test the added functions
Browse files Browse the repository at this point in the history
  • Loading branch information
k2tzumi committed Jan 2, 2024
1 parent 71bfa2a commit ba6759f
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions report/custom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"path/filepath"
"testing"

"github.com/google/go-cmp/cmp"
"github.com/tenntenn/golden"
)

Expand Down Expand Up @@ -343,3 +344,40 @@ func TestDiffCustomMetricSetMetadataTable(t *testing.T) {
})
}
}

func TestConvertFormat(t *testing.T) {
tests := []struct {
n interface{}
want string
}{
{
int(10),
"10",
},
{
int32(3200),
"3,200",
},
{
float32(10.0),
"10",
},
{
float32(1000.1),
"1,000.1",
},
{
int(1000),
"1,000",
},
}

for i, tt := range tests {
t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
got := convertFormat(tt.n)
if diff := cmp.Diff(got, tt.want, nil); diff != "" {
t.Error(diff)
}
})
}
}

0 comments on commit ba6759f

Please sign in to comment.