mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-01-11 01:47:53 +08:00
ccb582b278
* Remove deprecated io/ioutil * fixup! * staticcheck and linting * revert models/provider.go * Fix imports to new style * linting
25 lines
475 B
Go
25 lines
475 B
Go
package domainnameshop
|
|
|
|
import "testing"
|
|
|
|
func TestFixTTL(t *testing.T) {
|
|
for i, test := range []struct {
|
|
given, expected uint32
|
|
}{
|
|
{1, minAllowedTTL},
|
|
{multiplierTTL*5 - 1, multiplierTTL * 4},
|
|
{maxAllowedTTL + 1, maxAllowedTTL},
|
|
{0, 60},
|
|
{59, 60},
|
|
{60, 60},
|
|
{61, 60},
|
|
{119, 60},
|
|
{120, 120},
|
|
{121, 120},
|
|
} {
|
|
found := fixTTL(test.given)
|
|
if found != test.expected {
|
|
t.Errorf("Test %d: Expected %d, but was %d", i, test.expected, found)
|
|
}
|
|
}
|
|
}
|