Tests fixed again

This commit is contained in:
Piotr Kosek 2018-08-31 17:53:40 +02:00
parent b5b478d805
commit db287125b5

View File

@ -325,7 +325,7 @@ class EnumTests : public CxxTest::TestSuite {
TS_ASSERT_EQUALS((+Compression::None)._to_index(), 0);
TS_ASSERT_EQUALS((+Compression::Huffman)._to_index(), 1);
TS_ASSERT_EQUALS((+Compression::Default)._to_index(), 2);
// TS_ASSERT_EQUALS((+Compression::Default)._to_index(), 2); // This won't pass as Compression::Huffman == Compression::Default
}
void test_from_index()
@ -347,45 +347,45 @@ class EnumTests : public CxxTest::TestSuite {
void test_from_index_nothrow()
{
better_enums::optional<Channel> maybe_channel = Channel::_from_index(0);
better_enums::optional<Channel> maybe_channel = Channel::_from_index_nothrow(0);
TS_ASSERT(maybe_channel);
TS_ASSERT_EQUALS(*maybe_channel, +Channel::Red);
maybe_channel = Channel::_from_index(1);
maybe_channel = Channel::_from_index_nothrow(1);
TS_ASSERT(maybe_channel);
TS_ASSERT_EQUALS(*maybe_channel, +Channel::Green);
maybe_channel = Channel::_from_index(2);
maybe_channel = Channel::_from_index_nothrow(2);
TS_ASSERT(maybe_channel);
TS_ASSERT_EQUALS(*maybe_channel, +Channel::Blue);
maybe_channel = Channel::_from_index(45);
maybe_channel = Channel::_from_index_nothrow(45);
TS_ASSERT(!maybe_channel);
better_enums::optional<Depth> maybe_depth = Depth::_from_index(0);
better_enums::optional<Depth> maybe_depth = Depth::_from_index_nothrow(0);
TS_ASSERT(maybe_depth);
TS_ASSERT_EQUALS(*maybe_depth, +Depth::HighColor);
maybe_depth = Depth::_from_index(1);
maybe_depth = Depth::_from_index_nothrow(1);
TS_ASSERT(maybe_depth);
TS_ASSERT_EQUALS(*maybe_depth, +Depth::TrueColor);
maybe_depth = Depth::_from_index(45);
maybe_depth = Depth::_from_index_nothrow(45);
TS_ASSERT(!maybe_depth);
better_enums::optional<Compression> maybe_compression = Compression::_from_index(0);
better_enums::optional<Compression> maybe_compression = Compression::_from_index_nothrow(0);
TS_ASSERT(maybe_compression);
TS_ASSERT_EQUALS(*maybe_compression, +Compression::None);
maybe_compression = Compression::_from_index(1);
maybe_compression = Compression::_from_index_nothrow(1);
TS_ASSERT(maybe_compression);
TS_ASSERT_EQUALS(*maybe_compression, +Compression::Huffman);
maybe_compression = Compression::_from_index(2);
maybe_compression = Compression::_from_index_nothrow(2);
TS_ASSERT(maybe_compression);
TS_ASSERT_EQUALS(*maybe_compression, +Compression::Default);
maybe_compression = Compression::_from_index(45);
maybe_compression = Compression::_from_index_nothrow(45);
TS_ASSERT(!maybe_compression);
}