Skip to content

Commit 736d81c

Browse files
committed
spiral-matrix: Implement tests
1 parent a06e645 commit 736d81c

File tree

1 file changed

+35
-50
lines changed

1 file changed

+35
-50
lines changed
Lines changed: 35 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,43 @@
11
(ns spiral-matrix-test
22
(:require [clojure.test :refer [deftest is testing]]
3-
[spiral-matrix :refer [spiral]]))
3+
spiral-matrix))
44

5-
(deftest spiral-matrix-of-0
6-
(testing "spiral matrix of 0"
7-
(is (= (spiral 0)
8-
'()))))
5+
(deftest test-8f584201-b446-4bc9-b132-811c8edd9040
6+
(testing "Empty spiral"
7+
(is (= []
8+
(spiral-matrix/spiral 0)))))
99

10-
(deftest spiral-matrix-of-1
11-
(testing "spiral matrix of 1"
12-
(is (= (spiral 1)
13-
'((1))))))
10+
(deftest test-e40ae5f3-e2c9-4639-8116-8a119d632ab2
11+
(testing "Trivial spiral"
12+
(is (= [[1]]
13+
(spiral-matrix/spiral 1)))))
1414

15-
(deftest spiral-matrix-of-2
16-
(testing "spiral matrix of 2"
17-
(is (= (spiral 2)
18-
'((1 2)
19-
(4 3))))))
15+
(deftest test-cf05e42d-eb78-4098-a36e-cdaf0991bc48
16+
(testing "Spiral of size 2"
17+
(is (= [[1 2]
18+
[4 3]]
19+
(spiral-matrix/spiral 2)))))
2020

21-
(deftest spiral-matrix-of-3
22-
(testing "spiral matrix of 3"
23-
(is (= (spiral 3)
24-
'((1 2 3)
25-
(8 9 4)
26-
(7 6 5))))))
21+
(deftest test-1c475667-c896-4c23-82e2-e033929de939
22+
(testing "Spiral of size 3"
23+
(is (= [[1 2 3]
24+
[8 9 4]
25+
[7 6 5]]
26+
(spiral-matrix/spiral 3)))))
2727

28-
(deftest spiral-matrix-of-4
29-
(testing "spiral matrix of 4"
30-
(is (= (spiral 4)
31-
'((1 2 3 4)
32-
(12 13 14 5)
33-
(11 16 15 6)
34-
(10 9 8 7))))))
28+
(deftest test-05ccbc48-d891-44f5-9137-f4ce462a759d
29+
(testing "Spiral of size 4"
30+
(is (= [[1 2 3 4]
31+
[12 13 14 5]
32+
[11 16 15 6]
33+
[10 9 8 7]]
34+
(spiral-matrix/spiral 4)))))
3535

36-
(deftest spiral-matrix-of-20
37-
(testing "spiral matrix of 20"
38-
(is (= (spiral 20)
39-
'((1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20)
40-
(76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 21)
41-
(75 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 95 22)
42-
(74 143 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 161 96 23)
43-
(73 142 203 256 257 258 259 260 261 262 263 264 265 266 267 268 219 162 97 24)
44-
(72 141 202 255 300 301 302 303 304 305 306 307 308 309 310 269 220 163 98 25)
45-
(71 140 201 254 299 336 337 338 339 340 341 342 343 344 311 270 221 164 99 26)
46-
(70 139 200 253 298 335 364 365 366 367 368 369 370 345 312 271 222 165 100 27)
47-
(69 138 199 252 297 334 363 384 385 386 387 388 371 346 313 272 223 166 101 28)
48-
(68 137 198 251 296 333 362 383 396 397 398 389 372 347 314 273 224 167 102 29)
49-
(67 136 197 250 295 332 361 382 395 400 399 390 373 348 315 274 225 168 103 30)
50-
(66 135 196 249 294 331 360 381 394 393 392 391 374 349 316 275 226 169 104 31)
51-
(65 134 195 248 293 330 359 380 379 378 377 376 375 350 317 276 227 170 105 32)
52-
(64 133 194 247 292 329 358 357 356 355 354 353 352 351 318 277 228 171 106 33)
53-
(63 132 193 246 291 328 327 326 325 324 323 322 321 320 319 278 229 172 107 34)
54-
(62 131 192 245 290 289 288 287 286 285 284 283 282 281 280 279 230 173 108 35)
55-
(61 130 191 244 243 242 241 240 239 238 237 236 235 234 233 232 231 174 109 36)
56-
(60 129 190 189 188 187 186 185 184 183 182 181 180 179 178 177 176 175 110 37)
57-
(59 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 38)
58-
(58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39))))))
36+
(deftest test-f4d2165b-1738-4e0c-bed0-c459045ae50d
37+
(testing "Spiral of size 5"
38+
(is (= [[1 2 3 4 5]
39+
[16 17 18 19 6]
40+
[15 24 25 20 7]
41+
[14 23 22 21 8]
42+
[13 12 11 10 9]]
43+
(spiral-matrix/spiral 5)))))

0 commit comments

Comments
 (0)