-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_test.go
49 lines (41 loc) · 1.18 KB
/
main_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package main
import (
"bytes"
"io"
"log"
"os"
"path/filepath"
"testing"
)
func TestSamples(t *testing.T) {
log.SetOutput(io.Discard)
WORKERS = 1
paths := try(filepath.Glob("./samples/*.txt"))("glob sample files")
for _, path := range paths {
t.Run("full:"+path, func(t *testing.T) {
prefix := path[:len(path)-len(filepath.Ext(path))]
actualPath := prefix + ".actual.out"
run(path, actualPath)
actual := try(os.ReadFile(actualPath))("read actual file")
expectedPath := prefix + ".out"
expected := try(os.ReadFile(expectedPath))("read expected file")
if !bytes.Equal(expected, actual) {
t.Errorf("expected did not match actual")
}
})
}
// BUFFER_SIZE = 150
// for _, path := range paths {
// t.Run("smallbuf:"+path, func(t *testing.T) {
// prefix := path[:len(path)-len(filepath.Ext(path))]
// actualPath := prefix + ".actual.out"
// run(path, actualPath)
// actual := try(os.ReadFile(actualPath))("read actual file")
// expectedPath := prefix + ".out"
// expected := try(os.ReadFile(expectedPath))("read expected file")
// if !bytes.Equal(expected, actual) {
// t.Errorf("expected did not match actual")
// }
// })
// }
}