@@ -9,8 +9,14 @@ import std/hashes
9
9
import ../ nimplex
10
10
import std/ sets
11
11
import std/ times
12
+ import std/ re
12
13
13
14
let t0 = cpuTime()
15
+
16
+ proc stripAnsiEscapeCodes(s: string ): string =
17
+ let regex = re(r " \x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K] " )
18
+ return s.replace(regex, " " )
19
+
14
20
echo " ***** CLI Tests *****"
15
21
16
22
suite " test if correct grid output is given when nimplex is run in command line with some selected configurations" :
@@ -31,7 +37,7 @@ suite "test if correct grid output is given when nimplex is run in command line
31
37
" Shape: [10, 3]" ]
32
38
check exitCode == 0
33
39
for i in 0 ..< reference.len:
34
- check outputLines[i] == reference[i]
40
+ check outputLines[i].stripAnsiEscapeCodes() == reference[i]
35
41
36
42
test " generate large integer simplex grid (FIS 9 12) and print shape to stdout" :
37
43
let
@@ -42,7 +48,7 @@ suite "test if correct grid output is given when nimplex is run in command line
42
48
" Shape: [125970, 9]" ]
43
49
check exitCode == 0
44
50
for i in 0 ..< reference.len:
45
- check outputLines[i] == reference[i]
51
+ check outputLines[i].stripAnsiEscapeCodes() == reference[i]
46
52
47
53
test " generate large internal integer simplex grid (IIS 7 12) and print shape to stdout" :
48
54
let
@@ -53,7 +59,7 @@ suite "test if correct grid output is given when nimplex is run in command line
53
59
" Shape: [462, 7]" ]
54
60
check exitCode == 0
55
61
for i in 0 ..< reference.len:
56
- check outputLines[i] == reference[i]
62
+ check outputLines[i].stripAnsiEscapeCodes() == reference[i]
57
63
58
64
test " generate small integer simplex grid (FIP 3 3) and print values to stdout" :
59
65
let
@@ -75,7 +81,7 @@ suite "test if correct grid output is given when nimplex is run in command line
75
81
]
76
82
check exitCode == 0
77
83
for i in 0 ..< reference.len:
78
- check outputLines[i] == reference[i]
84
+ check outputLines[i].stripAnsiEscapeCodes() == reference[i]
79
85
80
86
test " generate small integer internal simplex grid (IIP 3 5) and print values to stdout" :
81
87
let
@@ -93,7 +99,7 @@ suite "test if correct grid output is given when nimplex is run in command line
93
99
]
94
100
check exitCode == 0
95
101
for i in 0 ..< reference.len:
96
- check outputLines[i] == reference[i]
102
+ check outputLines[i].stripAnsiEscapeCodes() == reference[i]
97
103
98
104
test " (significant if previous failes) values themself generated for small integer internal simplex grid (IIP 3 5) corectness" :
99
105
let
@@ -161,7 +167,7 @@ suite "test if correct graph output is given when nimplex is run in command line
161
167
]
162
168
check exitCode == 0
163
169
for i in 0 ..< reference.len:
164
- check outputLines[i] == reference[i]
170
+ check outputLines[i].stripAnsiEscapeCodes() == reference[i]
165
171
166
172
test " generate medium size integer simplex graph (GIS 7 12) and print shape to stdout" :
167
173
let
@@ -174,7 +180,7 @@ suite "test if correct graph output is given when nimplex is run in command line
174
180
]
175
181
check exitCode == 0
176
182
for i in 0 ..< reference.len:
177
- check outputLines[i] == reference[i]
183
+ check outputLines[i].stripAnsiEscapeCodes() == reference[i]
178
184
179
185
test " generate small integer simplex graph (GIP 3 3), print values to stdout, and check them for corectness" :
180
186
let
@@ -199,7 +205,7 @@ suite "test if correct graph output is given when nimplex is run in command line
199
205
]
200
206
check exitCode == 0
201
207
for i in 0 ..< reference.len:
202
- check outputLines[i] == reference[i]
208
+ check outputLines[i].stripAnsiEscapeCodes() == reference[i]
203
209
204
210
test " generate small fractional simplex graph (GFS 3 3) and print shape to stdout" :
205
211
let
@@ -212,7 +218,7 @@ suite "test if correct graph output is given when nimplex is run in command line
212
218
]
213
219
check exitCode == 0
214
220
for i in 0 ..< reference.len:
215
- check outputLines[i] == reference[i]
221
+ check outputLines[i].stripAnsiEscapeCodes() == reference[i]
216
222
217
223
test " generate small fractional simplex graph (GFP 3 3), print values to stdout, and check them for node corectness" :
218
224
let
0 commit comments