]> git.zndr.dk Git - meson-test.git/commitdiff
Initial commit
authorJannik ZANDER <jannikz@gmail.com>
Mon, 16 Jul 2018 09:26:50 +0000 (11:26 +0200)
committerJannik ZANDER <jannikz@gmail.com>
Mon, 16 Jul 2018 09:26:50 +0000 (11:26 +0200)
.editorconfig [new file with mode: 0644]
folder1.c [new file with mode: 0644]
folder1.h [new file with mode: 0644]
folder1_test.cpp [new file with mode: 0644]
folder2.c [new file with mode: 0644]
folder2.h [new file with mode: 0644]
folder2/Source/CMakeLists.txt [new file with mode: 0644]
folder2/Test/CMakeLists.txt [new file with mode: 0644]
folder2_test.cpp [new file with mode: 0644]
meson.build [new file with mode: 0644]

diff --git a/.editorconfig b/.editorconfig
new file mode 100644 (file)
index 0000000..6cd80db
--- /dev/null
@@ -0,0 +1,16 @@
+; Top level editor config
+root = true
+; Always use Unix style new lines
+end_of_line = lf
+; New line ending on every file
+insert_final_newline = true
+; Trim whitespace
+trim_trailing_whitespace = true
+[*.py]
+; PEP8 defines 4 spaces for indentation
+indent_style = space
+indent_size = 4
+[*.md]
+; Markup file 2 spaces for indentation
+indent_style = space
+indent_size = 2
diff --git a/folder1.c b/folder1.c
new file mode 100644 (file)
index 0000000..6064ddc
--- /dev/null
+++ b/folder1.c
@@ -0,0 +1,11 @@
+#include "folder1.h"\r
+\r
+int function1()\r
+{\r
+  return 1;\r
+}\r
+\r
+int function2()\r
+{\r
+  return 2;\r
+}\r
diff --git a/folder1.h b/folder1.h
new file mode 100644 (file)
index 0000000..ae3e5bd
--- /dev/null
+++ b/folder1.h
@@ -0,0 +1,7 @@
+#ifndef FOLDER1_H\r
+#define FOLDER1_H\r
+\r
+int function1();\r
+int function2();\r
+\r
+#endif // FOLDER1_H
\ No newline at end of file
diff --git a/folder1_test.cpp b/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/folder2.c b/folder2.c
new file mode 100644 (file)
index 0000000..2d27b97
--- /dev/null
+++ b/folder2.c
@@ -0,0 +1,8 @@
+#include "folder1.h"\r
+#include "folder2.h"\r
+\r
+\r
+int function3()\r
+{\r
+  return function1()+function2();\r
+}\r
diff --git a/folder2.h b/folder2.h
new file mode 100644 (file)
index 0000000..b03ea51
--- /dev/null
+++ b/folder2.h
@@ -0,0 +1,6 @@
+#ifndef FOLDER2_H\r
+#define FOLDER2_H\r
+\r
+int function3();\r
+\r
+#endif // FOLDER2_H
\ No newline at end of file
diff --git a/folder2/Source/CMakeLists.txt b/folder2/Source/CMakeLists.txt
new file mode 100644 (file)
index 0000000..b509ca4
--- /dev/null
@@ -0,0 +1,5 @@
+add_unit(TARGET folder2 
+         SRCS   folder2.c
+         INCS   . 
+         DEPS   folder1)
+
diff --git a/folder2/Test/CMakeLists.txt b/folder2/Test/CMakeLists.txt
new file mode 100644 (file)
index 0000000..a03731c
--- /dev/null
@@ -0,0 +1,5 @@
+add_unittest(TARGET folder2_test
+             SRCS   folder2_test.cpp
+             INCS   . 
+             DEPS   folder2)
+
diff --git a/folder2_test.cpp b/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/meson.build b/meson.build
new file mode 100644 (file)
index 0000000..26e3c65
--- /dev/null
@@ -0,0 +1,15 @@
+project('meson_test','cpp', 'c')
+
+gtest = dependency('gtest', main : true, required : false)
+
+# Test 1
+folder1 = 'folder1.c'
+folder1_test = executable('folder1_test.cpp', folder1,
+                          dependencies : gtest)
+test('folder1 test', folder1_test)
+
+# Test 2
+folder2 = 'folder2.c'
+folder2_test = executable('folder2_test.cpp', folder1, folder2,
+                          dependencies : gtest)
+test('folder2 test', folder2_test)