-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
61 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
|
||
! SPDX-License-Identifier: GPL-2.0+ | ||
|
||
module gh55 | ||
|
||
use iso_fortran_env, only: output_unit, real128 | ||
|
||
implicit none | ||
|
||
! Parameters | ||
integer, parameter :: dp = selected_real_kind(p=15) | ||
integer, parameter :: qp = selected_real_kind(p=30) | ||
integer, parameter :: lp = selected_int_kind(16) | ||
|
||
|
||
contains | ||
|
||
recursive function return_char(x) result(str) | ||
integer, intent(in) :: x | ||
character(len=10), dimension((2 ** x - 1) ) :: str | ||
|
||
str = '' | ||
str(2**x-1) = 'abcdefghil' | ||
|
||
end function return_char | ||
|
||
end module gh55 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# SPDX-License-Identifier: GPL-2.0+ | ||
|
||
import os, sys | ||
import ctypes | ||
from pprint import pprint | ||
|
||
os.environ["_GFORT2PY_TEST_FLAG"] = "1" | ||
|
||
import numpy as np | ||
import gfort2py as gf | ||
|
||
import pytest | ||
|
||
SO = f"./tests/gh55.{gf.lib_ext()}" | ||
MOD = "./tests/gh55.mod" | ||
|
||
x = gf.fFort(SO, MOD) | ||
|
||
|
||
@pytest.mark.skip("Currently broken needs array descriptor for strings") | ||
class Testgh55Methods: | ||
def test_func_str_return_array(self): | ||
|
||
size = 3 | ||
res = x.return_char(size) | ||
|
||
return_str = res.result | ||
|
||
assert np.size(np.shape(return_str)) == ((2**size) - 1) | ||
assert return_str[-1] == "abcdefghij" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters