From b2cfe7da881b674c873c1db46bf74dd31c2cc23d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Del=20Pino?= <stephane.delpino44@gmail.com> Date: Mon, 19 Apr 2021 11:16:13 +0200 Subject: [PATCH] Add tests for DiscreteFunctionDescriptorP0 --- tests/CMakeLists.txt | 1 + tests/test_DiscreteFunctionDescriptorP0.cpp | 25 +++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 tests/test_DiscreteFunctionDescriptorP0.cpp diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 862e2b79e..e67d55b06 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -58,6 +58,7 @@ add_executable (unit_tests test_CRSMatrix.cpp test_DataVariant.cpp test_Demangle.cpp + test_DiscreteFunctionDescriptorP0.cpp test_DiscreteFunctionType.cpp test_DoWhileProcessor.cpp test_EmbeddedData.cpp diff --git a/tests/test_DiscreteFunctionDescriptorP0.cpp b/tests/test_DiscreteFunctionDescriptorP0.cpp new file mode 100644 index 000000000..3cc11f7d4 --- /dev/null +++ b/tests/test_DiscreteFunctionDescriptorP0.cpp @@ -0,0 +1,25 @@ +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> + +#include <scheme/DiscreteFunctionDescriptorP0.hpp> + +// clazy:excludeall=non-pod-global-static + +TEST_CASE("DiscreteFunctionDescriptorP0", "[scheme]") +{ + SECTION("type") + { + DiscreteFunctionDescriptorP0 descriptor; + REQUIRE(descriptor.type() == DiscreteFunctionType::P0); + + { + auto copy = [](const DiscreteFunctionDescriptorP0& d) -> DiscreteFunctionDescriptorP0 { return d; }; + + DiscreteFunctionDescriptorP0 descriptor_copy{copy(descriptor)}; + REQUIRE(descriptor_copy.type() == DiscreteFunctionType::P0); + } + + DiscreteFunctionDescriptorP0 descriptor_move{std::move(DiscreteFunctionDescriptorP0{})}; + REQUIRE(descriptor_move.type() == DiscreteFunctionType::P0); + } +} -- GitLab