From 213f08fdcbb5bd2cf31b5f94d00cf02a261eadd3 Mon Sep 17 00:00:00 2001
From: Stephane Del Pino <stephane.delpino44@gmail.com>
Date: Mon, 11 Jun 2018 16:28:40 +0200
Subject: [PATCH] Added PastisAssert unit tests

---
 tests/CMakeLists.txt        |  1 +
 tests/test_PastisAssert.cpp | 17 +++++++++++++++++
 2 files changed, 18 insertions(+)
 create mode 100644 tests/test_PastisAssert.cpp

diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index de3c3ebeb..38635a1d7 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -3,6 +3,7 @@ include_directories("${CATCH_INCLUDE_PATH}")
 set(EXECUTABLE_OUTPUT_PATH ${PASTIS_BINARY_DIR})
 add_executable (unit_tests
   test_main.cpp
+  test_PastisAssert.cpp
   test_RevisionInfo.cpp
   test_TinyMatrix.cpp
   test_TinyVector.cpp)
diff --git a/tests/test_PastisAssert.cpp b/tests/test_PastisAssert.cpp
new file mode 100644
index 000000000..8d07321a1
--- /dev/null
+++ b/tests/test_PastisAssert.cpp
@@ -0,0 +1,17 @@
+#include <catch.hpp>
+
+#include <PastisAssert.hpp>
+#include <string>
+
+TEST_CASE("PastisAssert", "[assert]") {
+  SECTION("checking for assert error") {
+    const std::string filename = "filename";
+    const int line = 10;
+    const std::string function = "function";
+    const std::string message = "message";
+
+    AssertError assert_error(filename, line, function, message);
+
+    REQUIRE(Catch::Detail::stringify(assert_error) == "\n*** Assertion error ***\n at filename:10\n in function\n*** message\n");
+  }
+}
-- 
GitLab