26 lines
385 B
Go
26 lines
385 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
func TestScanFile(t *testing.T) {
|
|
inFile := "input.txt"
|
|
want1 := 8
|
|
want2 := 2286
|
|
|
|
f, err := os.Open(inFile)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
got1, got2, err := ScanFile(f)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
if got1 != want1 || got2 != want2 {
|
|
t.Errorf("ScanFile(%q) == %d, %d, want %d, %d", inFile, got1, got2, want1, want2)
|
|
}
|
|
} |