cmd/atomdns/handlers/sign/dnssec_test.go
raw| 1 | package sign |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | "time" |
| 6 | ) |
| 7 | |
| 8 | func TestExpired(t *testing.T) { |
| 9 | now := time.Now() |
| 10 | testcases := []struct { |
| 11 | expire time.Time |
| 12 | days int |
| 13 | }{ |
| 14 | {now.Add(5 * Day), 5}, |
| 15 | {now.Add(-9 * Day), -9}, |
| 16 | } |
| 17 | for i, tc := range testcases { |
| 18 | days := Expired(now, tc.expire) |
| 19 | if days != tc.days { |
| 20 | t.Errorf("test %d, expected %d, got %d", i, tc.days, days) |
| 21 | } |
| 22 | } |
| 23 | } |