From 570ffc0bd9c55719c2b6dd6ae737d12921343760 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:04:46 +0200
Subject: [PATCH] Add tests for DiscreteFunctionType

---
 src/scheme/DiscreteFunctionType.hpp |  2 ++
 tests/CMakeLists.txt                |  1 +
 tests/test_DiscreteFunctionType.cpp | 15 +++++++++++++++
 3 files changed, 18 insertions(+)
 create mode 100644 tests/test_DiscreteFunctionType.cpp

diff --git a/src/scheme/DiscreteFunctionType.hpp b/src/scheme/DiscreteFunctionType.hpp
index 8532a25e9..6dd002be6 100644
--- a/src/scheme/DiscreteFunctionType.hpp
+++ b/src/scheme/DiscreteFunctionType.hpp
@@ -21,7 +21,9 @@ name(DiscreteFunctionType type)
   case DiscreteFunctionType::P0Vector:
     return "P0Vector";
   }
+  // LCOV_EXCL_START
   return {};
+  // LCOV_EXCL_STOP
 }
 
 #endif   // DISCRETE_FUNCTION_TYPE_HPP
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index c36830918..862e2b79e 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_DiscreteFunctionType.cpp
   test_DoWhileProcessor.cpp
   test_EmbeddedData.cpp
   test_EscapedString.cpp
diff --git a/tests/test_DiscreteFunctionType.cpp b/tests/test_DiscreteFunctionType.cpp
new file mode 100644
index 000000000..c5e00470e
--- /dev/null
+++ b/tests/test_DiscreteFunctionType.cpp
@@ -0,0 +1,15 @@
+#include <catch2/catch_test_macros.hpp>
+#include <catch2/matchers/catch_matchers_all.hpp>
+
+#include <scheme/DiscreteFunctionType.hpp>
+
+// clazy:excludeall=non-pod-global-static
+
+TEST_CASE("DiscreteFunctionType", "[scheme]")
+{
+  SECTION("name")
+  {
+    REQUIRE(name(DiscreteFunctionType::P0) == "P0");
+    REQUIRE(name(DiscreteFunctionType::P0Vector) == "P0Vector");
+  }
+}
-- 
GitLab