Files
flancer/internal/app/rounding_test.go
jbergner 222b5d2413
Some checks failed
release-tag / release-image (push) Has been cancelled
init
2026-08-14 17:42:54 +02:00

23 lines
504 B
Go

package app
import "testing"
func TestRoundedDuration(t *testing.T) {
tests := []struct {
ms int64
min int
up bool
want int64
}{
{37 * 60_000, 15, false, 30 * 60_000},
{38 * 60_000, 15, false, 45 * 60_000},
{37 * 60_000, 15, true, 45 * 60_000},
{37 * 60_000, 1, false, 37 * 60_000},
}
for _, tt := range tests {
if got := roundedDuration(tt.ms, tt.min, tt.up); got != tt.want {
t.Errorf("roundedDuration(%d,%d,%v)=%d want %d", tt.ms, tt.min, tt.up, got, tt.want)
}
}
}