summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJussi Pakkanen <jussi.pakkanen@canonical.com>2012-03-05 18:20:21 +0200
committerJussi Pakkanen <jussi.pakkanen@canonical.com>2012-03-05 18:20:21 +0200
commit509541503fa0b484ea73f4530470acc1a5655151 (patch)
tree3bd39051ca9d210a3f2fac8dee916a95328475a6 /test
parent8600cfdcb6e51454c1d7eb24b1ccab4600c031da (diff)
Test compiling and linking with both a C and a C++ compiler.
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am9
-rw-r--r--test/test-c-compile.c17
-rw-r--r--test/test-cxx-compile.cpp17
3 files changed, 43 insertions, 0 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
new file mode 100644
index 0000000..1a80e04
--- /dev/null
+++ b/test/Makefile.am
@@ -0,0 +1,9 @@
+TESTS = test_c_compile test_cxx_compile
+
+check_PROGRAMS = $(TESTS)
+
+test_c_compile_SOURCES = test-c-compile.c
+test_c_compile_LDADD = $(top_builddir)/src/libutouch-evemu.la
+
+test_cxx_compile_SOURCES = test-cxx-compile.cpp
+test_cxx_compile_LDADD = $(top_builddir)/src/libutouch-evemu.la
diff --git a/test/test-c-compile.c b/test/test-c-compile.c
new file mode 100644
index 0000000..af2fe07
--- /dev/null
+++ b/test/test-c-compile.c
@@ -0,0 +1,17 @@
+/*
+ * Test that compiling+linking works with a C compiler.
+ */
+
+#include <stdio.h>
+#include <evemu.h>
+
+#define UNUSED __attribute__((unused))
+
+int main(int argc UNUSED, char **argv UNUSED) {
+ struct evemu_device *dummy = evemu_new("dummy");
+ if(!dummy) {
+ printf("This should really not be happening.\n");
+ return 1;
+ }
+ return 0;
+}
diff --git a/test/test-cxx-compile.cpp b/test/test-cxx-compile.cpp
new file mode 100644
index 0000000..37a3023
--- /dev/null
+++ b/test/test-cxx-compile.cpp
@@ -0,0 +1,17 @@
+/*
+ * Test that compiling+linking works with a C++ compiler.
+ */
+
+#include <stdio.h>
+#include <evemu.h>
+
+#define UNUSED __attribute__((unused))
+
+int main(int argc UNUSED, char **argv UNUSED) {
+ struct evemu_device *dummy = evemu_new("dummy");
+ if(!dummy) {
+ printf("This should really not be happening.\n");
+ return 1;
+ }
+ return 0;
+}