Browse Source

ENH: Adding C++-only test.

Brad King 19 years ago
parent
commit
673e3f8964

+ 8 - 0
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)

+ 19 - 0
Tests/CxxOnly/cxxonly.cxx

@@ -0,0 +1,19 @@
+#include "libcxx1.h"
+#include "libcxx2.h"
+
+#include <stdio.h>
+
+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;
+}

+ 6 - 0
Tests/CxxOnly/libcxx1.cxx

@@ -0,0 +1,6 @@
+#include "libcxx1.h"
+
+float LibCxx1Class::Method()
+{
+  return 2.0;
+}

+ 5 - 0
Tests/CxxOnly/libcxx1.h

@@ -0,0 +1,5 @@
+class LibCxx1Class
+{
+public:
+  static float Method();
+};

+ 6 - 0
Tests/CxxOnly/libcxx2.cxx

@@ -0,0 +1,6 @@
+#include "libcxx2.h"
+
+float LibCxx2Class::Method()
+{
+  return 1.0;
+}

+ 15 - 0
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();
+};