diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-26 22:30:49 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-26 22:43:52 +0300 |
commit | 571e462e438af287be70dd02f91401faab945d6b (patch) | |
tree | fcd6a4218f4fdb6c9def3dd44d24de21e0fcc401 | |
parent | e54fc3b08b3e8c3be1544a5716bf66e7173f4c21 (diff) | |
download | manaplus-571e462e438af287be70dd02f91401faab945d6b.tar.gz manaplus-571e462e438af287be70dd02f91401faab945d6b.tar.bz2 manaplus-571e462e438af287be70dd02f91401faab945d6b.tar.xz manaplus-571e462e438af287be70dd02f91401faab945d6b.zip |
Convert tests for dye into catch format.
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/resources/dye_unittest.cc | 154 |
2 files changed, 79 insertions, 79 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index d3eda3912..de4f78e1f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1520,8 +1520,8 @@ manaplustests_SOURCES = ${manaplus_SOURCES} \ gui/widgets/browserbox_unittest.cc \ utils/files_unittest.cc \ utils/stringutils_unittest.cc \ - utils/xmlutils_unittest.cc -# resources/dye_unittest.cc \ + utils/xmlutils_unittest.cc \ + resources/dye_unittest.cc # resources/mstack_unittest.cc endif diff --git a/src/resources/dye_unittest.cc b/src/resources/dye_unittest.cc index 2dfac7c52..aeee85e12 100644 --- a/src/resources/dye_unittest.cc +++ b/src/resources/dye_unittest.cc @@ -18,15 +18,15 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "catch.hpp" + #include "resources/dye.h" #include "resources/dyepalette.h" -#include "gtest/gtest.h" - #include "debug.h" -TEST(Dye, replaceSOGLColor1) +TEST_CASE("Dye replaceSOGLColor 1") { DyePalette palette("#00ff00,000011", 6); uint8_t data[4]; @@ -35,13 +35,13 @@ TEST(Dye, replaceSOGLColor1) data[2] = 0x03; data[3] = 0x10; palette.replaceSOGLColor(reinterpret_cast<uint32_t*>(&data[0]), 1); - EXPECT_EQ(0x01, data[0]); - EXPECT_EQ(0x02, data[1]); - EXPECT_EQ(0x03, data[2]); - EXPECT_EQ(0x10, data[3]); + REQUIRE(0x01 == data[0]); + REQUIRE(0x02 == data[1]); + REQUIRE(0x03 == data[2]); + REQUIRE(0x10 == data[3]); } -TEST(Dye, replaceSOGLColor2) +TEST_CASE("Dye replaceSOGLColor 2") { DyePalette palette("#01ff02,030411", 6); uint8_t data[4]; @@ -50,13 +50,13 @@ TEST(Dye, replaceSOGLColor2) data[2] = 0x02; data[3] = 0x20; palette.replaceSOGLColor(reinterpret_cast<uint32_t*>(&data[0]), 1); - EXPECT_EQ(0x03, data[0]); - EXPECT_EQ(0x04, data[1]); - EXPECT_EQ(0x11, data[2]); - EXPECT_EQ(0x20, data[3]); + REQUIRE(0x03 == data[0]); + REQUIRE(0x04 == data[1]); + REQUIRE(0x11 == data[2]); + REQUIRE(0x20 == data[3]); } -TEST(Dye, replaceSOGLColor3) +TEST_CASE("Dye replaceSOGLColor 3") { DyePalette palette("#404040,200000,0100ee,102030", 6); uint8_t data[4]; @@ -65,14 +65,14 @@ TEST(Dye, replaceSOGLColor3) data[2] = 0xee; data[3] = 0x40; palette.replaceSOGLColor(reinterpret_cast<uint32_t*>(&data[0]), 1); - EXPECT_EQ(0x10, data[0]); - EXPECT_EQ(0x20, data[1]); - EXPECT_EQ(0x30, data[2]); - EXPECT_EQ(0x40, data[3]); + REQUIRE(0x10 == data[0]); + REQUIRE(0x20 == data[1]); + REQUIRE(0x30 == data[2]); + REQUIRE(0x40 == data[3]); } -TEST(Dye, replaceAOGLColor1) +TEST_CASE("Dye replaceAOGLColor 1") { DyePalette palette("#00ff0010,00001120", 8); uint8_t data[4]; @@ -81,13 +81,13 @@ TEST(Dye, replaceAOGLColor1) data[2] = 0x03; data[3] = 0x10; palette.replaceAOGLColor(reinterpret_cast<uint32_t*>(&data[0]), 1); - EXPECT_EQ(0x01, data[0]); - EXPECT_EQ(0x02, data[1]); - EXPECT_EQ(0x03, data[2]); - EXPECT_EQ(0x10, data[3]); + REQUIRE(0x01 == data[0]); + REQUIRE(0x02 == data[1]); + REQUIRE(0x03 == data[2]); + REQUIRE(0x10 == data[3]); } -TEST(Dye, replaceAOGLColor2) +TEST_CASE("Dye replaceAOGLColor 2") { DyePalette palette("#00ff0120,020311ff", 8); uint8_t data[4]; @@ -96,13 +96,13 @@ TEST(Dye, replaceAOGLColor2) data[2] = 0x01; data[3] = 0x20; palette.replaceAOGLColor(reinterpret_cast<uint32_t*>(&data[0]), 1); - EXPECT_EQ(0x02, data[0]); - EXPECT_EQ(0x03, data[1]); - EXPECT_EQ(0x11, data[2]); - EXPECT_EQ(0xff, data[3]); + REQUIRE(0x02 == data[0]); + REQUIRE(0x03 == data[1]); + REQUIRE(0x11 == data[2]); + REQUIRE(0xff == data[3]); } -TEST(Dye, replaceAOGLColor3) +TEST_CASE("Dye replaceAOGLColor 3") { DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8); uint8_t data[4]; @@ -111,14 +111,14 @@ TEST(Dye, replaceAOGLColor3) data[2] = 0xee; data[3] = 0x40; palette.replaceAOGLColor(reinterpret_cast<uint32_t*>(&data[0]), 1); - EXPECT_EQ(0x10, data[0]); - EXPECT_EQ(0x20, data[1]); - EXPECT_EQ(0x30, data[2]); - EXPECT_EQ(0xff, data[3]); + REQUIRE(0x10 == data[0]); + REQUIRE(0x20 == data[1]); + REQUIRE(0x30 == data[2]); + REQUIRE(0xff == data[3]); } -TEST(Dye, replaceSColor1) +TEST_CASE("Dye replaceSColor 1") { DyePalette palette("#00ff00,000011", 6); uint8_t data[4]; @@ -127,13 +127,13 @@ TEST(Dye, replaceSColor1) data[2] = 0x03; data[3] = 0x10; palette.replaceSColor(reinterpret_cast<uint32_t*>(&data[0]), 1); - EXPECT_EQ(0x01, data[0]); - EXPECT_EQ(0x02, data[1]); - EXPECT_EQ(0x03, data[2]); - EXPECT_EQ(0x10, data[3]); + REQUIRE(0x01 == data[0]); + REQUIRE(0x02 == data[1]); + REQUIRE(0x03 == data[2]); + REQUIRE(0x10 == data[3]); } -TEST(Dye, replaceSColor2) +TEST_CASE("Dye replaceSColor 2") { DyePalette palette("#403020,706050", 6); uint8_t data[4]; @@ -142,13 +142,13 @@ TEST(Dye, replaceSColor2) data[2] = 0x30; data[3] = 0x40; palette.replaceSColor(reinterpret_cast<uint32_t*>(&data[0]), 1); - EXPECT_EQ(0x10, data[0]); - EXPECT_EQ(0x50, data[1]); - EXPECT_EQ(0x60, data[2]); - EXPECT_EQ(0x70, data[3]); + REQUIRE(0x10 == data[0]); + REQUIRE(0x50 == data[1]); + REQUIRE(0x60 == data[2]); + REQUIRE(0x70 == data[3]); } -TEST(Dye, replaceSColor3) +TEST_CASE("Dye replaceSColor 3") { DyePalette palette("#123456,000000,ff3020,706050", 6); uint8_t data[4]; @@ -157,14 +157,14 @@ TEST(Dye, replaceSColor3) data[2] = 0x30; data[3] = 0xff; palette.replaceSColor(reinterpret_cast<uint32_t*>(&data[0]), 1); - EXPECT_EQ(0x10, data[0]); - EXPECT_EQ(0x50, data[1]); - EXPECT_EQ(0x60, data[2]); - EXPECT_EQ(0x70, data[3]); + REQUIRE(0x10 == data[0]); + REQUIRE(0x50 == data[1]); + REQUIRE(0x60 == data[2]); + REQUIRE(0x70 == data[3]); } -TEST(Dye, replaceAColor1) +TEST_CASE("Dye replaceAColor 1") { DyePalette palette("#00ff0010,00001120", 8); uint8_t data[4]; @@ -173,13 +173,13 @@ TEST(Dye, replaceAColor1) data[2] = 0x03; data[3] = 0x10; palette.replaceAColor(reinterpret_cast<uint32_t*>(&data[0]), 1); - EXPECT_EQ(0x01, data[0]); - EXPECT_EQ(0x02, data[1]); - EXPECT_EQ(0x03, data[2]); - EXPECT_EQ(0x10, data[3]); + REQUIRE(0x01 == data[0]); + REQUIRE(0x02 == data[1]); + REQUIRE(0x03 == data[2]); + REQUIRE(0x10 == data[3]); } -TEST(Dye, replaceAColor2) +TEST_CASE("Dye replaceAColor 2") { DyePalette palette("#02ff0120,040311ff", 8); uint8_t data[4]; @@ -188,13 +188,13 @@ TEST(Dye, replaceAColor2) data[2] = 0xff; data[3] = 0x02; palette.replaceAColor(reinterpret_cast<uint32_t*>(&data[0]), 1); - EXPECT_EQ(0xff, data[0]); - EXPECT_EQ(0x11, data[1]); - EXPECT_EQ(0x03, data[2]); - EXPECT_EQ(0x04, data[3]); + REQUIRE(0xff == data[0]); + REQUIRE(0x11 == data[1]); + REQUIRE(0x03 == data[2]); + REQUIRE(0x04 == data[3]); } -TEST(Dye, replaceAColor3) +TEST_CASE("Dye replaceAColor 3") { DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8); uint8_t data[4]; @@ -203,13 +203,13 @@ TEST(Dye, replaceAColor3) data[2] = 0x00; data[3] = 0x01; palette.replaceAColor(reinterpret_cast<uint32_t*>(&data[0]), 1); - EXPECT_EQ(0xff, data[0]); - EXPECT_EQ(0x30, data[1]); - EXPECT_EQ(0x20, data[2]); - EXPECT_EQ(0x10, data[3]); + REQUIRE(0xff == data[0]); + REQUIRE(0x30 == data[1]); + REQUIRE(0x20 == data[2]); + REQUIRE(0x10 == data[3]); } -TEST(Dye, normalDye1) +TEST_CASE("Dye normalDye 1") { Dye dye("R:#203040,506070"); uint8_t data[4]; @@ -218,13 +218,13 @@ TEST(Dye, normalDye1) data[2] = 0x00; data[3] = 0x50; dye.normalDye(reinterpret_cast<uint32_t*>(&data[0]), 1); - EXPECT_EQ(0x55, data[0]); - EXPECT_EQ(0x28, data[1]); - EXPECT_EQ(0x1e, data[2]); - EXPECT_EQ(0x14, data[3]); + REQUIRE(0x55 == data[0]); + REQUIRE(0x28 == data[1]); + REQUIRE(0x1e == data[2]); + REQUIRE(0x14 == data[3]); } -TEST(Dye, normalDye2) +TEST_CASE("Dye normalDye 2") { Dye dye("G:#203040,506070"); uint8_t data[4]; @@ -233,13 +233,13 @@ TEST(Dye, normalDye2) data[2] = 0x50; data[3] = 0x00; dye.normalDye(reinterpret_cast<uint32_t*>(&data[0]), 1); - EXPECT_EQ(0x60, data[0]); - EXPECT_EQ(0x28, data[1]); - EXPECT_EQ(0x1e, data[2]); - EXPECT_EQ(0x14, data[3]); + REQUIRE(0x60 == data[0]); + REQUIRE(0x28 == data[1]); + REQUIRE(0x1e == data[2]); + REQUIRE(0x14 == data[3]); } -TEST(Dye, normalOGLDye1) +TEST_CASE("Dye normalOGLDye 1") { Dye dye("R:#203040,506070"); uint8_t data[4]; @@ -248,8 +248,8 @@ TEST(Dye, normalOGLDye1) data[2] = 0x00; data[3] = 0x50; dye.normalOGLDye(reinterpret_cast<uint32_t*>(&data[0]), 1); - EXPECT_EQ(0x15, data[0]); - EXPECT_EQ(0x20, data[1]); - EXPECT_EQ(0x2a, data[2]); - EXPECT_EQ(0x50, data[3]); + REQUIRE(0x15 == data[0]); + REQUIRE(0x20 == data[1]); + REQUIRE(0x2a == data[2]); + REQUIRE(0x50 == data[3]); } |