Skip to content

Commit

Permalink
Add execTime tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaScorpion committed Dec 8, 2023
1 parent bfec874 commit bba3aba
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ jobs:
with:
go-version: '1.21'
- run: test -z $(gofmt -l .)
- run: go test ./...
- run: go build ./cmd/gokart.go
18 changes: 18 additions & 0 deletions internal/execTime_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package internal

import "testing"

func TestFormatMinutesSeconds(t *testing.T) {
cases := map[float64]string{
3.14: "3.1s",
60: "1m 0.0s",
3712.5: "61m 52.5s",
}

for in, expected := range cases {
actual := formatMinutesSeconds(in)
if actual != expected {
t.Errorf("formatMinutesSeconds(%f) = %s, expected %s", in, actual, expected)
}
}
}

0 comments on commit bba3aba

Please sign in to comment.