17 lines
377 B
Go
17 lines
377 B
Go
package duration
|
|
|
|
import "testing"
|
|
|
|
func TestValidateBoundaries(t *testing.T) {
|
|
for _, seconds := range []int{1, 2, 30, 45, 1200, 1799, 1800} {
|
|
if err := Validate(seconds); err != nil {
|
|
t.Fatalf("%d rejected: %v", seconds, err)
|
|
}
|
|
}
|
|
for _, seconds := range []int{-1800, -1, 0, 1801, 3600} {
|
|
if Validate(seconds) == nil {
|
|
t.Fatalf("%d accepted", seconds)
|
|
}
|
|
}
|
|
}
|