-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparse_test.go
More file actions
38 lines (35 loc) · 921 Bytes
/
parse_test.go
File metadata and controls
38 lines (35 loc) · 921 Bytes
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
// Copyright 2025. Silvano DAL ZILIO. All rights reserved.
// Use of this source code is governed by the AGPL license
// that can be found in the LICENSE file.
package nets
import (
"os"
"testing"
)
func TestParse(t *testing.T) {
tables := []struct {
file string
pl, tr int
}{
{"abp.net", 12, 16},
{"demo.net", 4, 7},
{"ifip.net", 5, 5},
{"sokoban_3.net", 410, 452},
}
for _, v := range tables {
file, err := os.Open("testdata/" + v.file)
if err != nil {
t.Errorf("Error opening file %s; %s", v.file, err)
}
expected, err := Parse(file)
if err != nil {
t.Errorf("Error parsing file %s; %s", v.file, err)
}
if pl := len(expected.Pl); pl != v.pl {
t.Errorf("Wrong number of places in %s, expected %d, actual %d", v.file, v.pl, pl)
}
if tr := len(expected.Tr); tr != v.tr {
t.Errorf("Wrong number of transitions in %s, expected %d, actual %d", v.file, v.tr, tr)
}
}
}