File tree Expand file tree Collapse file tree 5 files changed +41
-1
lines changed Expand file tree Collapse file tree 5 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ include (cmake/compilers.cmake)
1010
1111set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR} )
1212
13- foreach (d array bool error opaque pointer poly_function poly_type struct submodule tictoc vector)
13+ foreach (d array bool error malloc opaque pointer poly_function poly_type struct submodule tictoc vector)
1414 set (td src/${d} )
1515 add_subdirectory (${td} )
1616 get_property (targets DIRECTORY ${td} PROPERTY BUILDSYSTEM_TARGETS)
Original file line number Diff line number Diff line change @@ -20,5 +20,7 @@ int main()
2020 }
2121 }
2222
23+ std::cout << " OK: array" << std::endl;
24+
2325 return EXIT_SUCCESS;
2426}
Original file line number Diff line number Diff line change 1+ set_directory_properties (PROPERTIES LABELS malloc)
2+
3+ add_executable (cxx_fortran_malloc main.cpp)
4+ target_link_libraries (cxx_fortran_malloc PRIVATE vector_fortran)
5+ add_test (NAME C++_Fortran_malloc COMMAND cxx_fortran_malloc)
6+
7+ get_property (test_names DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY TESTS)
8+ set_tests_properties (${test_names} PROPERTIES TIMEOUT 5)
Original file line number Diff line number Diff line change 1+ #include < iostream>
2+
3+ extern " C" void timestwo (int [], int [], const size_t *);
4+
5+
6+ int main ()
7+ {
8+ const size_t N = 3 ;
9+
10+ auto x = new int [N];
11+ auto x2 = new int [N];
12+
13+ timestwo (&x[0 ], &x2[0 ], &N);
14+
15+ for (auto i=0u ; i < N; i++){
16+ if (x2[i] != 2 *x[i]){
17+ std::cerr << " value " << x2[i] << " !=" << x[i] << std::endl;
18+ return EXIT_FAILURE;
19+ }
20+ }
21+
22+ delete[] x;
23+ delete[] x2;
24+
25+ std::cout << " OK: C++ malloc new" << std::endl;
26+
27+ return EXIT_SUCCESS;
28+ }
Original file line number Diff line number Diff line change @@ -20,5 +20,7 @@ int main()
2020 }
2121 }
2222
23+ std::cout << " OK: vector" << std::endl;
24+
2325 return EXIT_SUCCESS;
2426}
You can’t perform that action at this time.
0 commit comments