1 ! RUN: %python %S/test_folding.py %s %flang_fc1
2 ! Tests folding of CSHIFT (valid cases)
4 integer, parameter :: arr(2,3) = reshape([1, 2, 3, 4, 5, 6], shape(arr
))
5 logical, parameter :: test_sanity
= all([arr
] == [1, 2, 3, 4, 5, 6])
6 logical, parameter :: test_cshift_0
= all(cshift([1, 2, 3], 0) == [1, 2, 3])
7 logical, parameter :: test_cshift_1
= all(cshift([1, 2, 3], 1) == [2, 3, 1])
8 logical, parameter :: test_cshift_2
= all(cshift([1, 2, 3], 3) == [1, 2, 3])
9 logical, parameter :: test_cshift_3
= all(cshift([1, 2, 3], 4) == [2, 3, 1])
10 logical, parameter :: test_cshift_4
= all(cshift([1, 2, 3], -1) == [3, 1, 2])
11 logical, parameter :: test_cshift_5
= all([cshift(arr
, 1, dim
=1)] == [2, 1, 4, 3, 6, 5])
12 logical, parameter :: test_cshift_6
= all([cshift(arr
, 1, dim
=2)] == [3, 4, 5, 6, 1, 2])
13 logical, parameter :: test_cshift_7
= all([cshift(arr
, [1, 2, 3])] == [2, 1, 3, 4, 6, 5])
14 logical, parameter :: test_cshift_8
= all([cshift(arr
, [1, 2], dim
=2)] == [3, 6, 5, 2, 1, 4])