From b2f059e188b9dd5c0b0b7618fb2a8417abbd6c6a Mon Sep 17 00:00:00 2001 From: fekir Date: Sat, 19 Aug 2017 09:18:28 +0200 Subject: [PATCH] Add test for constructor consistency --- tests/Exception_test.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/Exception_test.cpp b/tests/Exception_test.cpp index 621c9c8..9a71c10 100644 --- a/tests/Exception_test.cpp +++ b/tests/Exception_test.cpp @@ -13,6 +13,8 @@ #include +#include + TEST(Exception, copy) { const SQLite::Exception ex1("some error", 2); const SQLite::Exception ex2 = ex1; @@ -42,3 +44,19 @@ TEST(Exception, throw_catch) { EXPECT_STREQ(ex.what(), message); } } + + +TEST(Exception, constructor) { + const char msg1[] = "error msg"; + std::string msg2 = msg1; + { + const SQLite::Exception ex1(msg1); + const SQLite::Exception ex2(msg2); + EXPECT_STREQ(ex1.what(), ex2.what()); + } + { + const SQLite::Exception ex1(msg1, 1); + const SQLite::Exception ex2(msg2, 1); + EXPECT_STREQ(ex1.what(), ex2.what()); + } +}