diff options
| author | ruki <[email protected]> | 2021-10-17 22:20:28 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-10-17 22:20:28 +0800 |
| commit | f91fc985a24094fd90a825f68c9ca63f7aa83ce0 (patch) | |
| tree | 22b68eb7ba0027d4bcfb67e5ac3cf63fff33cd30 | |
| parent | 2c018854833aa388bb16580f7d61646e90ce4bda (diff) | |
add unit_unit tests
| -rw-r--r-- | tests/projects/c/unit_build/src/bar/test4.c | 8 | ||||
| -rw-r--r-- | tests/projects/c/unit_build/src/bar/test5.c | 8 | ||||
| -rw-r--r-- | tests/projects/c/unit_build/src/foo/test1.c | 8 | ||||
| -rw-r--r-- | tests/projects/c/unit_build/src/foo/test2.c | 8 | ||||
| -rw-r--r-- | tests/projects/c/unit_build/src/header.h | 10 | ||||
| -rw-r--r-- | tests/projects/c/unit_build/src/main.c | 7 | ||||
| -rw-r--r-- | tests/projects/c/unit_build/src/test.cpp | 4 | ||||
| -rw-r--r-- | tests/projects/c/unit_build/src/test2.c | 8 | ||||
| -rw-r--r-- | tests/projects/c/unit_build/src/test6.c | 8 | ||||
| -rw-r--r-- | tests/projects/c/unit_build/src/test7.c | 8 | ||||
| -rw-r--r-- | tests/projects/c/unit_build/src/test8.c | 8 | ||||
| -rw-r--r-- | tests/projects/c/unit_build/test.lua | 6 | ||||
| -rw-r--r-- | tests/projects/c/unit_build/xmake.lua | 8 | ||||
| -rw-r--r-- | xmake/rules/c++/unit_build/xmake.lua | 21 |
14 files changed, 120 insertions, 0 deletions
diff --git a/tests/projects/c/unit_build/src/bar/test4.c b/tests/projects/c/unit_build/src/bar/test4.c new file mode 100644 index 000000000..a92803eb7 --- /dev/null +++ b/tests/projects/c/unit_build/src/bar/test4.c @@ -0,0 +1,8 @@ + +// main.cpp +#include "header.h" + +int test4() +{ + return 0; +} diff --git a/tests/projects/c/unit_build/src/bar/test5.c b/tests/projects/c/unit_build/src/bar/test5.c new file mode 100644 index 000000000..2a3e7066c --- /dev/null +++ b/tests/projects/c/unit_build/src/bar/test5.c @@ -0,0 +1,8 @@ + +// main.cpp +#include "header.h" + +int test5() +{ + return 0; +} diff --git a/tests/projects/c/unit_build/src/foo/test1.c b/tests/projects/c/unit_build/src/foo/test1.c new file mode 100644 index 000000000..e9d6c83d9 --- /dev/null +++ b/tests/projects/c/unit_build/src/foo/test1.c @@ -0,0 +1,8 @@ + +// main.cpp +#include "header.h" + +int test() +{ + return 0; +} diff --git a/tests/projects/c/unit_build/src/foo/test2.c b/tests/projects/c/unit_build/src/foo/test2.c new file mode 100644 index 000000000..b4ce69b0f --- /dev/null +++ b/tests/projects/c/unit_build/src/foo/test2.c @@ -0,0 +1,8 @@ + +// main.cpp +#include "header.h" + +int test3() +{ + return 0; +} diff --git a/tests/projects/c/unit_build/src/header.h b/tests/projects/c/unit_build/src/header.h new file mode 100644 index 000000000..29bfc5870 --- /dev/null +++ b/tests/projects/c/unit_build/src/header.h @@ -0,0 +1,10 @@ +// header.h +#ifndef HEADER_H +#define HEADER_H + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#endif + diff --git a/tests/projects/c/unit_build/src/main.c b/tests/projects/c/unit_build/src/main.c new file mode 100644 index 000000000..f0408cdf8 --- /dev/null +++ b/tests/projects/c/unit_build/src/main.c @@ -0,0 +1,7 @@ +#include "header.h" + +int main(int argc, char** argv) +{ + printf("hello xmake!\n"); + return 0; +} diff --git a/tests/projects/c/unit_build/src/test.cpp b/tests/projects/c/unit_build/src/test.cpp new file mode 100644 index 000000000..1cedddad9 --- /dev/null +++ b/tests/projects/c/unit_build/src/test.cpp @@ -0,0 +1,4 @@ +int test_cpp() +{ + return 0; +} diff --git a/tests/projects/c/unit_build/src/test2.c b/tests/projects/c/unit_build/src/test2.c new file mode 100644 index 000000000..596359cd2 --- /dev/null +++ b/tests/projects/c/unit_build/src/test2.c @@ -0,0 +1,8 @@ + +// main.cpp +#include "header.h" + +int test2() +{ + return 0; +} diff --git a/tests/projects/c/unit_build/src/test6.c b/tests/projects/c/unit_build/src/test6.c new file mode 100644 index 000000000..efbd7c6c1 --- /dev/null +++ b/tests/projects/c/unit_build/src/test6.c @@ -0,0 +1,8 @@ + +// main.cpp +#include "header.h" + +int test6() +{ + return 0; +} diff --git a/tests/projects/c/unit_build/src/test7.c b/tests/projects/c/unit_build/src/test7.c new file mode 100644 index 000000000..24aeff619 --- /dev/null +++ b/tests/projects/c/unit_build/src/test7.c @@ -0,0 +1,8 @@ + +// main.cpp +#include "header.h" + +int test7() +{ + return 0; +} diff --git a/tests/projects/c/unit_build/src/test8.c b/tests/projects/c/unit_build/src/test8.c new file mode 100644 index 000000000..6ad5680a6 --- /dev/null +++ b/tests/projects/c/unit_build/src/test8.c @@ -0,0 +1,8 @@ + +// main.cpp +#include "header.h" + +int test8() +{ + return 0; +} diff --git a/tests/projects/c/unit_build/test.lua b/tests/projects/c/unit_build/test.lua new file mode 100644 index 000000000..b76241be2 --- /dev/null +++ b/tests/projects/c/unit_build/test.lua @@ -0,0 +1,6 @@ +-- main entry +function main(t) + + -- build project + t:build() +end diff --git a/tests/projects/c/unit_build/xmake.lua b/tests/projects/c/unit_build/xmake.lua new file mode 100644 index 000000000..1df67c0ec --- /dev/null +++ b/tests/projects/c/unit_build/xmake.lua @@ -0,0 +1,8 @@ +target("test") + set_kind("binary") + add_includedirs("src") + add_rules("c++.unit_build", {batchsize = 2}) + add_files("src/*.c", "src/*.cpp") + add_files("src/foo/*.c", {unit_group = "foo"}) + add_files("src/bar/*.c", {unit_group = "bar"}) + diff --git a/xmake/rules/c++/unit_build/xmake.lua b/xmake/rules/c++/unit_build/xmake.lua new file mode 100644 index 000000000..c6d0ea0bd --- /dev/null +++ b/xmake/rules/c++/unit_build/xmake.lua @@ -0,0 +1,21 @@ +--!A cross-platform build utility based on Lua +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +-- Copyright (C) 2015-present, TBOOX Open Source Group. +-- +-- @author ruki +-- @file xmake.lua +-- + +rule("c++.unit_build") |
