Add test for constructor consistency

This commit is contained in:
fekir 2017-08-19 09:18:28 +02:00
parent 67ac88fb1e
commit b2f059e188

View File

@ -13,6 +13,8 @@
#include <gtest/gtest.h>
#include <string>
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());
}
}