|
|
@@ -88,28 +88,28 @@ func Test_tokenize(t *testing.T) {
|
|
88
|
88
|
|
|
89
|
89
|
func Test_reader_tossUntilNeitherOf(t *testing.T) {
|
|
90
|
90
|
var test_cases = []struct {
|
|
|
91
|
+ test_startpos uint
|
|
91
|
92
|
test_data string
|
|
92
|
93
|
test_needles string
|
|
93
|
|
- test_startpos uint
|
|
94
|
94
|
want_endpos uint
|
|
95
|
95
|
want_ok bool
|
|
96
|
96
|
}{
|
|
97
|
|
- {"", "", 0, 0, false},
|
|
98
|
|
- {"", "x", 0, 0, false},
|
|
99
|
|
- {"", "xy", 0, 0, false},
|
|
100
|
|
- {"x", "", 0, 0, false},
|
|
101
|
|
- {"x", "x", 0, 1, true},
|
|
102
|
|
- {"x", "xy", 0, 1, true},
|
|
103
|
|
- {"x", "yx", 0, 1, true},
|
|
104
|
|
- {"xa", "x", 0, 1, true},
|
|
105
|
|
- {"xa", "xy", 0, 1, true},
|
|
106
|
|
- {"xa", "yx", 0, 1, true},
|
|
107
|
|
- {"xya", "x", 0, 1, true},
|
|
108
|
|
- {"xya", "xy", 0, 2, true},
|
|
109
|
|
- {"xya", "yx", 0, 2, true},
|
|
110
|
|
- {"xxya", "x", 1, 2, true},
|
|
111
|
|
- {"xxya", "xy", 1, 3, true},
|
|
112
|
|
- {"xxya", "yx", 1, 3, true},
|
|
|
97
|
+ {0, "", "", 0, false},
|
|
|
98
|
+ {0, "", "x", 0, false},
|
|
|
99
|
+ {0, "", "xy", 0, false},
|
|
|
100
|
+ {0, "x", "", 0, false},
|
|
|
101
|
+ {0, "x", "x", 1, true},
|
|
|
102
|
+ {0, "x", "xy", 1, true},
|
|
|
103
|
+ {0, "x", "yx", 1, true},
|
|
|
104
|
+ {0, "xa", "x", 1, true},
|
|
|
105
|
+ {0, "xa", "xy", 1, true},
|
|
|
106
|
+ {0, "xa", "yx", 1, true},
|
|
|
107
|
+ {0, "xya", "x", 1, true},
|
|
|
108
|
+ {0, "xya", "xy", 2, true},
|
|
|
109
|
+ {0, "xya", "yx", 2, true},
|
|
|
110
|
+ {1, "xxya", "x", 2, true},
|
|
|
111
|
+ {1, "xxya", "xy", 3, true},
|
|
|
112
|
+ {1, "xxya", "yx", 3, true},
|
|
113
|
113
|
}
|
|
114
|
114
|
for _, tc := range test_cases {
|
|
115
|
115
|
t.Run(fmt.Sprintf("%q[%d:]-%q", tc.test_data, tc.test_startpos, tc.test_needles), func(t *testing.T) {
|