Removed rangechecked_cast was not working as I hoped.
This commit is contained in:
parent
404d4c856a
commit
817a371220
6 changed files with 4 additions and 58 deletions
|
|
@ -20,7 +20,6 @@ SOURCES += main.cpp \
|
|||
tst_escapeConnectionStringValue.cpp \
|
||||
tst_expected.cpp \
|
||||
tst_SqlLexer.cpp \
|
||||
tst_rangechecked_cast.cpp \
|
||||
tst_scopeguard.cpp \
|
||||
tst_CsvWriter.cpp \
|
||||
tst_PasswordManager.cpp \
|
||||
|
|
|
|||
|
|
@ -1,35 +0,0 @@
|
|||
#include <gtest/gtest.h>
|
||||
#include <gmock/gmock-matchers.h>
|
||||
#include "rangechecked_cast.h"
|
||||
#include "PrintTo_Qt.h"
|
||||
|
||||
using namespace testing;
|
||||
|
||||
|
||||
TEST(rangechecked_cast, in_range)
|
||||
{
|
||||
ASSERT_NO_THROW({
|
||||
int8_t in = 42;
|
||||
int expected = 42;
|
||||
auto output = rangechecked_cast<int>(in);
|
||||
ASSERT_EQ(output, expected);
|
||||
});
|
||||
}
|
||||
|
||||
TEST(rangechecked_cast, above_max)
|
||||
{
|
||||
int64_t in = std::numeric_limits<int>::max() + static_cast<int64_t>(1);
|
||||
ASSERT_THROW({
|
||||
rangechecked_cast<int>(in);
|
||||
},
|
||||
std::runtime_error);
|
||||
}
|
||||
|
||||
TEST(rangechecked_cast, below_lowest)
|
||||
{
|
||||
int64_t in = std::numeric_limits<int>::lowest() - static_cast<int64_t>(1);
|
||||
ASSERT_THROW({
|
||||
rangechecked_cast<int>(in);
|
||||
},
|
||||
std::runtime_error);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue