diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/ctor.cc | 474 | ||||
| -rw-r--r-- | test/cycle_test.cc | 14 | ||||
| -rw-r--r-- | test/generated_sources_test.cc | 56 | ||||
| -rw-r--r-- | test/suite/ctor_files/ctor.cc.bar | 10 | ||||
| -rw-r--r-- | test/suite/ctor_files/ctor.cc.base | 10 | ||||
| -rw-r--r-- | test/suite/ctor_files/ctor.cc.generated | 32 | ||||
| -rw-r--r-- | test/suite/ctor_files/ctor.cc.generated2 | 28 | ||||
| -rw-r--r-- | test/suite/ctor_files/ctor.cc.multi | 10 | ||||
| -rw-r--r-- | test/tasks_test.cc | 12 |
9 files changed, 323 insertions, 323 deletions
diff --git a/test/ctor.cc b/test/ctor.cc index e7ed038..250acec 100644 --- a/test/ctor.cc +++ b/test/ctor.cc @@ -8,244 +8,244 @@ namespace ctor::build_configurations ctorTestConfigs(const ctor::settings& settings) { return - { { - .type = ctor::target_type::unit_test, - .system = ctor::output_system::build, - .target = "argparser_test", - .sources = { - "argparser_test.cc", - "testmain.cc", - }, - .flags = { - .cxxflags = { - "-std=c++20", "-O3", "-Wall", - "-I../src", "-Iuunit", - "-DOUTPUT=\"argparser\"", - "-fexceptions", - }, - }, - }, - { - .type = ctor::target_type::unit_test, - .system = ctor::output_system::build, - .target = "generated_sources_test", - .sources = { - "generated_sources_test.cc", - "testmain.cc", - }, - .depends = { "libctor_nomain.a" }, - .flags = { - .cxxflags = { - "-std=c++20", "-O3", "-Wall", - "-I../src", "-Iuunit", - "-DOUTPUT=\"generated_sources\"", - "-fexceptions", - }, - }, - }, - { - .type = ctor::target_type::unit_test, - .system = ctor::output_system::build, - .target = "argsplit_test", - .sources = { - "argsplit_test.cc", - "testmain.cc", - "../src/util.cc", - }, - .flags = { - .cxxflags = { - "-std=c++20", "-O3", "-Wall", - "-I../src", "-Iuunit", - "-DOUTPUT=\"argsplit\"", - "-fexceptions", - }, - }, - }, - { - .type = ctor::target_type::unit_test, - .system = ctor::output_system::build, - .target = "pointerlist_test", - .sources = { - "pointerlist_test.cc", - "testmain.cc", - "../src/pointerlist.cc", - }, - .flags = { - .cxxflags = { - "-std=c++20", "-O3", "-Wall", - "-I../src", "-Iuunit", - "-DOUTPUT=\"pointerlist\"", - "-fexceptions", - }, - }, - }, - { - .type = ctor::target_type::unit_test, - .system = ctor::output_system::build, - .target = "deps_test", - .sources = { - "deps_test.cc", - "testmain.cc", - "../src/deps.cc", - "../src/util.cc", - }, - .depends = { "testprog", }, - .flags = { - .cxxflags = { - "-std=c++20", "-O3", "-Wall", - "-I../src", "-Iuunit", - "-DOUTPUT=\"deps\"", - "-fexceptions", - }, - }, - }, - { - .type = ctor::target_type::unit_test, - .system = ctor::output_system::build, - .target = "testprog", - .sources = { - "testprog.cc", - }, - .flags = { - .cxxflags = { - "-std=c++20", "-O3", "-Wall", - "-fexceptions", - }, - }, - }, - { - .type = ctor::target_type::unit_test, - .system = ctor::output_system::build, - .target = "execute_test", - .sources = { - "execute_test.cc", - "testmain.cc", - "../src/execute.cc", - "../src/pointerlist.cc", - "../src/util.cc", - }, - .depends = { "testprog", }, - .flags = { - .cxxflags = { - "-std=c++20", "-O3", "-Wall", - "-I../src", "-Iuunit", - "-DOUTPUT=\"execute\"", - "-fexceptions", - }, - .ldflags = { "-pthread" }, - }, - }, - { - .type = ctor::target_type::unit_test, - .system = ctor::output_system::build, - .target = "tasks_test", - .sources = { - "tasks_test.cc", - "testmain.cc", - }, - .depends = { "libctor_nomain.a" }, - .flags = { - .cxxflags = { - "-std=c++20", "-O3", "-Wall", - "-I../src", "-Iuunit", - "-DOUTPUT=\"tasks\"", - "-fexceptions", - }, - .ldflags = { "-pthread" }, - }, - }, - { - .type = ctor::target_type::unit_test, - .system = ctor::output_system::build, - .target = "cycle_test", - .sources = { - "cycle_test.cc", - "testmain.cc", - }, - .depends = { "libctor_nomain.a" }, - .flags = { - .cxxflags = { - "-std=c++20", "-O3", "-Wall", - "-I../src", "-Iuunit", - "-DOUTPUT=\"cycle\"", - "-fexceptions", - }, - .ldflags = { "-pthread" }, - }, - }, - { - .type = ctor::target_type::unit_test, - .system = ctor::output_system::build, - .target = "source_type_test", - .sources = { - "source_type_test.cc", - "testmain.cc", - }, - .depends = { "libctor_nomain.a" }, - .flags = { - .cxxflags = { - "-std=c++20", "-O3", "-Wall", - "-I../src", "-Iuunit", - "-DOUTPUT=\"source_type\"", - "-fexceptions", - }, - .ldflags = { "-pthread" }, - }, - }, - { - .type = ctor::target_type::unit_test, - .system = ctor::output_system::build, - .target = "tools_test", - .sources = { - "tools_test.cc", - "testmain.cc", - "../src/util.cc", - "../src/tools.cc", - }, - //.depends = { "libctor_nomain.a" }, - .flags = { - .cxxflags = { - "-std=c++20", "-O3", "-Wall", - "-I../src", "-Iuunit", - "-DOUTPUT=\"tools\"", - "-fexceptions", - }, - }, - }, - { - .type = ctor::target_type::unit_test_library, - .system = ctor::output_system::build, - .target = "libctor_nomain.a", - .sources = { - "../src/build.cc", - "../src/configure.cc", - "../src/deps.cc", - "../src/execute.cc", - "../src/pointerlist.cc", - "../src/rebuild.cc", - "../src/tasks.cc", - "../src/task.cc", - "../src/task_ar.cc", - "../src/task_cc.cc", - "../src/task_fn.cc", - "../src/task_ld.cc", - "../src/task_so.cc", - "../src/tools.cc", - "../src/util.cc", - "../src/externals_manual.cc", - "../configuration.cc", - }, - .flags = { - .cxxflags = { - "-std=c++20", "-O3", "-Wall", - "-I../src", - "-fexceptions", - }, - .ldflags = { "-pthread" }, - }, - }, - }; + { + ctor::target_type::unit_test, + ctor::output_system::build, + ctor::target("argparser_test"), + ctor::sources{ + "argparser_test.cc", + "testmain.cc", + }, + ctor::flags({ + .cxxflags = { + "-std=c++20", "-O3", "-Wall", + "-I../src", "-Iuunit", + "-DOUTPUT=\"argparser\"", + "-fexceptions", + }, + }), + }, + { + ctor::target_type::unit_test, + ctor::output_system::build, + ctor::target("generated_sources_test"), + ctor::sources{ + "generated_sources_test.cc", + "testmain.cc", + }, + ctor::depends({"libctor_nomain.a"}), + ctor::flags({ + .cxxflags = { + "-std=c++20", "-O3", "-Wall", + "-I../src", "-Iuunit", + "-DOUTPUT=\"generated_sources\"", + "-fexceptions", + }, + }), + }, + { + ctor::target_type::unit_test, + ctor::output_system::build, + ctor::target("argsplit_test"), + ctor::sources{ + "argsplit_test.cc", + "testmain.cc", + "../src/util.cc", + }, + ctor::flags({ + .cxxflags = { + "-std=c++20", "-O3", "-Wall", + "-I../src", "-Iuunit", + "-DOUTPUT=\"argsplit\"", + "-fexceptions", + }, + }), + }, + { + ctor::target_type::unit_test, + ctor::output_system::build, + ctor::target("pointerlist_test"), + ctor::sources{ + "pointerlist_test.cc", + "testmain.cc", + "../src/pointerlist.cc", + }, + ctor::flags({ + .cxxflags = { + "-std=c++20", "-O3", "-Wall", + "-I../src", "-Iuunit", + "-DOUTPUT=\"pointerlist\"", + "-fexceptions", + }, + }), + }, + { + ctor::target_type::unit_test, + ctor::output_system::build, + ctor::target("deps_test"), + ctor::sources{ + "deps_test.cc", + "testmain.cc", + "../src/deps.cc", + "../src/util.cc", + }, + ctor::depends({"testprog"}), + ctor::flags({ + .cxxflags = { + "-std=c++20", "-O3", "-Wall", + "-I../src", "-Iuunit", + "-DOUTPUT=\"deps\"", + "-fexceptions", + }, + }), + }, + { + ctor::target_type::unit_test, + ctor::output_system::build, + ctor::target("testprog"), + ctor::sources{ + "testprog.cc", + }, + ctor::flags({ + .cxxflags = { + "-std=c++20", "-O3", "-Wall", + "-fexceptions", + }, + }), + }, + { + ctor::target_type::unit_test, + ctor::output_system::build, + ctor::target("execute_test"), + ctor::sources{ + "execute_test.cc", + "testmain.cc", + "../src/execute.cc", + "../src/pointerlist.cc", + "../src/util.cc", + }, + ctor::depends({"testprog"}), + ctor::flags({ + .cxxflags = { + "-std=c++20", "-O3", "-Wall", + "-I../src", "-Iuunit", + "-DOUTPUT=\"execute\"", + "-fexceptions", + }, + .ldflags = { "-pthread" }, + }), + }, + { + ctor::target_type::unit_test, + ctor::output_system::build, + ctor::target("tasks_test"), + ctor::sources{ + "tasks_test.cc", + "testmain.cc", + }, + ctor::depends({"libctor_nomain.a"}), + ctor::flags({ + .cxxflags = { + "-std=c++20", "-O3", "-Wall", + "-I../src", "-Iuunit", + "-DOUTPUT=\"tasks\"", + "-fexceptions", + }, + .ldflags = { "-pthread" }, + }), + }, + { + ctor::target_type::unit_test, + ctor::output_system::build, + ctor::target("cycle_test"), + ctor::sources{ + "cycle_test.cc", + "testmain.cc", + }, + ctor::depends({"libctor_nomain.a"}), + ctor::flags({ + .cxxflags = { + "-std=c++20", "-O3", "-Wall", + "-I../src", "-Iuunit", + "-DOUTPUT=\"cycle\"", + "-fexceptions", + }, + .ldflags = { "-pthread" }, + }), + }, + { + ctor::target_type::unit_test, + ctor::output_system::build, + ctor::target("source_type_test"), + ctor::sources{ + "source_type_test.cc", + "testmain.cc", + }, + ctor::depends({"libctor_nomain.a"}), + ctor::flags({ + .cxxflags = { + "-std=c++20", "-O3", "-Wall", + "-I../src", "-Iuunit", + "-DOUTPUT=\"source_type\"", + "-fexceptions", + }, + .ldflags = { "-pthread" }, + }), + }, + { + ctor::target_type::unit_test, + ctor::output_system::build, + ctor::target("tools_test"), + ctor::sources{ + "tools_test.cc", + "testmain.cc", + "../src/util.cc", + "../src/tools.cc", + }, + ctor::depends({"libctor_nomain.a"}), + ctor::flags({ + .cxxflags = { + "-std=c++20", "-O3", "-Wall", + "-I../src", "-Iuunit", + "-DOUTPUT=\"tools\"", + "-fexceptions", + }, + }), + }, + { + ctor::target_type::unit_test_library, + ctor::output_system::build, + ctor::target("libctor_nomain.a"), + ctor::sources{ + "../src/build.cc", + "../src/configure.cc", + "../src/deps.cc", + "../src/execute.cc", + "../src/pointerlist.cc", + "../src/rebuild.cc", + "../src/tasks.cc", + "../src/task.cc", + "../src/task_ar.cc", + "../src/task_cc.cc", + "../src/task_fn.cc", + "../src/task_ld.cc", + "../src/task_so.cc", + "../src/tools.cc", + "../src/util.cc", + "../src/externals_manual.cc", + "../configuration.cc", + }, + ctor::flags({ + .cxxflags = { + "-std=c++20", "-O3", "-Wall", + "-I../src", + "-fexceptions", + }, + .ldflags = { "-pthread" }, + }), + }, + }; } } diff --git a/test/cycle_test.cc b/test/cycle_test.cc index 3b45632..8f4c296 100644 --- a/test/cycle_test.cc +++ b/test/cycle_test.cc @@ -11,23 +11,23 @@ ctor::build_configurations ctorTestConfigsCyclic(const ctor::settings&) { // No dependency { - .target = "target0", + ctor::target("target0"), }, // Direct (self-depends) { - .target = "target1", - .depends = { "target1" }, + ctor::target("target1"), + ctor::depends({ "target1" }), }, // Indirect cyclic depends { - .target = "target2", - .depends = { "target3" }, + ctor::target("target2"), + ctor::depends({ "target3" }), }, { - .target = "target3", - .depends = { "target2" }, + ctor::target("target3"), + ctor::depends({ "target2" }), }, }; } diff --git a/test/generated_sources_test.cc b/test/generated_sources_test.cc index 8c46983..626a102 100644 --- a/test/generated_sources_test.cc +++ b/test/generated_sources_test.cc @@ -32,24 +32,24 @@ public: { return ctor::build_configurations{ { - .target = "test1", - .sources = { - {"foo.cc", ctor::source_type::generated} - } + ctor::target("test1"), + ctor::sources{ + {"foo.cc", ctor::source_type::generated} + }, }, { - .target = "this_is_unused", - .sources = { - {"bar.x", ctor::output_file{"foo.cc"}}, - {"bar.y", ctor::output_file{"bar.cc"}}, - }, - .function = []([[maybe_unused]]const std::string& input, - [[maybe_unused]]const std::string& output, - [[maybe_unused]]const ctor::build_configuration& config, - [[maybe_unused]]const ctor::settings& settings) + ctor::target("this_is_unused"), + ctor::sources{ + {"bar.x", ctor::output_file{"foo.cc"}}, + {"bar.y", ctor::output_file{"bar.cc"}}, + }, + ctor::GeneratorOneToOne([]([[maybe_unused]]const std::string& input, + [[maybe_unused]]const std::string& output, + [[maybe_unused]]const ctor::build_configuration& config, + [[maybe_unused]]const ctor::settings& settings) { return 0; - } + }), }, }; }); @@ -85,24 +85,24 @@ public: { return ctor::build_configurations{ { - .target = "test1", - .sources = { - {"foo.cc", ctor::source_type::generated} - } + ctor::target("test1"), + ctor::sources{ + {"foo.cc", ctor::source_type::generated} + }, }, { - .target = "foo.cc", - .sources = { - {"bar.x"}, - {"bar.y"}, - }, - .function = [](const std::vector<std::string>& input, - const std::string& output, - const ctor::build_configuration& config, - const ctor::settings& settings) + ctor::target("foo.cc"), + ctor::sources{ + {"bar.x"}, + {"bar.y"}, + }, + ctor::GeneratorManyToOne([](const std::vector<std::string>& input, + const std::string& output, + const ctor::build_configuration& config, + const ctor::settings& settings) { return 0; - } + }), }, }; }); diff --git a/test/suite/ctor_files/ctor.cc.bar b/test/suite/ctor_files/ctor.cc.bar index ab88379..9a45878 100644 --- a/test/suite/ctor_files/ctor.cc.bar +++ b/test/suite/ctor_files/ctor.cc.bar @@ -11,12 +11,12 @@ ctor::build_configurations ctorConfigs(const ctor::settings& settings) return { { - .name = "hello", - .target = "hello", - .sources = { + ctor::name("hello"), + ctor::target("hello"), + ctor::sources{ "hello.cc", }, - .flags = { + ctor::flags{ .cxxflags = { "-std=c++20", "-O3", @@ -26,7 +26,7 @@ ctor::build_configurations ctorConfigs(const ctor::settings& settings) "-fexceptions", }, }, - .externals = {"bar"}, + ctor::externals({"bar"}), } }; } diff --git a/test/suite/ctor_files/ctor.cc.base b/test/suite/ctor_files/ctor.cc.base index a8b3c92..f740659 100644 --- a/test/suite/ctor_files/ctor.cc.base +++ b/test/suite/ctor_files/ctor.cc.base @@ -11,12 +11,12 @@ ctor::build_configurations ctorConfigs(const ctor::settings& settings) return { { - .name = "hello", - .target = "hello", - .sources = { + ctor::name("hello"), + ctor::target("hello"), + ctor::sources{ "hello.cc", }, - .flags = { + ctor::flags{ .cxxflags = { "-std=c++20", "-O3", @@ -26,7 +26,7 @@ ctor::build_configurations ctorConfigs(const ctor::settings& settings) "-fexceptions", }, }, - .externals = {"bar"}, + ctor::externals({"bar"}), } }; } diff --git a/test/suite/ctor_files/ctor.cc.generated b/test/suite/ctor_files/ctor.cc.generated index d4b9786..1466e4d 100644 --- a/test/suite/ctor_files/ctor.cc.generated +++ b/test/suite/ctor_files/ctor.cc.generated @@ -13,11 +13,11 @@ ctor::build_configurations ctorConfigs(const ctor::settings& settings) return { { - .target = "world", - .sources = { + ctor::target("world"), + ctor::sources{ { "world.cc", ctor::source_type::generated }, }, - .flags = { + ctor::flags{ .cxxflags = { "-std=c++20", "-O3", @@ -29,11 +29,11 @@ ctor::build_configurations ctorConfigs(const ctor::settings& settings) }, }, { - .target = "foo", - .sources = { + ctor::target("foo"), + ctor::sources{ { "foo.cc", ctor::source_type::generated }, }, - .flags = { + ctor::flags{ .cxxflags = { "-std=c++20", "-O3", @@ -45,12 +45,12 @@ ctor::build_configurations ctorConfigs(const ctor::settings& settings) }, }, { - .target = "this_is_unused", - .sources = { + ctor::target("this_is_unused"), + ctor::sources{ {"hello.cc", ctor::output_file{"world.cc"}}, {"hello.cc", ctor::output_file{"foo.cc"}}, }, - .function = [](const std::string& input, + ctor::GeneratorOneToOne{[](const std::string& input, const std::string& output, const ctor::build_configuration& config, const ctor::settings& settings) @@ -60,22 +60,22 @@ ctor::build_configurations ctorConfigs(const ctor::settings& settings) std::cout << "Output: " << output << '\n'; fs::copy_file(input, output, fs::copy_options::overwrite_existing); return 0; - } + }} }, { - .target = "many_to_one", - .sources = { + ctor::target("many_to_one"), + ctor::sources{ {"many_to_one.cc", ctor::source_type::generated} } }, { - .target = "many_to_one.cc", - .sources = { + ctor::target("many_to_one.cc"), + ctor::sources{ {"foo.cc", ctor::source_type::generated}, {"hello.cc"}, }, - .function = [](const std::vector<std::string>& input, + ctor::GeneratorManyToOne{[](const std::vector<std::string>& input, const std::string& output, const ctor::build_configuration& config, const ctor::settings& settings) @@ -97,7 +97,7 @@ ctor::build_configurations ctorConfigs(const ctor::settings& settings) } ofs << "*/\n"; return 0; - } + }} }, }; diff --git a/test/suite/ctor_files/ctor.cc.generated2 b/test/suite/ctor_files/ctor.cc.generated2 index c78489f..acda99f 100644 --- a/test/suite/ctor_files/ctor.cc.generated2 +++ b/test/suite/ctor_files/ctor.cc.generated2 @@ -13,24 +13,24 @@ ctor::build_configurations ctorConfigs(const ctor::settings& settings) return { { - .target = "world", - .sources = { + ctor::target("world"), + ctor::sources{ { "world.cc", ctor::source_type::generated }, }, }, { - .target = "foo", - .sources = { + ctor::target("foo"), + ctor::sources{ { "foo.cc", ctor::source_type::generated }, }, }, { - .target = "this_is_unused", - .sources = { + ctor::target("this_is_unused"), + ctor::sources{ {"hello.cc", ctor::output_file{"world.cc"}}, {"hello.cc", ctor::output_file{"foo.cc"}}, }, - .function = [](const std::string& input, + ctor::GeneratorOneToOne{[](const std::string& input, const std::string& output, const ctor::build_configuration& config, const ctor::settings& settings) @@ -40,21 +40,21 @@ ctor::build_configurations ctorConfigs(const ctor::settings& settings) std::cout << "Output: " << output << '\n'; fs::copy_file(input, output, fs::copy_options::overwrite_existing); return 0; - } + }} }, { - .target = "many_to_one", - .sources = { + ctor::target("many_to_one"), + ctor::sources{ {"many_to_one.cc", ctor::source_type::generated} } }, { - .target = "many_to_one.cc", - .sources = { + ctor::target("many_to_one.cc"), + ctor::sources{ {"hello.cc"}, }, - .function = [](const std::vector<std::string>& input, + ctor::GeneratorManyToOne{[](const std::vector<std::string>& input, const std::string& output, const ctor::build_configuration& config, const ctor::settings& settings) @@ -76,7 +76,7 @@ ctor::build_configurations ctorConfigs(const ctor::settings& settings) } ofs << "*/\n"; return 0; - } + }} }, }; diff --git a/test/suite/ctor_files/ctor.cc.multi b/test/suite/ctor_files/ctor.cc.multi index 157d96c..419f982 100644 --- a/test/suite/ctor_files/ctor.cc.multi +++ b/test/suite/ctor_files/ctor.cc.multi @@ -13,12 +13,12 @@ ctor::build_configurations ctorConfigs(const ctor::settings& settings) return { { - .name = "hello", - .target = "hello", - .sources = { + ctor::name("hello"), + ctor::target("hello"), + ctor::sources{ "hello.cc", }, - .flags = { + ctor::flags{ .cxxflags = { "-std=c++20", "-O3", @@ -28,7 +28,7 @@ ctor::build_configurations ctorConfigs(const ctor::settings& settings) "-fexceptions", }, }, - .externals = {"bar"}, + ctor::externals({"bar"}), } }; } diff --git a/test/tasks_test.cc b/test/tasks_test.cc index 1276347..32bed5a 100644 --- a/test/tasks_test.cc +++ b/test/tasks_test.cc @@ -10,12 +10,12 @@ ctor::build_configurations ctorTestConfigs1(const ctor::settings&) return { { - .name = "Target1", - .target = "target1", - .sources = {"foo.cc", "bar.c"}, + ctor::name("Target1"), + ctor::target("target1"), + ctor::sources({"foo.cc", "bar.c"}), }, { - .target = "target2", + ctor::target("target2"), }, }; } @@ -25,10 +25,10 @@ ctor::build_configurations ctorTestConfigs2(const ctor::settings&) return { { - .target = "target3", + ctor::target("target3"), }, { - .target = "target4", + ctor::target("target4"), }, }; } |
