]> git.zndr.dk Git - meson-test.git/commitdiff
Test and source in different dirs
authorJannik ZANDER <jannikz@gmail.com>
Mon, 16 Jul 2018 19:49:48 +0000 (21:49 +0200)
committerJannik ZANDER <jannikz@gmail.com>
Mon, 16 Jul 2018 19:49:48 +0000 (21:49 +0200)
folder1/folder1.h
folder1/folder1_test.cpp [deleted file]
folder1/meson.build
folder1_test/folder1_test.cpp [new file with mode: 0644]
folder1_test/meson.build [new file with mode: 0644]
folder2/folder2_test.cpp [deleted file]
folder2/meson.build
folder2_test/folder2_test.cpp [new file with mode: 0644]
folder2_test/meson.build [new file with mode: 0644]
meson.build

index ae3e5bd7197026e962d16d3afdee0690270d3c26..ec372acbee4d55d152829d2bcabedca885d29c30 100644 (file)
@@ -4,4 +4,4 @@
 int function1();\r
 int function2();\r
 \r
-#endif // FOLDER1_H
\ No newline at end of file
+#endif // FOLDER1_H\r
diff --git a/folder1/folder1_test.cpp b/folder1/folder1_test.cpp
deleted file mode 100644 (file)
index 68d7673..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#include "gtest/gtest.h"\r
-extern "C" {\r
-#include "folder1.h"\r
-}\r
-\r
-TEST(function1_test, compare1)\r
-{\r
-  ASSERT_EQ(function1(), 1) << "Values are equal function1 == 1";\r
-}\r
-\r
-TEST(function2_test, compare2)\r
-{\r
-  ASSERT_EQ(function2(), 2) << "Values are equal function2 == 2";\r
-}\r
-\r
index cd5280e1369eec09bc21d65674b0f4887cf24b85..fb58566523f9d8cd5f4519d1fe93944db30cfbcf 100644 (file)
@@ -1,5 +1,5 @@
-folder1_inc = include_directories('')
-folder1_lib = static_library('folder1', 'folder1.c')
-folder1_dep = declare_dependency(link_with : folder1_lib, include_directories : folder1_inc)
-folder1_tst = executable('test1', 'folder1_test.cpp', dependencies : [gtest, folder1_dep])
-test('test 1', folder1_tst)
+folder1_inc = include_directories('.')
+
+folder1_lib = static_library('folder1', 'folder1.c', include_directories : folder1_inc)
+
+folder1_dep = declare_dependency(link_with: folder1_lib, include_directories : folder1_inc)
diff --git a/folder1_test/folder1_test.cpp b/folder1_test/folder1_test.cpp
new file mode 100644 (file)
index 0000000..68d7673
--- /dev/null
@@ -0,0 +1,15 @@
+#include "gtest/gtest.h"\r
+extern "C" {\r
+#include "folder1.h"\r
+}\r
+\r
+TEST(function1_test, compare1)\r
+{\r
+  ASSERT_EQ(function1(), 1) << "Values are equal function1 == 1";\r
+}\r
+\r
+TEST(function2_test, compare2)\r
+{\r
+  ASSERT_EQ(function2(), 2) << "Values are equal function2 == 2";\r
+}\r
+\r
diff --git a/folder1_test/meson.build b/folder1_test/meson.build
new file mode 100644 (file)
index 0000000..2dc1dd8
--- /dev/null
@@ -0,0 +1,2 @@
+folder1_tst = executable('test1', 'folder1_test.cpp', dependencies : [gtest, folder1_dep])
+test('test 1', folder1_tst)
diff --git a/folder2/folder2_test.cpp b/folder2/folder2_test.cpp
deleted file mode 100644 (file)
index 6e0d942..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#include "gtest/gtest.h"\r
-extern "C" {\r
-#include "folder2.h"\r
-}\r
-\r
-TEST(function3_test, compare3)\r
-{\r
-  ASSERT_EQ(function3(), 3) << "Values are equal function3 == 3";\r
-}\r
index fb87cd22faa5d758e3561c18b39085e0f8ae98b9..0059eecdcbc82060e694577b4a3b2178aa95ecfa 100644 (file)
@@ -1,5 +1,5 @@
-folder2_inc = include_directories('')
-folder2_lib = static_library('folder2', 'folder2.c')
-folder2_dep = declare_dependency(link_with : folder2_lib, include_directories : folder2_inc, dependencies : folder1_dep)
-folder2_tst = executable('test2', 'folder2_test.cpp', dependencies : [gtest, folder2_dep])
-test('test 2', folder2_tst)
+folder2_inc = include_directories('.')
+
+folder2_lib = static_library('folder2', 'folder2.c', include_directories : folder2_inc)
+
+folder2_dep = declare_dependency(link_with: folder2_lib, include_directories : folder2_inc, dependencies : folder1_dep)
diff --git a/folder2_test/folder2_test.cpp b/folder2_test/folder2_test.cpp
new file mode 100644 (file)
index 0000000..6e0d942
--- /dev/null
@@ -0,0 +1,9 @@
+#include "gtest/gtest.h"\r
+extern "C" {\r
+#include "folder2.h"\r
+}\r
+\r
+TEST(function3_test, compare3)\r
+{\r
+  ASSERT_EQ(function3(), 3) << "Values are equal function3 == 3";\r
+}\r
diff --git a/folder2_test/meson.build b/folder2_test/meson.build
new file mode 100644 (file)
index 0000000..b09c6ba
--- /dev/null
@@ -0,0 +1,3 @@
+folder2_tst = executable('test2', 'folder2_test.cpp', 
+                         dependencies : [gtest, folder2_dep])
+test('test 2', folder2_tst)
index 1ca818624e0a79719d8396c595435b3ac5129ccc..1dc970754308b528a68b337367b021864d52117d 100644 (file)
@@ -1,5 +1,7 @@
 project('meson_test','cpp', 'c')
 gtest = dependency('gtest', main : true, required : false)
 subdir('folder1')
+subdir('folder1_test')
 subdir('folder2')
+subdir('folder2_test')