From d4acefa2dda7b32522541683d8b8a84575eee5db Mon Sep 17 00:00:00 2001 From: okamsn Date: Sat, 29 Jul 2023 21:47:13 -0400 Subject: [PATCH] Convert `vconcat` tests. --- tests/tests.el | 161 ++++++++++++++++++++++++++++--------------------- 1 file changed, 91 insertions(+), 70 deletions(-) diff --git a/tests/tests.el b/tests/tests.el index c172866f..37bf9517 100644 --- a/tests/tests.el +++ b/tests/tests.el @@ -4364,76 +4364,97 @@ Using `start' and `end' in either order should give the same result." (union . unioning))) ;;;;; Vconcat -(ert-deftest vconcat () - (should (equal [1 2 3 4 5 6 7 8 9 10 11 12] - (eval (quote (loopy (list elem '([1 2 3 4 5 6] - [7 8 9 10 11 12])) - (vconcat v elem) - (finally-return v)))))) - - (should (equal [1 2 3 4 5 6 7 8 9 10 11 12] - (eval (quote (loopy (list elem '([1 2 3 4 5 6] - [7 8 9 10 11 12])) - (vconcating v elem) - (finally-return v))))))) - -(ert-deftest vconcat-destructuring () - (should (equal '([1 2 3 7 8 9] [4 5 6 10 11 12]) - (eval (quote (loopy (list elem '(([1 2 3] [4 5 6]) - ([7 8 9] [10 11 12]))) - (vconcat (v1 v2) elem) - (finally-return v1 v2)))))) - - (should (equal '([1 2 3 7 8 9] [4 5 6 10 11 12]) - (eval (quote (loopy (list elem '(([1 2 3] [4 5 6]) - ([7 8 9] [10 11 12]))) - (vconcating (v1 v2) elem) - (finally-return v1 v2))))))) - -(ert-deftest vconcat-implict () - (should (equal [1 2 3 4 5 6 7 8 9 10 11 12] - (eval (quote (loopy (list elem '([1 2 3 4 5 6] - [7 8 9 10 11 12])) - (vconcat elem)))))) - (should (equal [1 2 3 4 5 6 7 8 9 10 11 12] - (eval (quote (loopy (list elem '([1 2 3 4 5 6] - [7 8 9 10 11 12])) - (vconcating elem))))))) - -(ert-deftest vconcat-at () - (should (equal [7 8 9 10 11 12 1 2 3 4 5 6] - (eval (quote (loopy (list elem '([1 2 3 4 5 6] - [7 8 9 10 11 12])) - (vconcat v elem :at start) - (finally-return v)))))) - - (should (equal [1 2 3 4 5 6 7 8 9 10 11 12] - (eval (quote (loopy (list elem '([1 2 3 4 5 6] - [7 8 9 10 11 12])) - (vconcat v elem :at end) - (finally-return v)))))) - - (should (equal [7 8 9 10 11 12 1 2 3 4 5 6] - (eval (quote (loopy (list elem '([1 2 3 4 5 6] - [7 8 9 10 11 12])) - (vconcat elem :at start)))))) - - (should (equal [1 2 3 4 5 6 7 8 9 10 11 12] - (eval (quote (loopy (list elem '([1 2 3 4 5 6] - [7 8 9 10 11 12])) - (vconcat elem :at end)))))) - - (should (equal '([1 2 3 7 8 9] [4 5 6 10 11 12]) - (eval (quote (loopy (list elem '(([1 2 3] [4 5 6]) - ([7 8 9] [10 11 12]))) - (vconcat (v1 v2) elem :at end) - (finally-return v1 v2)))))) - - (should (equal '([7 8 9 1 2 3] [10 11 12 4 5 6]) - (eval (quote (loopy (list elem '(([1 2 3] [4 5 6]) - ([7 8 9] [10 11 12]))) - (vconcat (v1 v2) elem :at start) - (finally-return v1 v2))))))) +(loopy-deftest vconcat + :multi-body t + :result [1 2 3 4 5 6 7 8 9 10 11 12] + :body [((list elem '([1 2 3 4 5 6] + [7 8 9 10 11 12])) + (_cmd v elem) + (finally-return v)) + + ((list elem '([1 2 3 4 5 6] + [7 8 9 10 11 12])) + (_cmd elem))] + :repeat _cmd + :loopy ((_cmd . (vconcat vconcating))) + :iter-keyword ((list . listing) + (_cmd . (vconcat vconcating))) + :iter-bare ((list . listing) + (_cmd . (vconcating)))) + +(loopy-deftest vconcat-destructuring + :result '([1 2 3 7 8 9] [4 5 6 10 11 12]) + :body ((list elem '(([1 2 3] [4 5 6]) + ([7 8 9] [10 11 12]))) + (vconcat (v1 v2) elem) + (finally-return v1 v2)) + :loopy t + :iter-keyword (list vconcat) + :iter-bare ((list . listing) + (vconcat . vconcating))) + +(loopy-deftest vconcat-:at-start/beginning + :result [7 8 9 10 11 12 1 2 3 4 5 6] + :multi-body t + :body [((list elem '([1 2 3 4 5 6] + [7 8 9 10 11 12])) + (vconcat v elem :at start) + (finally-return v)) + + ((list elem '([1 2 3 4 5 6] + [7 8 9 10 11 12])) + (vconcat v elem :at beginning) + (finally-return v)) + + ((list elem '([1 2 3 4 5 6] + [7 8 9 10 11 12])) + (vconcat elem :at start)) + + ((list elem '([1 2 3 4 5 6] + [7 8 9 10 11 12])) + (vconcat elem :at beginning))] + :loopy t + :iter-keyword (list vconcat) + :iter-bare ((list . listing) + (vconcat . vconcating))) + +(loopy-deftest vconcat-:at-end + :result [1 2 3 4 5 6 7 8 9 10 11 12] + :multi-body t + :body [((list elem '([1 2 3 4 5 6] + [7 8 9 10 11 12])) + (vconcat v elem :at end) + (finally-return v)) + + ((list elem '([1 2 3 4 5 6] + [7 8 9 10 11 12])) + (vconcat elem :at end))] + :loopy t + :iter-keyword (list vconcat) + :iter-bare ((list . listing) + (vconcat . vconcating))) + +(loopy-deftest vconcat-destr-:at-start + :result '([7 8 9 1 2 3] [10 11 12 4 5 6]) + :body ((list elem '(([1 2 3] [4 5 6]) + ([7 8 9] [10 11 12]))) + (vconcat (v1 v2) elem :at start) + (finally-return v1 v2)) + :loopy t + :iter-keyword (list vconcat) + :iter-bare ((list . listing) + (vconcat . vconcating))) + +(loopy-deftest vconcat-destr-:at-end + :result '([1 2 3 7 8 9] [4 5 6 10 11 12]) + :body ((list elem '(([1 2 3] [4 5 6]) + ([7 8 9] [10 11 12]))) + (vconcat (v1 v2) elem :at end) + (finally-return v1 v2)) + :loopy t + :iter-keyword (list vconcat) + :iter-bare ((list . listing) + (vconcat . vconcating))) ;;;;; Miscellaneous ;;; Control Flow