File tree 6 files changed +43
-3
lines changed
6 files changed +43
-3
lines changed Original file line number Diff line number Diff line change 1
1
cmake_minimum_required (VERSION 2.8)
2
+ enable_language (C Fortran)
2
3
project (symengine.f90)
3
4
4
5
set (CMAKE_PREFIX_PATH ${SymEngine_DIR} ${CMAKE_PREFIX_PATH} )
@@ -64,4 +65,6 @@ message("HAVE_SYMENGINE_PIRANHA : ${HAVE_SYMENGINE_PIRANHA}")
64
65
message ("HAVE_SYMENGINE_FLINT : ${HAVE_SYMENGINE_FLINT} " )
65
66
message ("HAVE_SYMENGINE_LLVM : ${HAVE_SYMENGINE_LLVM} " )
66
67
68
+ enable_testing ()
69
+
67
70
add_subdirectory (src)
Original file line number Diff line number Diff line change 3
3
basic.f90
4
4
)
5
5
6
- include_directories (BEFORE ${python_wrapper_BINARY_DIR} /symengine/lib)
7
-
8
6
add_library (symengine_f90 ${SRC} )
9
7
target_link_libraries (symengine_f90 ${SYMENGINE_LIBRARIES} )
8
+
9
+ add_subdirectory (tests)
Original file line number Diff line number Diff line change 1
1
module basic
2
+ use iso_c_binding, only: c_int
2
3
implicit none
3
4
5
+ interface
6
+ subroutine f_c (i ) bind(c, name= " f" )
7
+ import :: c_int
8
+ integer (c_int), value, intent (in ) :: i
9
+ end subroutine
10
+ end interface
11
+
4
12
contains
5
13
14
+ subroutine f (i )
15
+ integer , intent (in ) :: i
16
+ call f_c(i)
17
+ end subroutine
18
+
6
19
end module
Original file line number Diff line number Diff line change
1
+ include_directories (${PROJECT_BINARY_DIR} /src)
2
+
3
+ macro (ADDTEST name )
4
+ add_executable (${name} ${name} .f90)
5
+ target_link_libraries (${name} symengine_f90)
6
+ add_test (${name} ${PROJECT_BINARY_DIR} /${name} )
7
+ endmacro (ADDTEST)
8
+
9
+ project (tests)
10
+
11
+ ADDTEST(test_basic)
Original file line number Diff line number Diff line change
1
+ program test_basic
2
+ use basic, only: f
3
+ implicit none
4
+
5
+ call f(1 )
6
+ call f(2 )
7
+ call f(3 )
8
+
9
+ end program
Original file line number Diff line number Diff line change @@ -14,6 +14,10 @@ void f(int i)
14
14
basic_mul (e , n , x );
15
15
basic_add (e , e , y );
16
16
s = basic_str (e );
17
- printf ("Result: %s" , s );
17
+ printf ("Result: %s\n " , s );
18
18
basic_str_free (s );
19
+ basic_free_stack (x );
20
+ basic_free_stack (y );
21
+ basic_free_stack (e );
22
+ basic_free_stack (n );
19
23
}
You can’t perform that action at this time.
0 commit comments