summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-12-07 13:33:45 (GMT)
committerKitware Robot <kwrobot@kitware.com>2018-12-07 13:35:37 (GMT)
commitce1ac9b92d23577f96abd4d750fc8499cc40d70f (patch)
tree0b5d64a4a4b6e98a56279df48699b8dc0179d416 /Tests
parentcb85bb3573a89f16fcc9b2852e3ce1bae30838fc (diff)
parent170bcb6fdca5942d0484042ad38c09b420554792 (diff)
downloadCMake-ce1ac9b92d23577f96abd4d750fc8499cc40d70f.zip
CMake-ce1ac9b92d23577f96abd4d750fc8499cc40d70f.tar.gz
CMake-ce1ac9b92d23577f96abd4d750fc8499cc40d70f.tar.bz2
Merge topic 'gnu-octave'
170bcb6fdc FindOctave: Add module to find GNU octave Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2630
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLists.txt4
-rw-r--r--Tests/FindOctave/CMakeLists.txt10
-rw-r--r--Tests/FindOctave/Test/CMakeLists.txt20
-rw-r--r--Tests/FindOctave/Test/main.cpp18
-rw-r--r--Tests/FindOctave/Test/testtrue.m1
5 files changed, 53 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 8b5f2e9..408c941 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1441,6 +1441,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
add_subdirectory(FindODBC)
endif()
+ if(CMake_TEST_FindOctave)
+ add_subdirectory(FindOctave)
+ endif()
+
if(CMake_TEST_FindOpenCL)
add_subdirectory(FindOpenCL)
endif()
diff --git a/Tests/FindOctave/CMakeLists.txt b/Tests/FindOctave/CMakeLists.txt
new file mode 100644
index 0000000..1acc966
--- /dev/null
+++ b/Tests/FindOctave/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(NAME FindOctave.Test COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindOctave/Test"
+ "${CMake_BINARY_DIR}/Tests/FindOctave/Test"
+ ${build_generator_args}
+ --build-project TestFindOctave
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
diff --git a/Tests/FindOctave/Test/CMakeLists.txt b/Tests/FindOctave/Test/CMakeLists.txt
new file mode 100644
index 0000000..ce33fcd
--- /dev/null
+++ b/Tests/FindOctave/Test/CMakeLists.txt
@@ -0,0 +1,20 @@
+cmake_minimum_required(VERSION 3.3)
+project(TestFindOctave CXX)
+enable_testing()
+
+find_package(Octave REQUIRED COMPONENTS Development Interpreter)
+
+add_definitions(-DCMAKE_EXPECTED_Octave_VERSION=${Octave_VERSION})
+
+add_executable(test_tgt main.cpp)
+target_link_libraries(test_tgt Octave::Octave)
+add_test(NAME test_tgt COMMAND test_tgt)
+
+add_test(NAME test_tgt_exe
+ COMMAND Octave::Interpreter -q --eval "runtests('.')"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+
+add_executable(test_var main.cpp)
+target_include_directories(test_var PRIVATE ${Octave_INCLUDE_DIRS})
+target_link_libraries(test_var PRIVATE ${Octave_LIBRARIES})
+add_test(NAME test_var COMMAND test_var)
diff --git a/Tests/FindOctave/Test/main.cpp b/Tests/FindOctave/Test/main.cpp
new file mode 100644
index 0000000..68270b1
--- /dev/null
+++ b/Tests/FindOctave/Test/main.cpp
@@ -0,0 +1,18 @@
+#include <iostream>
+#include <oct.h>
+
+// http://www.dm.unibo.it/~achilles/calc/octave.html/Standalone-Programs.html
+int main(void)
+{
+ int n = 2;
+ Matrix a_matrix = Matrix(n, n);
+ for (octave_idx_type i = 0; i < n; i++) {
+ for (octave_idx_type j = 0; j < n; j++) {
+ a_matrix(i, j) = (i + 1) * 10 + (j + 1);
+ }
+ }
+
+ std::cout << a_matrix << std::endl;
+
+ return EXIT_SUCCESS;
+}
diff --git a/Tests/FindOctave/Test/testtrue.m b/Tests/FindOctave/Test/testtrue.m
new file mode 100644
index 0000000..0c28a9e
--- /dev/null
+++ b/Tests/FindOctave/Test/testtrue.m
@@ -0,0 +1 @@
+%!assert(true)