25 lines
323 B
Go
25 lines
323 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
func TestScanFile(t *testing.T) {
|
|
inFile := "input.txt"
|
|
want := 4361
|
|
|
|
f, err := os.Open(inFile)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
got, err := ScanFile(f)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
if got != want {
|
|
t.Errorf("ScanFile(%q) == %d, want %d", inFile, got, want)
|
|
}
|
|
} |