From 218abfd90286dd906f28c368802fd755808f1ab9 Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 14 Mar 2024 00:51:32 +0800 Subject: improve tests --- tests/projects/c++/modules/partitions2/src/math.cpp | 15 --------------- tests/projects/c++/modules/partitions2/src/math.mpp | 7 ------- .../projects/c++/modules/partitions2/src/math_helpers.mpp | 7 ------- tests/projects/c++/modules/partitions2/src/test.cpp | 7 ------- tests/projects/c++/modules/partitions2/test.lua | 1 - tests/projects/c++/modules/partitions2/xmake.lua | 6 ------ .../partitions_implunit/src/BasicPlane.Figures-Point.mpp | 5 ----- .../src/BasicPlane.Figures-Rectangle.cpp | 7 ------- .../src/BasicPlane.Figures-Rectangle.mpp | 11 ----------- .../partitions_implunit/src/BasicPlane.Figures.mpp | 4 ---- .../modules/partitions_implunit/src/ModulesTutorial.cpp | 10 ---------- .../projects/c++/modules/partitions_implunit/src/math.cpp | 15 +++++++++++++++ .../projects/c++/modules/partitions_implunit/src/math.mpp | 7 +++++++ .../c++/modules/partitions_implunit/src/math_impl.mpp | 7 +++++++ .../projects/c++/modules/partitions_implunit/src/test.cpp | 7 +++++++ tests/projects/c++/modules/partitions_implunit/xmake.lua | 7 +++---- 16 files changed, 39 insertions(+), 84 deletions(-) delete mode 100644 tests/projects/c++/modules/partitions2/src/math.cpp delete mode 100644 tests/projects/c++/modules/partitions2/src/math.mpp delete mode 100644 tests/projects/c++/modules/partitions2/src/math_helpers.mpp delete mode 100644 tests/projects/c++/modules/partitions2/src/test.cpp delete mode 100644 tests/projects/c++/modules/partitions2/test.lua delete mode 100644 tests/projects/c++/modules/partitions2/xmake.lua delete mode 100644 tests/projects/c++/modules/partitions_implunit/src/BasicPlane.Figures-Point.mpp delete mode 100644 tests/projects/c++/modules/partitions_implunit/src/BasicPlane.Figures-Rectangle.cpp delete mode 100644 tests/projects/c++/modules/partitions_implunit/src/BasicPlane.Figures-Rectangle.mpp delete mode 100644 tests/projects/c++/modules/partitions_implunit/src/BasicPlane.Figures.mpp delete mode 100644 tests/projects/c++/modules/partitions_implunit/src/ModulesTutorial.cpp create mode 100644 tests/projects/c++/modules/partitions_implunit/src/math.cpp create mode 100644 tests/projects/c++/modules/partitions_implunit/src/math.mpp create mode 100644 tests/projects/c++/modules/partitions_implunit/src/math_impl.mpp create mode 100644 tests/projects/c++/modules/partitions_implunit/src/test.cpp (limited to 'tests/projects/c++/modules') diff --git a/tests/projects/c++/modules/partitions2/src/math.cpp b/tests/projects/c++/modules/partitions2/src/math.cpp deleted file mode 100644 index 3a10c8203..000000000 --- a/tests/projects/c++/modules/partitions2/src/math.cpp +++ /dev/null @@ -1,15 +0,0 @@ -module math; - -import :details; - -double Math::superLog(double z, double b) -{ - // Implementation omitted... - return someHelperFunction(z); -} - -double Math::lerchZeta(double lambda, double alpha, double s) -{ - // Implementation omitted... - return someHelperFunction(s); -} diff --git a/tests/projects/c++/modules/partitions2/src/math.mpp b/tests/projects/c++/modules/partitions2/src/math.mpp deleted file mode 100644 index 9e2552513..000000000 --- a/tests/projects/c++/modules/partitions2/src/math.mpp +++ /dev/null @@ -1,7 +0,0 @@ -export module math; // math module declaration - -export namespace Math -{ - double superLog(double z, double b); - double lerchZeta(double lambda, double alpha, double s); -} diff --git a/tests/projects/c++/modules/partitions2/src/math_helpers.mpp b/tests/projects/c++/modules/partitions2/src/math_helpers.mpp deleted file mode 100644 index a92cb5e4a..000000000 --- a/tests/projects/c++/modules/partitions2/src/math_helpers.mpp +++ /dev/null @@ -1,7 +0,0 @@ -export module math:details; // math:details implementation partition - -double someHelperFunction(double a) -{ - // Implementation omitted... - return 42; -} diff --git a/tests/projects/c++/modules/partitions2/src/test.cpp b/tests/projects/c++/modules/partitions2/src/test.cpp deleted file mode 100644 index 8f7f81b2c..000000000 --- a/tests/projects/c++/modules/partitions2/src/test.cpp +++ /dev/null @@ -1,7 +0,0 @@ -import math; - -int main() -{ - auto a{ Math::lerchZeta(1, 2, 3) }; - auto b{ Math::superLog(1, 2) }; -} diff --git a/tests/projects/c++/modules/partitions2/test.lua b/tests/projects/c++/modules/partitions2/test.lua deleted file mode 100644 index e77adc4ae..000000000 --- a/tests/projects/c++/modules/partitions2/test.lua +++ /dev/null @@ -1 +0,0 @@ -inherit(".test_stdmodules") diff --git a/tests/projects/c++/modules/partitions2/xmake.lua b/tests/projects/c++/modules/partitions2/xmake.lua deleted file mode 100644 index 9e0ab37bb..000000000 --- a/tests/projects/c++/modules/partitions2/xmake.lua +++ /dev/null @@ -1,6 +0,0 @@ -add_rules("mode.release", "mode.debug") -set_languages("c++20") - -target("partition2") - set_kind("binary") - add_files("src/*.cpp", "src/*.mpp") diff --git a/tests/projects/c++/modules/partitions_implunit/src/BasicPlane.Figures-Point.mpp b/tests/projects/c++/modules/partitions_implunit/src/BasicPlane.Figures-Point.mpp deleted file mode 100644 index e693edcc0..000000000 --- a/tests/projects/c++/modules/partitions_implunit/src/BasicPlane.Figures-Point.mpp +++ /dev/null @@ -1,5 +0,0 @@ -export module BasicPlane.Figures:Point; - -export struct Point { - int x, y; -}; diff --git a/tests/projects/c++/modules/partitions_implunit/src/BasicPlane.Figures-Rectangle.cpp b/tests/projects/c++/modules/partitions_implunit/src/BasicPlane.Figures-Rectangle.cpp deleted file mode 100644 index ca05e05a1..000000000 --- a/tests/projects/c++/modules/partitions_implunit/src/BasicPlane.Figures-Rectangle.cpp +++ /dev/null @@ -1,7 +0,0 @@ -module; - -module BasicPlane.Figures; - -int area(const Rectangle& r) { return width(r) * height(r); } -int height(const Rectangle& r) { return r.ul.y - r.lr.y; } -int width(const Rectangle& r) { return r.lr.x - r.ul.x; } diff --git a/tests/projects/c++/modules/partitions_implunit/src/BasicPlane.Figures-Rectangle.mpp b/tests/projects/c++/modules/partitions_implunit/src/BasicPlane.Figures-Rectangle.mpp deleted file mode 100644 index 84467d480..000000000 --- a/tests/projects/c++/modules/partitions_implunit/src/BasicPlane.Figures-Rectangle.mpp +++ /dev/null @@ -1,11 +0,0 @@ -export module BasicPlane.Figures:Rectangle; - -import :Point; - -export struct Rectangle { - Point ul, lr; -}; - -export int area(const Rectangle& r); -export int height(const Rectangle& r); -export int width(const Rectangle& r); diff --git a/tests/projects/c++/modules/partitions_implunit/src/BasicPlane.Figures.mpp b/tests/projects/c++/modules/partitions_implunit/src/BasicPlane.Figures.mpp deleted file mode 100644 index f471e1436..000000000 --- a/tests/projects/c++/modules/partitions_implunit/src/BasicPlane.Figures.mpp +++ /dev/null @@ -1,4 +0,0 @@ -export module BasicPlane.Figures; - -export import :Point; -export import :Rectangle; diff --git a/tests/projects/c++/modules/partitions_implunit/src/ModulesTutorial.cpp b/tests/projects/c++/modules/partitions_implunit/src/ModulesTutorial.cpp deleted file mode 100644 index 130a5778c..000000000 --- a/tests/projects/c++/modules/partitions_implunit/src/ModulesTutorial.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include - -import BasicPlane.Figures; - -int main(int argc, char** argv) { - Rectangle r{ {1,8}, {11,3} }; - std::cout << "area: " << area(r) << '\n'; - std::cout << "width: " << width(r) << '\n'; - return 0; -} diff --git a/tests/projects/c++/modules/partitions_implunit/src/math.cpp b/tests/projects/c++/modules/partitions_implunit/src/math.cpp new file mode 100644 index 000000000..3a10c8203 --- /dev/null +++ b/tests/projects/c++/modules/partitions_implunit/src/math.cpp @@ -0,0 +1,15 @@ +module math; + +import :details; + +double Math::superLog(double z, double b) +{ + // Implementation omitted... + return someHelperFunction(z); +} + +double Math::lerchZeta(double lambda, double alpha, double s) +{ + // Implementation omitted... + return someHelperFunction(s); +} diff --git a/tests/projects/c++/modules/partitions_implunit/src/math.mpp b/tests/projects/c++/modules/partitions_implunit/src/math.mpp new file mode 100644 index 000000000..9e2552513 --- /dev/null +++ b/tests/projects/c++/modules/partitions_implunit/src/math.mpp @@ -0,0 +1,7 @@ +export module math; // math module declaration + +export namespace Math +{ + double superLog(double z, double b); + double lerchZeta(double lambda, double alpha, double s); +} diff --git a/tests/projects/c++/modules/partitions_implunit/src/math_impl.mpp b/tests/projects/c++/modules/partitions_implunit/src/math_impl.mpp new file mode 100644 index 000000000..a92cb5e4a --- /dev/null +++ b/tests/projects/c++/modules/partitions_implunit/src/math_impl.mpp @@ -0,0 +1,7 @@ +export module math:details; // math:details implementation partition + +double someHelperFunction(double a) +{ + // Implementation omitted... + return 42; +} diff --git a/tests/projects/c++/modules/partitions_implunit/src/test.cpp b/tests/projects/c++/modules/partitions_implunit/src/test.cpp new file mode 100644 index 000000000..8f7f81b2c --- /dev/null +++ b/tests/projects/c++/modules/partitions_implunit/src/test.cpp @@ -0,0 +1,7 @@ +import math; + +int main() +{ + auto a{ Math::lerchZeta(1, 2, 3) }; + auto b{ Math::superLog(1, 2) }; +} diff --git a/tests/projects/c++/modules/partitions_implunit/xmake.lua b/tests/projects/c++/modules/partitions_implunit/xmake.lua index a777846e3..9e0ab37bb 100644 --- a/tests/projects/c++/modules/partitions_implunit/xmake.lua +++ b/tests/projects/c++/modules/partitions_implunit/xmake.lua @@ -1,7 +1,6 @@ add_rules("mode.release", "mode.debug") set_languages("c++20") -target("foo") - set_kind("static") - add_files("src/*.cpp") - add_files("src/*.mpp") +target("partition2") + set_kind("binary") + add_files("src/*.cpp", "src/*.mpp") -- cgit v1.3.1