From 673e3f8964f124d65731a93fb5fdc8d6fa760ec4 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 21 Jul 2006 11:43:26 -0400 Subject: ENH: Adding C++-only test. --- Tests/CxxOnly/CMakeLists.txt | 8 ++++++++ Tests/CxxOnly/cxxonly.cxx | 19 +++++++++++++++++++ Tests/CxxOnly/libcxx1.cxx | 6 ++++++ Tests/CxxOnly/libcxx1.h | 5 +++++ Tests/CxxOnly/libcxx2.cxx | 6 ++++++ Tests/CxxOnly/libcxx2.h | 15 +++++++++++++++ 6 files changed, 59 insertions(+) create mode 100644 Tests/CxxOnly/CMakeLists.txt create mode 100644 Tests/CxxOnly/cxxonly.cxx create mode 100644 Tests/CxxOnly/libcxx1.cxx create mode 100644 Tests/CxxOnly/libcxx1.h create mode 100644 Tests/CxxOnly/libcxx2.cxx create mode 100644 Tests/CxxOnly/libcxx2.h diff --git a/Tests/CxxOnly/CMakeLists.txt b/Tests/CxxOnly/CMakeLists.txt new file mode 100644 index 0000000..cf31474 --- /dev/null +++ b/Tests/CxxOnly/CMakeLists.txt @@ -0,0 +1,8 @@ +# a simple CXX only test case +project (cxxonly CXX) + +set(CMAKE_DEBUG_POSTFIX "_test_debug_postfix") +add_library(testcxx1 STATIC libcxx1.cxx) +add_library(testcxx2 SHARED libcxx2.cxx) +add_executable (cxxonly cxxonly.cxx) +target_link_libraries(cxxonly testcxx1 testcxx2) diff --git a/Tests/CxxOnly/cxxonly.cxx b/Tests/CxxOnly/cxxonly.cxx new file mode 100644 index 0000000..99ccf3b --- /dev/null +++ b/Tests/CxxOnly/cxxonly.cxx @@ -0,0 +1,19 @@ +#include "libcxx1.h" +#include "libcxx2.h" + +#include + +int main () +{ + if ( LibCxx1Class::Method() != 2.0 ) + { + printf("Problem with libcxx1\n"); + return 1; + } + if ( LibCxx2Class::Method() != 1.0 ) + { + printf("Problem with libcxx2\n"); + return 1; + } + return 0; +} diff --git a/Tests/CxxOnly/libcxx1.cxx b/Tests/CxxOnly/libcxx1.cxx new file mode 100644 index 0000000..da18019 --- /dev/null +++ b/Tests/CxxOnly/libcxx1.cxx @@ -0,0 +1,6 @@ +#include "libcxx1.h" + +float LibCxx1Class::Method() +{ + return 2.0; +} diff --git a/Tests/CxxOnly/libcxx1.h b/Tests/CxxOnly/libcxx1.h new file mode 100644 index 0000000..9452a64 --- /dev/null +++ b/Tests/CxxOnly/libcxx1.h @@ -0,0 +1,5 @@ +class LibCxx1Class +{ +public: + static float Method(); +}; diff --git a/Tests/CxxOnly/libcxx2.cxx b/Tests/CxxOnly/libcxx2.cxx new file mode 100644 index 0000000..453039c --- /dev/null +++ b/Tests/CxxOnly/libcxx2.cxx @@ -0,0 +1,6 @@ +#include "libcxx2.h" + +float LibCxx2Class::Method() +{ + return 1.0; +} diff --git a/Tests/CxxOnly/libcxx2.h b/Tests/CxxOnly/libcxx2.h new file mode 100644 index 0000000..5dd84f6 --- /dev/null +++ b/Tests/CxxOnly/libcxx2.h @@ -0,0 +1,15 @@ +#ifdef _WIN32 +# ifdef testcxx2_EXPORTS +# define CM_TEST_LIB_EXPORT __declspec( dllexport ) +# else +# define CM_TEST_LIB_EXPORT __declspec( dllimport ) +# endif +#else +# define CM_TEST_LIB_EXPORT +#endif + +class CM_TEST_LIB_EXPORT LibCxx2Class +{ +public: + static float Method(); +}; -- cgit v0.12