Skip to content

Commit 23cb0ac

Browse files
committed
Fix ColumnMap tests.
1 parent 60cb6c7 commit 23cb0ac

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

tests/test_column_map.nim

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ suite "ColumnMap test suite":
3535

3636
check:
3737
$ColumnMap.init(columns) ==
38-
"[" & $ numbers.mapIt($it).join(", ") & "]"
38+
"[" & $ numbers.mapIt($it).join(",") & "]"
3939

4040
if lastColumnSize > 0:
4141
let
@@ -50,34 +50,34 @@ suite "ColumnMap test suite":
5050

5151
check:
5252
$ColumnMap.init(columns) ==
53-
"[" & $ numbers.mapIt($it).join(", ") & "]"
53+
"[" & $ numbers.mapIt($it).join(",") & "]"
5454

5555
test "and() operation test":
5656
const TestVectors = [
5757
(
5858
[1, 2, 3, 4, 5, 6, 7, 8],
5959
[5, 6, 7, 8, 9, 10, 11, 12],
60-
"[5, 6, 7, 8]"
60+
"[5,6,7,8]"
6161
),
6262
(
6363
[56, 57, 58, 59, 60, 61, 62, 63],
6464
[60, 61, 62, 63, 64, 65, 66, 67],
65-
"[60, 61, 62, 63]"
65+
"[60,61,62,63]"
6666
),
6767
(
6868
[1, 5, 10, 15, 20, 25, 64, 65],
6969
[1, 5, 6, 7, 8, 9, 64, 65],
70-
"[1, 5, 64, 65]"
70+
"[1,5,64,65]"
7171
),
7272
(
7373
[60, 61, 62, 63, 124, 125, 126, 127],
7474
[60, 61, 62, 63, 124, 125, 126, 127],
75-
"[60, 61, 62, 63, 124, 125, 126, 127]"
75+
"[60,61,62,63,124,125,126,127]"
7676
),
7777
(
7878
[0, 1, 63, 64, 65, 93, 126, 127],
7979
[0, 2, 63, 64, 67, 94, 126, 127],
80-
"[0, 63, 64, 126, 127]"
80+
"[0,63,64,126,127]"
8181
)
8282
]
8383

@@ -95,23 +95,26 @@ suite "ColumnMap test suite":
9595
map3 = map1 and map2
9696

9797
check:
98-
map1.items().toSeq().mapIt($int(it)).join(", ") ==
99-
vector[0].mapIt($it).join(", ")
100-
map2.items().toSeq().mapIt($int(it)).join(", ") ==
101-
vector[1].mapIt($it).join(", ")
102-
"[" & map3.items().toSeq().mapIt($int(it)).join(", ") & "]" ==
98+
map1.items().toSeq().mapIt($int(it)).join(",") ==
99+
vector[0].mapIt($it).join(",")
100+
map2.items().toSeq().mapIt($int(it)).join(",") ==
101+
vector[1].mapIt($it).join(",")
102+
"[" & map3.items().toSeq().mapIt($int(it)).join(",") & "]" ==
103103
vector[2]
104104

105105
test "supernode test":
106-
for max in ((NUMBER_OF_COLUMNS div 2) + 1) ..< NUMBER_OF_COLUMNS:
106+
for max in (NUMBER_OF_COLUMNS div 2) .. NUMBER_OF_COLUMNS:
107107
var columns: seq[ColumnIndex]
108108
for i in 0 ..< max:
109109
columns.add(ColumnIndex(i))
110110
let map = ColumnMap.init(columns)
111111
check:
112-
map.items().toSeq().mapIt($int(it)).join(", ") ==
113-
columns.mapIt($it).join(", ")
114-
shortLog(map) == "[supernode]"
112+
map.items().toSeq().mapIt($int(it)).join(",") ==
113+
columns.mapIt($it).join(",")
114+
if len(map) == NUMBER_OF_COLUMNS:
115+
check shortLog(map) == "[supernode]"
116+
else:
117+
check shortLog(map) == "[" & columns.mapIt($it).join(",") & "]"
115118

116119
test "contains() test":
117120
for i in 0 ..< NUMBER_OF_COLUMNS:

0 commit comments

Comments
 (0)