diff --git a/ChaosTests/CMakeLists.txt b/ChaosTests/CMakeLists.txt index b2564b6..1aa05df 100644 --- a/ChaosTests/CMakeLists.txt +++ b/ChaosTests/CMakeLists.txt @@ -18,7 +18,8 @@ set(ChaosTests_SOURCE Hash/Md4HasherTests.cpp Cipher/Arc4GenTests.cpp Cipher/Arc4CryptTests.cpp Cipher/DesCryptTests.cpp - Service/SeArrayTests.cpp) + Service/SeArrayTests.cpp + Service/ChaosExceptionTests.cpp) add_executable(ChaosTests ${ChaosTests_SOURCE}) target_link_libraries(ChaosTests gtest gtest_main) diff --git a/ChaosTests/Service/ChaosExceptionTests.cpp b/ChaosTests/Service/ChaosExceptionTests.cpp new file mode 100644 index 0000000..136c5d4 --- /dev/null +++ b/ChaosTests/Service/ChaosExceptionTests.cpp @@ -0,0 +1,32 @@ +#include +#include + +#include "Service/ChaosException.hpp" + +using namespace Chaos::Service; + +TEST(ChaosExceptionTests, RvalueRefCtorTest) +{ + try + { + throw ChaosException("everything's alright :D"); + } + catch (const ChaosException & ex) + { + ASSERT_EQ("everything's alright :D", ex.GetMessage()); + } +} + +TEST(ChaosExceptionTests, ConstLvalueRefCtorTest) +{ + const std::string message = "everything's alright :D"; + + try + { + throw ChaosException(message); + } + catch (const ChaosException & ex) + { + ASSERT_EQ("everything's alright :D", ex.GetMessage()); + } +}