From f43321463ba8a765fd13f19fa75cdb9b1065e787 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:22:49 +0200 Subject: [PATCH] Add tests for DiscreteFunctionDescriptorP0Vector --- tests/CMakeLists.txt | 1 + ...est_DiscreteFunctionDescriptorP0Vector.cpp | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 tests/test_DiscreteFunctionDescriptorP0Vector.cpp diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e67d55b06..a48a72fba 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -59,6 +59,7 @@ add_executable (unit_tests test_DataVariant.cpp test_Demangle.cpp test_DiscreteFunctionDescriptorP0.cpp + test_DiscreteFunctionDescriptorP0Vector.cpp test_DiscreteFunctionType.cpp test_DoWhileProcessor.cpp test_EmbeddedData.cpp diff --git a/tests/test_DiscreteFunctionDescriptorP0Vector.cpp b/tests/test_DiscreteFunctionDescriptorP0Vector.cpp new file mode 100644 index 000000000..4aa605ec4 --- /dev/null +++ b/tests/test_DiscreteFunctionDescriptorP0Vector.cpp @@ -0,0 +1,25 @@ +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> + +#include <scheme/DiscreteFunctionDescriptorP0Vector.hpp> + +// clazy:excludeall=non-pod-global-static + +TEST_CASE("DiscreteFunctionDescriptorP0Vector", "[scheme]") +{ + SECTION("type") + { + DiscreteFunctionDescriptorP0Vector descriptor; + REQUIRE(descriptor.type() == DiscreteFunctionType::P0Vector); + + { + auto copy = [](const DiscreteFunctionDescriptorP0Vector& d) -> DiscreteFunctionDescriptorP0Vector { return d; }; + + DiscreteFunctionDescriptorP0Vector descriptor_copy{copy(descriptor)}; + REQUIRE(descriptor_copy.type() == DiscreteFunctionType::P0Vector); + } + + DiscreteFunctionDescriptorP0Vector descriptor_move{std::move(DiscreteFunctionDescriptorP0Vector{})}; + REQUIRE(descriptor_move.type() == DiscreteFunctionType::P0Vector); + } +} -- GitLab