|
1 |
| -;;; flatten-array-test.el --- Flatten Array (exercism) -*- lexical-binding: t; -*- |
| 1 | +;;; flatten-array-test.el --- Tests for Flatten Array (exercism) -*- lexical-binding: t; -*- |
2 | 2 |
|
3 | 3 | ;;; Commentary:
|
4 | 4 |
|
|
10 | 10 |
|
11 | 11 |
|
12 | 12 | (ert-deftest empty ()
|
13 |
| - (should (equal (list-flatten '()) '()))) |
| 13 | + (should |
| 14 | + (equal |
| 15 | + (list-flatten '()) |
| 16 | + '()))) |
14 | 17 |
|
15 | 18 |
|
16 | 19 | (ert-deftest no-nesting ()
|
17 |
| - (should (equal (list-flatten '(0 1 2)) '(0 1 2)))) |
| 20 | + (should |
| 21 | + (equal |
| 22 | + (list-flatten '(0 1 2)) |
| 23 | + '(0 1 2)))) |
18 | 24 |
|
19 | 25 |
|
20 | 26 | (ert-deftest flattens-a-nested-array ()
|
21 |
| - (should (equal (list-flatten '((()))) '()))) |
| 27 | + (should |
| 28 | + (equal |
| 29 | + (list-flatten '((()))) |
| 30 | + '()))) |
22 | 31 |
|
23 | 32 |
|
24 | 33 | (ert-deftest flattens-array-with-just-integers-present ()
|
25 | 34 | (should
|
26 |
| - (equal (list-flatten '(1 (2 3 4 5 6 7) 8)) '(1 2 3 4 5 6 7 8)))) |
| 35 | + (equal |
| 36 | + (list-flatten '(1 (2 3 4 5 6 7) 8)) |
| 37 | + '(1 2 3 4 5 6 7 8)))) |
27 | 38 |
|
28 | 39 |
|
29 | 40 | (ert-deftest 5-level-nesting ()
|
|
41 | 52 |
|
42 | 53 |
|
43 | 54 | (ert-deftest null-values-are-omitted-from-the-final-result ()
|
44 |
| - (should (equal (list-flatten '(1 2 nil)) '(1 2)))) |
| 55 | + (should |
| 56 | + (equal |
| 57 | + (list-flatten '(1 2 nil)) |
| 58 | + '(1 2)))) |
45 | 59 |
|
46 | 60 |
|
47 | 61 | (ert-deftest
|
48 |
| - consecutive-null-values-at-the-front-of-the-list-are-omitted-from-the-final-result |
| 62 | + consecutive-null-values-at-the-front-of-the-array-are-omitted-from-the-final-result |
49 | 63 | ()
|
50 |
| - (should (equal (list-flatten '(nil nil 3)) '(3)))) |
| 64 | + (should |
| 65 | + (equal |
| 66 | + (list-flatten '(nil nil 3)) |
| 67 | + '(3)))) |
51 | 68 |
|
52 | 69 |
|
53 | 70 | (ert-deftest
|
54 |
| - consecutive-null-values-in-the-middle-of-the-list-are-omitted-from-the-final-result |
| 71 | + consecutive-null-values-in-the-middle-of-the-array-are-omitted-from-the-final-result |
55 | 72 | ()
|
56 |
| - (should (equal (list-flatten '(1 nil nil 4)) '(1 4)))) |
| 73 | + (should |
| 74 | + (equal |
| 75 | + (list-flatten '(1 nil nil 4)) |
| 76 | + '(1 4)))) |
57 | 77 |
|
58 | 78 |
|
59 |
| -(ert-deftest 6-level-nest-list-with-null-values () |
| 79 | +(ert-deftest 6-level-nested-array-with-null-values () |
60 | 80 | (should
|
61 | 81 | (equal
|
62 |
| - (list-flatten |
63 |
| - '(0 2 ((2 3) 8 ((100)) nil ((nil))) -2)) |
| 82 | + (list-flatten '(0 2 ((2 3) 8 ((100)) nil ((nil))) -2)) |
64 | 83 | '(0 2 2 3 8 100 -2))))
|
65 | 84 |
|
66 | 85 |
|
67 |
| -(ert-deftest all-values-in-nested-list-are-null () |
| 86 | +(ert-deftest all-values-in-nested-array-are-null () |
68 | 87 | (should
|
69 | 88 | (equal
|
70 |
| - (list-flatten '(nil (((nil))) nil nil ((nil nil) nil) nil)) '()))) |
| 89 | + (list-flatten '(nil (((nil))) nil nil ((nil nil) nil) nil)) |
| 90 | + '()))) |
71 | 91 |
|
72 | 92 |
|
73 | 93 | (provide 'flatten-array-test)
|
|
0 commit comments