From: Jannik ZANDER Date: Mon, 16 Jul 2018 09:26:50 +0000 (+0200) Subject: Initial commit X-Git-Url: https://git.zndr.dk/?a=commitdiff_plain;h=107eaa9724b904a43802581f5c623ca6cd22c80d;p=meson-test.git Initial commit --- 107eaa9724b904a43802581f5c623ca6cd22c80d diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..6cd80db --- /dev/null +++ b/.editorconfig @@ -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 index 0000000..6064ddc --- /dev/null +++ b/folder1.c @@ -0,0 +1,11 @@ +#include "folder1.h" + +int function1() +{ + return 1; +} + +int function2() +{ + return 2; +} diff --git a/folder1.h b/folder1.h new file mode 100644 index 0000000..ae3e5bd --- /dev/null +++ b/folder1.h @@ -0,0 +1,7 @@ +#ifndef FOLDER1_H +#define FOLDER1_H + +int function1(); +int function2(); + +#endif // FOLDER1_H \ No newline at end of file diff --git a/folder1_test.cpp b/folder1_test.cpp new file mode 100644 index 0000000..68d7673 --- /dev/null +++ b/folder1_test.cpp @@ -0,0 +1,15 @@ +#include "gtest/gtest.h" +extern "C" { +#include "folder1.h" +} + +TEST(function1_test, compare1) +{ + ASSERT_EQ(function1(), 1) << "Values are equal function1 == 1"; +} + +TEST(function2_test, compare2) +{ + ASSERT_EQ(function2(), 2) << "Values are equal function2 == 2"; +} + diff --git a/folder2.c b/folder2.c new file mode 100644 index 0000000..2d27b97 --- /dev/null +++ b/folder2.c @@ -0,0 +1,8 @@ +#include "folder1.h" +#include "folder2.h" + + +int function3() +{ + return function1()+function2(); +} diff --git a/folder2.h b/folder2.h new file mode 100644 index 0000000..b03ea51 --- /dev/null +++ b/folder2.h @@ -0,0 +1,6 @@ +#ifndef FOLDER2_H +#define FOLDER2_H + +int function3(); + +#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 index 0000000..b509ca4 --- /dev/null +++ b/folder2/Source/CMakeLists.txt @@ -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 index 0000000..a03731c --- /dev/null +++ b/folder2/Test/CMakeLists.txt @@ -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 index 0000000..6e0d942 --- /dev/null +++ b/folder2_test.cpp @@ -0,0 +1,9 @@ +#include "gtest/gtest.h" +extern "C" { +#include "folder2.h" +} + +TEST(function3_test, compare3) +{ + ASSERT_EQ(function3(), 3) << "Values are equal function3 == 3"; +} diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..26e3c65 --- /dev/null +++ b/meson.build @@ -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)