Day 2a
This commit is contained in:
parent
7e3b20a8c8
commit
8b6ea615f7
3 changed files with 118 additions and 0 deletions
31
day02/day02_test.go
Normal file
31
day02/day02_test.go
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestScanFile(t *testing.T) {
|
||||
cases := []struct {
|
||||
inFile string;
|
||||
want int;
|
||||
}{
|
||||
{"input1.txt", 8},
|
||||
}
|
||||
|
||||
for _, c := range cases {
|
||||
f, err := os.Open(c.inFile)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
got, err := ScanFile(f)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if got != c.want {
|
||||
t.Errorf("ScanFile(%q) == %d, want %d", c.inFile, got, c.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue