Browse Source

Test also stating and shared libraries

Andy Cedilnik 23 years ago
parent
commit
9bb153cbf1
6 changed files with 26 additions and 0 deletions
  1. 3 0
      Tests/COnly/CMakeLists.txt
  2. 13 0
      Tests/COnly/conly.c
  3. 4 0
      Tests/COnly/libc1.c
  4. 1 0
      Tests/COnly/libc1.h
  5. 4 0
      Tests/COnly/libc2.c
  6. 1 0
      Tests/COnly/libc2.h

+ 3 - 0
Tests/COnly/CMakeLists.txt

@@ -1,3 +1,6 @@
 # a simple C only test case
 PROJECT (conly C)
+ADD_LIBRARY(c1 STATIC libc1.c)
+ADD_LIBRARY(c2 SHARED libc2.c)
 ADD_EXECUTABLE (conly conly.c foo.c foo.h)
+TARGET_LINK_LIBRARIES(conly c1 c2)

+ 13 - 0
Tests/COnly/conly.c

@@ -1,9 +1,22 @@
 #include "foo.h"
 
+#include "libc1.h"
+#include "libc2.h"
+
 #include <stdio.h>
 
 int main ()
 {
+  if ( LibC1Func() != 2.0 )
+    {
+    printf("Problem with libc1\n");
+    return 1;
+    }
+  if ( LibC2Func() != 1.0 )
+    {
+    printf("Problem with libc2\n");
+    return 1;
+    }
   printf("Foo: %s\n", foo);
   return 0;
 }

+ 4 - 0
Tests/COnly/libc1.c

@@ -0,0 +1,4 @@
+float LibC1Func()
+{
+  return 2.0;
+}

+ 1 - 0
Tests/COnly/libc1.h

@@ -0,0 +1 @@
+extern float LibC1Func();

+ 4 - 0
Tests/COnly/libc2.c

@@ -0,0 +1,4 @@
+float LibC2Func()
+{
+  return 1.0;
+}

+ 1 - 0
Tests/COnly/libc2.h

@@ -0,0 +1 @@
+extern float LibC2Func();