From a786b399d67f8aac79ded71bd1f0e0999ce3a0bb Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 19 Aug 2013 22:59:16 +0300 Subject: add some unit tests for normal dye. --- src/resources/dye_unittest.cc | 46 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'src/resources') diff --git a/src/resources/dye_unittest.cc b/src/resources/dye_unittest.cc index 5898f5665..05e3401a6 100644 --- a/src/resources/dye_unittest.cc +++ b/src/resources/dye_unittest.cc @@ -206,3 +206,49 @@ TEST(Dye, replaceAColor3) EXPECT_EQ(0x20, data[2]); EXPECT_EQ(0x10, data[3]); } + +TEST(Dye, normalDye1) +{ + Dye dye("R:#203040,506070"); + uint8_t data[4]; + data[0] = 0x55; + data[1] = 0x00; + data[2] = 0x00; + data[3] = 0x50; + dye.normalDye(reinterpret_cast(&data[0]), 1); + EXPECT_EQ(0x55, data[0]); + EXPECT_EQ(0x28, data[1]); + EXPECT_EQ(0x1e, data[2]); + EXPECT_EQ(0x14, data[3]); +} + +TEST(Dye, normalDye2) +{ + Dye dye("G:#203040,506070"); + uint8_t data[4]; + data[0] = 0x60; + data[1] = 0x00; + data[2] = 0x50; + data[3] = 0x00; + dye.normalDye(reinterpret_cast(&data[0]), 1); + EXPECT_EQ(0x60, data[0]); + EXPECT_EQ(0x28, data[1]); + EXPECT_EQ(0x1e, data[2]); + EXPECT_EQ(0x14, data[3]); +} + +TEST(Dye, normalOGLDye1) +{ + Dye dye("R:#203040,506070"); + uint8_t data[4]; + data[0] = 0x55; + data[1] = 0x00; + data[2] = 0x00; + data[3] = 0x50; + dye.normalOGLDye(reinterpret_cast(&data[0]), 1); + EXPECT_EQ(0x15, data[0]); + EXPECT_EQ(0x20, data[1]); + EXPECT_EQ(0x2a, data[2]); + EXPECT_EQ(0x50, data[3]); +} + -- cgit v1.2.3-70-g09d2