diff options
-rw-r--r-- | test-suite/tests/arrays.test | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test-suite/tests/arrays.test b/test-suite/tests/arrays.test index 135392797..c3a28c5ec 100644 --- a/test-suite/tests/arrays.test +++ b/test-suite/tests/arrays.test @@ -603,6 +603,38 @@ (eq? (shared-array-root a) (shared-array-root b) (array-contents a))))) ;;; +;;; transpose-array +;;; + +(with-test-prefix "transpose-array" + + (pass-if "rank 1" + (let* ((a #(1 2 3)) + (b (transpose-array a 0))) + (and (array-equal? a b) + (eq? (shared-array-root a) (shared-array-root b))))) + + (pass-if "rank 2" + (let* ((a #2((1 2 3) (4 5 6))) + (b (transpose-array a 1 0)) + (c (transpose-array a 0 1))) + (and (array-equal? b #2((1 4) (2 5) (3 6))) + (array-equal? c a) + (eq? (shared-array-root a) + (shared-array-root b) + (shared-array-root c))))) + + ; rank > 2 is needed to check against the inverted axis index logic. + (pass-if "rank 3" + (let* ((a #3(((0 1 2 3) (4 5 6 7) (8 9 10 11)) + ((12 13 14 15) (16 17 18 19) (20 21 22 23)))) + (b (transpose-array a 1 2 0))) + (and (array-equal? b #3(((0 4 8) (12 16 20)) ((1 5 9) (13 17 21)) + ((2 6 10) (14 18 22)) ((3 7 11) (15 19 23)))) + (eq? (shared-array-root a) + (shared-array-root b)))))) + +;;; ;;; uniform-vector ;;; |