From 53ad75b01341c86d515f833336890b7c5e880c5f Mon Sep 17 00:00:00 2001 From: Robert Farmer Date: Tue, 27 Feb 2024 20:06:32 +0000 Subject: [PATCH] Add test for (currently broken) returning character array with runtime size --- tests/strings_test.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/strings_test.py b/tests/strings_test.py index 05e7b44..cfe279e 100644 --- a/tests/strings_test.py +++ b/tests/strings_test.py @@ -309,3 +309,29 @@ def test_check_str_opt(self): res = x.check_str_opt("abcd", 4) assert res.result == 4 + + @pytest.mark.skip("Currently under development") + def test_func_str_return_array(self): + fstr = """ + + recursive function return_char(x) result(str) + implicit none + integer, intent(in) :: x + character(len=10), dimension((2 ** x - 1) ) :: str + + str = '' + str(2**x-1) = 'abcdefghil' + + end function return_char + + """ + + size = 2 + z = gf.compile(fstr) + + res = z.return_char(size) + + return_str = res.result + + assert np.size(np.shape(return_str)) == ((2**size) - 1) + assert return_str[-1] == "abcdefghij"