Add tests for exception.cpp file 88/315988/3
authorLe <xuan.tien@samsung.com>
Mon, 12 Aug 2024 07:14:18 +0000 (14:14 +0700)
committerTien Le <xuan.tien@samsung.com>
Tue, 20 Aug 2024 07:27:07 +0000 (07:27 +0000)
Change-Id: I2db625d9100e88941c51aa126c5713621c6606c9
Signed-off-by: Le <xuan.tien@samsung.com>
unit-tests/CMakeLists.txt
unit-tests/test_vcore_exception.cpp [new file with mode: 0644]

index 8bcf483ad210bb7601d043ea248e162f9de2c5bb..d92b441a0d6126a1bb44035af9705ce9d07e96ea 100644 (file)
@@ -78,6 +78,7 @@ SET(UNIT_TESTS_SOURCES
     test_vcore_signature_validator.cpp
     test_vcore_certificate.cpp
     test_vcore_saxreader.cpp
+    test_vcore_exception.cpp
     test_cert_server_db.cpp
     test_cert_server_logic.cpp
     colour_log_formatter.cpp
diff --git a/unit-tests/test_vcore_exception.cpp b/unit-tests/test_vcore_exception.cpp
new file mode 100644 (file)
index 0000000..816bfaa
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+#include "test_macros.h"
+#include "vcore/exception.h"
+
+using namespace ValidationCore;
+
+BOOST_AUTO_TEST_SUITE(T_VCORE_EXCEPTION)
+
+POSITIVE_TEST_CASE(T_positive_exception)
+{
+       BOOST_CHECK_NO_THROW(LogUnhandledException("Unknown exception!"));
+       BOOST_CHECK_NO_THROW(
+               LogUnhandledException(
+                       "Unknown exception!",
+                       "test_vcore_exception.cpp",
+                       31,
+                       "LogUnhandledException"));
+}
+
+BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file