summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-08-19 22:59:16 +0300
committerAndrei Karas <akaras@inbox.ru>2013-08-19 23:03:59 +0300
commita786b399d67f8aac79ded71bd1f0e0999ce3a0bb (patch)
tree7a363ca7a499e86452acc4b2bb2d0205da461caf /src
parentfe9994c45c1e464125186ae14e482ae155d9ec53 (diff)
downloadmanaverse-a786b399d67f8aac79ded71bd1f0e0999ce3a0bb.tar.gz
manaverse-a786b399d67f8aac79ded71bd1f0e0999ce3a0bb.tar.bz2
manaverse-a786b399d67f8aac79ded71bd1f0e0999ce3a0bb.tar.xz
manaverse-a786b399d67f8aac79ded71bd1f0e0999ce3a0bb.zip
add some unit tests for normal dye.
Diffstat (limited to 'src')
-rw-r--r--src/resources/dye_unittest.cc46
1 files changed, 46 insertions, 0 deletions
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<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]);
+}
+
+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<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]);
+}
+
+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<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]);
+}
+