days 13,14,15

This commit is contained in:
Ben Charlton 2017-12-15 12:20:44 +00:00
parent 97a068bfc3
commit cccd9976df
4 changed files with 400 additions and 0 deletions

36
13/13_test.go Normal file
View file

@ -0,0 +1,36 @@
package main
import (
"testing"
)
var test = map[int]firewall{
0: {0, 2, 0, true},
1: {1, 1, 0, true},
4: {4, 3, 0, true},
6: {6, 3, 0, true},
}
func TestFindDelay(t *testing.T) {
test = ResetHash(test)
v := FindDelay(test)
if v != 10 {
t.Error(
"For", test,
"expected 10",
"got", v,
)
}
}
func TestRunFirewall(t *testing.T) {
test = ResetHash(test)
v, _ := RunFirewall(test, 0)
if v != 24 {
t.Error(
"For", test,
"expected 24",
"got", v,
)
}
}