GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/unittests/resources/dye/dye.cc Lines: 1554 1554 100.0 %
Date: 2017-11-29 Branches: 3221 8514 37.8 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2013-2017  The ManaPlus Developers
4
 *
5
 *  This file is part of The ManaPlus Client.
6
 *
7
 *  This program is free software; you can redistribute it and/or modify
8
 *  it under the terms of the GNU General Public License as published by
9
 *  the Free Software Foundation; either version 2 of the License, or
10
 *  any later version.
11
 *
12
 *  This program is distributed in the hope that it will be useful,
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 *  GNU General Public License for more details.
16
 *
17
 *  You should have received a copy of the GNU General Public License
18
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
 */
20
21
#include "unittests/unittests.h"
22
23
#include "client.h"
24
#include "configmanager.h"
25
#include "configuration.h"
26
#include "dirs.h"
27
#include "graphicsmanager.h"
28
29
#include "being/actorsprite.h"
30
31
#include "fs/virtfs/fs.h"
32
33
#include "gui/userpalette.h"
34
#include "gui/theme.h"
35
36
#include "resources/sdlimagehelper.h"
37
#ifdef USE_SDL2
38
#include "resources/surfaceimagehelper.h"
39
#endif  // USE_SDL2
40
41
#include "resources/dye/dye.h"
42
#include "resources/dye/dyepalette.h"
43
44
#include "resources/image/image.h"
45
46
#include "resources/loaders/imageloader.h"
47
48
#include "utils/delete2.h"
49
#include "utils/env.h"
50
51
PRAGMA48(GCC diagnostic push)
52
PRAGMA48(GCC diagnostic ignored "-Wshadow")
53
#ifndef USE_SDL2
54
#include <SDL.h>
55
#endif  // USE_SDL2
56
PRAGMA48(GCC diagnostic pop)
57
58
#include "debug.h"
59
60
#ifdef USE_OPENGL
61
62
6
TEST_CASE("Dye replaceSOGLColor 1 1", "")
63
{
64

10
    DyePalette palette("#00ff00,000011", 6);
65
    uint32_t data[1];
66
2
    data[0] = buildHex(0x01, 0x02, 0x03, 0x10);
67

2
    DYEPALETTE(palette, SOGLColor)(&data[0], 1);
68



8
    REQUIRE(data[0] == buildHex(0x01, 0x02, 0x03, 0x10));
69
2
}
70
71
6
TEST_CASE("Dye replaceSOGLColor 1 2", "")
72
{
73

10
    DyePalette palette("#01ff02,030411", 6);
74
    uint32_t data[1];
75
2
    data[0] = buildHex(0x20, 0x02, 0xff, 0x01);
76

2
    DYEPALETTE(palette, SOGLColor)(&data[0], 1);
77



8
    REQUIRE(data[0] == buildHex(0x20, 0x11, 0x04, 0x03));
78
2
}
79
80
6
TEST_CASE("Dye replaceSOGLColor 1 3", "")
81
{
82

10
    DyePalette palette("#404040,200000,0100ee,102030", 6);
83
    uint32_t data[1];
84
2
    data[0] = buildHex(0x40, 0xee, 0x00, 0x01);
85

2
    DYEPALETTE(palette, SOGLColor)(&data[0], 1);
86



8
    REQUIRE(data[0] == buildHex(0x40, 0x30, 0x20, 0x10));
87
2
}
88
89
6
TEST_CASE("Dye replaceSOGLColor 2 1", "")
90
{
91

10
    DyePalette palette("#01ff02,030411", 6);
92
    uint32_t data[2];
93
2
    data[0] = buildHex(0x20, 0x02, 0xff, 0x01);
94
2
    data[1] = buildHex(0x30, 0x02, 0xff, 0x01);
95

2
    DYEPALETTE(palette, SOGLColor)(&data[0], 2);
96



8
    REQUIRE(data[0] == buildHex(0x20, 0x11, 0x04, 0x03));
97



8
    REQUIRE(data[1] == buildHex(0x30, 0x11, 0x04, 0x03));
98
2
}
99
100
6
TEST_CASE("Dye replaceSOGLColor 4 1", "")
101
{
102

10
    DyePalette palette("#01ff02,030411", 6);
103
    uint32_t data[4];
104
2
    data[0] = buildHex(0x20, 0x02, 0xff, 0x01);
105
2
    data[1] = buildHex(0x30, 0x02, 0xff, 0x01);
106
2
    data[2] = buildHex(0x40, 0x02, 0xff, 0x01);
107
2
    data[3] = buildHex(0x50, 0x02, 0xff, 0x02);
108

2
    DYEPALETTE(palette, SOGLColor)(&data[0], 4);
109



8
    REQUIRE(data[0] == buildHex(0x20, 0x11, 0x04, 0x03));
110



8
    REQUIRE(data[1] == buildHex(0x30, 0x11, 0x04, 0x03));
111



8
    REQUIRE(data[2] == buildHex(0x40, 0x11, 0x04, 0x03));
112



8
    REQUIRE(data[3] == buildHex(0x50, 0x02, 0xff, 0x02));
113
2
}
114
115
6
TEST_CASE("Dye replaceSOGLColor 8 1", "")
116
{
117

10
    DyePalette palette("#01ff02,030411,01ee02,010203", 6);
118
    uint32_t data[8];
119
2
    data[0] = buildHex(0x20, 0x02, 0xff, 0x01);
120
2
    data[1] = buildHex(0x30, 0x02, 0xff, 0x01);
121
2
    data[2] = buildHex(0x40, 0x02, 0xff, 0x01);
122
2
    data[3] = buildHex(0x50, 0x02, 0xff, 0x02);
123
2
    data[4] = buildHex(0x20, 0x02, 0xff, 0x01);
124
2
    data[5] = buildHex(0x30, 0x02, 0xff, 0x01);
125
2
    data[6] = buildHex(0x40, 0x02, 0xff, 0x01);
126
2
    data[7] = buildHex(0x60, 0x02, 0xff, 0x02);
127

2
    DYEPALETTE(palette, SOGLColor)(&data[0], 8);
128



8
    REQUIRE(data[0] == buildHex(0x20, 0x11, 0x04, 0x03));
129



8
    REQUIRE(data[1] == buildHex(0x30, 0x11, 0x04, 0x03));
130



8
    REQUIRE(data[2] == buildHex(0x40, 0x11, 0x04, 0x03));
131



8
    REQUIRE(data[3] == buildHex(0x50, 0x02, 0xff, 0x02));
132



8
    REQUIRE(data[4] == buildHex(0x20, 0x11, 0x04, 0x03));
133



8
    REQUIRE(data[5] == buildHex(0x30, 0x11, 0x04, 0x03));
134



8
    REQUIRE(data[6] == buildHex(0x40, 0x11, 0x04, 0x03));
135



8
    REQUIRE(data[7] == buildHex(0x60, 0x02, 0xff, 0x02));
136
2
}
137
138
6
TEST_CASE("Dye replaceSOGLColor 1 1 default", "")
139
{
140

10
    DyePalette palette("#00ff00,000011", 6);
141
    uint32_t data[1];
142
2
    data[0] = buildHex(0x01, 0x02, 0x03, 0x10);
143
2
    palette.replaceSOGLColorDefault(&data[0], 1);
144



8
    REQUIRE(data[0] == buildHex(0x01, 0x02, 0x03, 0x10));
145
2
}
146
147
6
TEST_CASE("Dye replaceSOGLColor 1 2 default", "")
148
{
149

10
    DyePalette palette("#01ff02,030411", 6);
150
    uint32_t data[1];
151
2
    data[0] = buildHex(0x20, 0x02, 0xff, 0x01);
152
2
    palette.replaceSOGLColorDefault(&data[0], 1);
153



8
    REQUIRE(data[0] == buildHex(0x20, 0x11, 0x04, 0x03));
154
2
}
155
156
6
TEST_CASE("Dye replaceSOGLColor 1 3 default", "")
157
{
158

10
    DyePalette palette("#404040,200000,0100ee,102030", 6);
159
    uint32_t data[1];
160
2
    data[0] = buildHex(0x40, 0xee, 0x00, 0x01);
161
2
    palette.replaceSOGLColorDefault(&data[0], 1);
162



8
    REQUIRE(data[0] == buildHex(0x40, 0x30, 0x20, 0x10));
163
2
}
164
165
6
TEST_CASE("Dye replaceSOGLColor 2 1 default", "")
166
{
167

10
    DyePalette palette("#01ff02,030411", 6);
168
    uint32_t data[2];
169
2
    data[0] = buildHex(0x20, 0x02, 0xff, 0x01);
170
2
    data[1] = buildHex(0x30, 0x02, 0xff, 0x01);
171
2
    palette.replaceSOGLColorDefault(&data[0], 2);
172



8
    REQUIRE(data[0] == buildHex(0x20, 0x11, 0x04, 0x03));
173



8
    REQUIRE(data[1] == buildHex(0x30, 0x11, 0x04, 0x03));
174
2
}
175
176
6
TEST_CASE("Dye replaceSOGLColor 4 1 default", "")
177
{
178

10
    DyePalette palette("#01ff02,030411", 6);
179
    uint32_t data[4];
180
2
    data[0] = buildHex(0x20, 0x02, 0xff, 0x01);
181
2
    data[1] = buildHex(0x30, 0x02, 0xff, 0x01);
182
2
    data[2] = buildHex(0x40, 0x02, 0xff, 0x01);
183
2
    data[3] = buildHex(0x50, 0x02, 0xff, 0x02);
184
2
    palette.replaceSOGLColorDefault(&data[0], 4);
185



8
    REQUIRE(data[0] == buildHex(0x20, 0x11, 0x04, 0x03));
186



8
    REQUIRE(data[1] == buildHex(0x30, 0x11, 0x04, 0x03));
187



8
    REQUIRE(data[2] == buildHex(0x40, 0x11, 0x04, 0x03));
188



8
    REQUIRE(data[3] == buildHex(0x50, 0x02, 0xff, 0x02));
189
2
}
190
191
6
TEST_CASE("Dye replaceSOGLColor 8 1 default", "")
192
{
193

10
    DyePalette palette("#01ff02,030411,01ee02,010203", 6);
194
    uint32_t data[8];
195
2
    data[0] = buildHex(0x20, 0x02, 0xff, 0x01);
196
2
    data[1] = buildHex(0x30, 0x02, 0xff, 0x01);
197
2
    data[2] = buildHex(0x40, 0x02, 0xff, 0x01);
198
2
    data[3] = buildHex(0x50, 0x02, 0xff, 0x02);
199
2
    data[4] = buildHex(0x20, 0x02, 0xff, 0x01);
200
2
    data[5] = buildHex(0x30, 0x02, 0xff, 0x01);
201
2
    data[6] = buildHex(0x40, 0x02, 0xff, 0x01);
202
2
    data[7] = buildHex(0x60, 0x02, 0xff, 0x02);
203
2
    palette.replaceSOGLColorDefault(&data[0], 8);
204



8
    REQUIRE(data[0] == buildHex(0x20, 0x11, 0x04, 0x03));
205



8
    REQUIRE(data[1] == buildHex(0x30, 0x11, 0x04, 0x03));
206



8
    REQUIRE(data[2] == buildHex(0x40, 0x11, 0x04, 0x03));
207



8
    REQUIRE(data[3] == buildHex(0x50, 0x02, 0xff, 0x02));
208



8
    REQUIRE(data[4] == buildHex(0x20, 0x11, 0x04, 0x03));
209



8
    REQUIRE(data[5] == buildHex(0x30, 0x11, 0x04, 0x03));
210



8
    REQUIRE(data[6] == buildHex(0x40, 0x11, 0x04, 0x03));
211



8
    REQUIRE(data[7] == buildHex(0x60, 0x02, 0xff, 0x02));
212
2
}
213
214
6
TEST_CASE("Dye replaceSOGLColor 8 1 sse2", "")
215
{
216

10
    DyePalette palette("#01ff02,030411,01ee02,010203", 6);
217
    uint32_t data[8];
218
2
    data[0] = buildHex(0x20, 0x02, 0xff, 0x01);
219
2
    data[1] = buildHex(0x30, 0x02, 0xff, 0x01);
220
2
    data[2] = buildHex(0x40, 0x02, 0xff, 0x01);
221
2
    data[3] = buildHex(0x50, 0x02, 0xff, 0x02);
222
2
    data[4] = buildHex(0x20, 0x02, 0xff, 0x01);
223
2
    data[5] = buildHex(0x30, 0x02, 0xff, 0x01);
224
2
    data[6] = buildHex(0x40, 0x02, 0xff, 0x01);
225
2
    data[7] = buildHex(0x60, 0x02, 0xff, 0x02);
226

2
    DYEPALETTE(palette, SOGLColorSse2)(&data[0], 8);
227



8
    REQUIRE(data[0] == buildHex(0x20, 0x11, 0x04, 0x03));
228



8
    REQUIRE(data[1] == buildHex(0x30, 0x11, 0x04, 0x03));
229



8
    REQUIRE(data[2] == buildHex(0x40, 0x11, 0x04, 0x03));
230



8
    REQUIRE(data[3] == buildHex(0x50, 0x02, 0xff, 0x02));
231



8
    REQUIRE(data[4] == buildHex(0x20, 0x11, 0x04, 0x03));
232



8
    REQUIRE(data[5] == buildHex(0x30, 0x11, 0x04, 0x03));
233



8
    REQUIRE(data[6] == buildHex(0x40, 0x11, 0x04, 0x03));
234



8
    REQUIRE(data[7] == buildHex(0x60, 0x02, 0xff, 0x02));
235
2
}
236
237
6
TEST_CASE("Dye replaceSOGLColor 8 1 avx2", "")
238
{
239

10
    DyePalette palette("#01ff02,030411,01ee02,010203", 6);
240
    uint32_t data[8];
241
2
    data[0] = buildHex(0x20, 0x02, 0xff, 0x01);
242
2
    data[1] = buildHex(0x30, 0x02, 0xff, 0x01);
243
2
    data[2] = buildHex(0x40, 0x02, 0xff, 0x01);
244
2
    data[3] = buildHex(0x50, 0x02, 0xff, 0x02);
245
2
    data[4] = buildHex(0x20, 0x02, 0xff, 0x01);
246
2
    data[5] = buildHex(0x30, 0x02, 0xff, 0x01);
247
2
    data[6] = buildHex(0x40, 0x02, 0xff, 0x01);
248
2
    data[7] = buildHex(0x60, 0x02, 0xff, 0x02);
249

2
    DYEPALETTE(palette, SOGLColorAvx2)(&data[0], 8);
250



8
    REQUIRE(data[0] == buildHex(0x20, 0x11, 0x04, 0x03));
251



8
    REQUIRE(data[1] == buildHex(0x30, 0x11, 0x04, 0x03));
252



8
    REQUIRE(data[2] == buildHex(0x40, 0x11, 0x04, 0x03));
253



8
    REQUIRE(data[3] == buildHex(0x50, 0x02, 0xff, 0x02));
254



8
    REQUIRE(data[4] == buildHex(0x20, 0x11, 0x04, 0x03));
255



8
    REQUIRE(data[5] == buildHex(0x30, 0x11, 0x04, 0x03));
256



8
    REQUIRE(data[6] == buildHex(0x40, 0x11, 0x04, 0x03));
257



8
    REQUIRE(data[7] == buildHex(0x60, 0x02, 0xff, 0x02));
258
2
}
259
260
261
6
TEST_CASE("Dye replaceAOGLColor 1 1", "")
262
{
263

10
    DyePalette palette("#00ff0010,00001120", 8);
264
    uint32_t data[1];
265
2
    data[0] = buildHex(0x10, 0x03, 0x02, 0x01);
266

2
    DYEPALETTE(palette, AOGLColor)(&data[0], 1);
267



8
    REQUIRE(data[0] == buildHex(0x10, 0x03, 0x02, 0x01));
268
2
}
269
270
6
TEST_CASE("Dye replaceAOGLColor 1 2", "")
271
{
272

10
    DyePalette palette("#00ff0120,020311ff", 8);
273
    uint32_t data[1];
274
2
    data[0] = buildHex(0x20, 0x01, 0xff, 0x00);
275

2
    DYEPALETTE(palette, AOGLColor)(&data[0], 1);
276



8
    REQUIRE(data[0] == buildHex(0xff, 0x11, 0x03, 0x02));
277
2
}
278
279
6
TEST_CASE("Dye replaceAOGLColor 1 3", "")
280
{
281

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
282
    uint32_t data[1];
283
2
    data[0] = buildHex(0x40, 0xee, 0x00, 0x01);
284

2
    DYEPALETTE(palette, AOGLColor)(&data[0], 1);
285



8
    REQUIRE(data[0] == buildHex(0xff, 0x30, 0x20, 0x10));
286
2
}
287
288
6
TEST_CASE("Dye replaceAOGLColor 2 1", "")
289
{
290

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
291
    uint32_t data[2];
292
2
    data[0] = buildHex(0x40, 0xee, 0x00, 0x01);
293
2
    data[1] = buildHex(0x40, 0xee, 0x00, 0x01);
294

2
    DYEPALETTE(palette, AOGLColor)(&data[0], 2);
295



8
    REQUIRE(data[0] == buildHex(0xff, 0x30, 0x20, 0x10));
296



8
    REQUIRE(data[1] == buildHex(0xff, 0x30, 0x20, 0x10));
297
2
}
298
299
6
TEST_CASE("Dye replaceAOGLColor 4 1", "")
300
{
301

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
302
    uint32_t data[4];
303
2
    data[0] = buildHex(0x40, 0xee, 0x00, 0x01);
304
2
    data[1] = buildHex(0x40, 0xee, 0x00, 0x01);
305
2
    data[2] = buildHex(0x41, 0xee, 0x00, 0x01);
306
2
    data[3] = buildHex(0x40, 0xee, 0x00, 0x01);
307

2
    DYEPALETTE(palette, AOGLColor)(&data[0], 4);
308



8
    REQUIRE(data[0] == buildHex(0xff, 0x30, 0x20, 0x10));
309



8
    REQUIRE(data[1] == buildHex(0xff, 0x30, 0x20, 0x10));
310



8
    REQUIRE(data[2] == buildHex(0x41, 0xee, 0x00, 0x01));
311



8
    REQUIRE(data[3] == buildHex(0xff, 0x30, 0x20, 0x10));
312
2
}
313
314
6
TEST_CASE("Dye replaceAOGLColor 8 1", "")
315
{
316

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
317
    uint32_t data[8];
318
2
    data[0] = buildHex(0x40, 0xee, 0x00, 0x01);
319
2
    data[1] = buildHex(0x40, 0xee, 0x00, 0x01);
320
2
    data[2] = buildHex(0x41, 0xee, 0x00, 0x01);
321
2
    data[3] = buildHex(0x40, 0xee, 0x00, 0x01);
322
2
    data[4] = buildHex(0x40, 0xee, 0x00, 0x01);
323
2
    data[5] = buildHex(0x40, 0x40, 0x40, 0x40);
324
2
    data[6] = buildHex(0x41, 0xe0, 0x00, 0x01);
325
2
    data[7] = buildHex(0x40, 0xee, 0x00, 0x01);
326

2
    DYEPALETTE(palette, AOGLColor)(&data[0], 8);
327



8
    REQUIRE(data[0] == buildHex(0xff, 0x30, 0x20, 0x10));
328



8
    REQUIRE(data[1] == buildHex(0xff, 0x30, 0x20, 0x10));
329



8
    REQUIRE(data[2] == buildHex(0x41, 0xee, 0x00, 0x01));
330



8
    REQUIRE(data[3] == buildHex(0xff, 0x30, 0x20, 0x10));
331



8
    REQUIRE(data[4] == buildHex(0xff, 0x30, 0x20, 0x10));
332



8
    REQUIRE(data[5] == buildHex(0x00, 0x00, 0x00, 0x20));
333



8
    REQUIRE(data[6] == buildHex(0x41, 0xe0, 0x00, 0x01));
334



8
    REQUIRE(data[7] == buildHex(0xff, 0x30, 0x20, 0x10));
335
2
}
336
337
6
TEST_CASE("Dye replaceAOGLColor 1 1 default", "")
338
{
339

10
    DyePalette palette("#00ff0010,00001120", 8);
340
    uint32_t data[1];
341
2
    data[0] = buildHex(0x10, 0x03, 0x02, 0x01);
342
2
    palette.replaceAOGLColorDefault(&data[0], 1);
343



8
    REQUIRE(data[0] == buildHex(0x10, 0x03, 0x02, 0x01));
344
2
}
345
346
6
TEST_CASE("Dye replaceAOGLColor 1 2 default", "")
347
{
348

10
    DyePalette palette("#00ff0120,020311ff", 8);
349
    uint32_t data[1];
350
2
    data[0] = buildHex(0x20, 0x01, 0xff, 0x00);
351
2
    palette.replaceAOGLColorDefault(&data[0], 1);
352



8
    REQUIRE(data[0] == buildHex(0xff, 0x11, 0x03, 0x02));
353
2
}
354
355
6
TEST_CASE("Dye replaceAOGLColor 1 3 default", "")
356
{
357

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
358
    uint32_t data[1];
359
2
    data[0] = buildHex(0x40, 0xee, 0x00, 0x01);
360
2
    palette.replaceAOGLColorDefault(&data[0], 1);
361



8
    REQUIRE(data[0] == buildHex(0xff, 0x30, 0x20, 0x10));
362
2
}
363
364
6
TEST_CASE("Dye replaceAOGLColor 2 1 default", "")
365
{
366

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
367
    uint32_t data[2];
368
2
    data[0] = buildHex(0x40, 0xee, 0x00, 0x01);
369
2
    data[1] = buildHex(0x40, 0xee, 0x00, 0x01);
370
2
    palette.replaceAOGLColorDefault(&data[0], 2);
371



8
    REQUIRE(data[0] == buildHex(0xff, 0x30, 0x20, 0x10));
372



8
    REQUIRE(data[1] == buildHex(0xff, 0x30, 0x20, 0x10));
373
2
}
374
375
6
TEST_CASE("Dye replaceAOGLColor 4 1 default", "")
376
{
377

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
378
    uint32_t data[4];
379
2
    data[0] = buildHex(0x40, 0xee, 0x00, 0x01);
380
2
    data[1] = buildHex(0x40, 0xee, 0x00, 0x01);
381
2
    data[2] = buildHex(0x41, 0xee, 0x00, 0x01);
382
2
    data[3] = buildHex(0x40, 0xee, 0x00, 0x01);
383
2
    palette.replaceAOGLColorDefault(&data[0], 4);
384



6
    REQUIRE(data[0] == buildHex(0xff, 0x30, 0x20, 0x10));
385



8
    REQUIRE(data[1] == buildHex(0xff, 0x30, 0x20, 0x10));
386



8
    REQUIRE(data[2] == buildHex(0x41, 0xee, 0x00, 0x01));
387



8
    REQUIRE(data[3] == buildHex(0xff, 0x30, 0x20, 0x10));
388
2
}
389
390
6
TEST_CASE("Dye replaceAOGLColor 8 1 default", "")
391
{
392

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
393
    uint32_t data[8];
394
2
    data[0] = buildHex(0x40, 0xee, 0x00, 0x01);
395
2
    data[1] = buildHex(0x40, 0xee, 0x00, 0x01);
396
2
    data[2] = buildHex(0x41, 0xee, 0x00, 0x01);
397
2
    data[3] = buildHex(0x40, 0xee, 0x00, 0x01);
398
2
    data[4] = buildHex(0x40, 0xee, 0x00, 0x01);
399
2
    data[5] = buildHex(0x40, 0x40, 0x40, 0x40);
400
2
    data[6] = buildHex(0x41, 0xe0, 0x00, 0x01);
401
2
    data[7] = buildHex(0x40, 0xee, 0x00, 0x01);
402
2
    palette.replaceAOGLColorDefault(&data[0], 8);
403



8
    REQUIRE(data[0] == buildHex(0xff, 0x30, 0x20, 0x10));
404



8
    REQUIRE(data[1] == buildHex(0xff, 0x30, 0x20, 0x10));
405



8
    REQUIRE(data[2] == buildHex(0x41, 0xee, 0x00, 0x01));
406



8
    REQUIRE(data[3] == buildHex(0xff, 0x30, 0x20, 0x10));
407



8
    REQUIRE(data[4] == buildHex(0xff, 0x30, 0x20, 0x10));
408



8
    REQUIRE(data[5] == buildHex(0x00, 0x00, 0x00, 0x20));
409



8
    REQUIRE(data[6] == buildHex(0x41, 0xe0, 0x00, 0x01));
410



8
    REQUIRE(data[7] == buildHex(0xff, 0x30, 0x20, 0x10));
411
2
}
412
413
6
TEST_CASE("Dye replaceAOGLColor 8 1 sse2", "")
414
{
415

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
416
    uint32_t data[8];
417
2
    data[0] = buildHex(0x40, 0xee, 0x00, 0x01);
418
2
    data[1] = buildHex(0x40, 0xee, 0x00, 0x01);
419
2
    data[2] = buildHex(0x41, 0xee, 0x00, 0x01);
420
2
    data[3] = buildHex(0x40, 0xee, 0x00, 0x01);
421
2
    data[4] = buildHex(0x40, 0xee, 0x00, 0x01);
422
2
    data[5] = buildHex(0x40, 0x40, 0x40, 0x40);
423
2
    data[6] = buildHex(0x41, 0xe0, 0x00, 0x01);
424
2
    data[7] = buildHex(0x40, 0xee, 0x00, 0x01);
425

2
    DYEPALETTE(palette, AOGLColorSse2)(&data[0], 8);
426



8
    REQUIRE(data[0] == buildHex(0xff, 0x30, 0x20, 0x10));
427



8
    REQUIRE(data[1] == buildHex(0xff, 0x30, 0x20, 0x10));
428



8
    REQUIRE(data[2] == buildHex(0x41, 0xee, 0x00, 0x01));
429



8
    REQUIRE(data[3] == buildHex(0xff, 0x30, 0x20, 0x10));
430



8
    REQUIRE(data[4] == buildHex(0xff, 0x30, 0x20, 0x10));
431



8
    REQUIRE(data[5] == buildHex(0x00, 0x00, 0x00, 0x20));
432



8
    REQUIRE(data[6] == buildHex(0x41, 0xe0, 0x00, 0x01));
433



8
    REQUIRE(data[7] == buildHex(0xff, 0x30, 0x20, 0x10));
434
2
}
435
436
6
TEST_CASE("Dye replaceAOGLColor 8 1 avx2", "")
437
{
438

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
439
    uint32_t data[8];
440
2
    data[0] = buildHex(0x40, 0xee, 0x00, 0x01);
441
2
    data[1] = buildHex(0x40, 0xee, 0x00, 0x01);
442
2
    data[2] = buildHex(0x41, 0xee, 0x00, 0x01);
443
2
    data[3] = buildHex(0x40, 0xee, 0x00, 0x01);
444
2
    data[4] = buildHex(0x40, 0xee, 0x00, 0x01);
445
2
    data[5] = buildHex(0x40, 0x40, 0x40, 0x40);
446
2
    data[6] = buildHex(0x41, 0xe0, 0x00, 0x01);
447
2
    data[7] = buildHex(0x40, 0xee, 0x00, 0x01);
448

2
    DYEPALETTE(palette, AOGLColorAvx2)(&data[0], 8);
449



8
    REQUIRE(data[0] == buildHex(0xff, 0x30, 0x20, 0x10));
450



8
    REQUIRE(data[1] == buildHex(0xff, 0x30, 0x20, 0x10));
451



8
    REQUIRE(data[2] == buildHex(0x41, 0xee, 0x00, 0x01));
452



8
    REQUIRE(data[3] == buildHex(0xff, 0x30, 0x20, 0x10));
453



8
    REQUIRE(data[4] == buildHex(0xff, 0x30, 0x20, 0x10));
454



8
    REQUIRE(data[5] == buildHex(0x00, 0x00, 0x00, 0x20));
455



8
    REQUIRE(data[6] == buildHex(0x41, 0xe0, 0x00, 0x01));
456



8
    REQUIRE(data[7] == buildHex(0xff, 0x30, 0x20, 0x10));
457
2
}
458
#endif  // USE_OPENGL
459
460
461
6
TEST_CASE("Dye replaceSColor 1 1", "")
462
{
463

10
    DyePalette palette("#00ff00,000011", 6);
464
    uint32_t data[1];
465
2
    data[0] = buildHex(0x10, 0x03, 0x02, 0x01);
466

2
    DYEPALETTE(palette, SColor)(&data[0], 1);
467



8
    REQUIRE(data[0] == buildHex(0x10, 0x03, 0x02, 0x01));
468
2
}
469
470
6
TEST_CASE("Dye replaceSColor 1 2", "")
471
{
472

10
    DyePalette palette("#403020,706050", 6);
473
    uint32_t data[1];
474
2
    data[0] = buildHex(0x40, 0x30, 0x20, 0x10);
475

2
    DYEPALETTE(palette, SColor)(&data[0], 1);
476



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
477
2
}
478
479
6
TEST_CASE("Dye replaceSColor 1 3", "")
480
{
481

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
482
    uint32_t data[1];
483
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
484

2
    DYEPALETTE(palette, SColor)(&data[0], 1);
485



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
486
2
}
487
488
6
TEST_CASE("Dye replaceSColor 2 1", "")
489
{
490

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
491
    uint32_t data[2];
492
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
493
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
494

2
    DYEPALETTE(palette, SColor)(&data[0], 2);
495



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
496



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
497
2
}
498
499
6
TEST_CASE("Dye replaceSColor 3 1", "")
500
{
501

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
502
    uint32_t data[3];
503
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
504
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
505
2
    data[2] = buildHex(0xff, 0x30, 0x20, 0x30);
506

2
    DYEPALETTE(palette, SColor)(&data[0], 3);
507



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
508



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
509



8
    REQUIRE(data[2] == buildHex(0x70, 0x60, 0x50, 0x30));
510
2
}
511
512
6
TEST_CASE("Dye replaceSColor 4 1", "")
513
{
514

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
515
    uint32_t data[4];
516
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
517
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
518
2
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
519
2
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
520

2
    DYEPALETTE(palette, SColor)(&data[0], 4);
521



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
522



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
523



8
    REQUIRE(data[2] == buildHex(0xff, 0x40, 0x20, 0x10));
524



8
    REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x20));
525
2
}
526
527
6
TEST_CASE("Dye replaceSColor 5 1", "")
528
{
529

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
530
    uint32_t data[5];
531
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
532
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
533
2
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
534
2
    data[3] = buildHex(0xff, 0x30, 0x20, 0x30);
535
2
    data[4] = buildHex(0xff, 0x30, 0x20, 0x20);
536

2
    DYEPALETTE(palette, SColor)(&data[0], 5);
537



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
538



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
539



8
    REQUIRE(data[2] == buildHex(0xff, 0x40, 0x20, 0x10));
540



8
    REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x30));
541



8
    REQUIRE(data[4] == buildHex(0x70, 0x60, 0x50, 0x20));
542
2
}
543
544
6
TEST_CASE("Dye replaceSColor 7 1", "")
545
{
546

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
547
    uint32_t data[7];
548
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
549
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
550
2
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
551
2
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
552
2
    data[4] = buildHex(0xff, 0x30, 0x20, 0x10);
553
2
    data[5] = buildHex(0xff, 0x30, 0x20, 0x40);
554
2
    data[6] = buildHex(0xff, 0x40, 0x20, 0x50);
555

2
    DYEPALETTE(palette, SColor)(&data[0], 7);
556



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
557



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
558



8
    REQUIRE(data[2] == buildHex(0xff, 0x40, 0x20, 0x10));
559



8
    REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x20));
560



8
    REQUIRE(data[4] == buildHex(0x70, 0x60, 0x50, 0x10));
561



8
    REQUIRE(data[5] == buildHex(0x70, 0x60, 0x50, 0x40));
562



8
    REQUIRE(data[6] == buildHex(0xff, 0x40, 0x20, 0x50));
563
2
}
564
565
6
TEST_CASE("Dye replaceSColor 8 1", "")
566
{
567

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
568
    uint32_t data[8];
569
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
570
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
571
2
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
572
2
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
573
2
    data[4] = buildHex(0xff, 0x30, 0x20, 0x10);
574
2
    data[5] = buildHex(0xff, 0x30, 0x20, 0x40);
575
2
    data[6] = buildHex(0xff, 0x40, 0x20, 0x50);
576
2
    data[7] = buildHex(0xff, 0x30, 0x20, 0x60);
577

2
    DYEPALETTE(palette, SColor)(&data[0], 8);
578



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
579



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
580



8
    REQUIRE(data[2] == buildHex(0xff, 0x40, 0x20, 0x10));
581



8
    REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x20));
582



8
    REQUIRE(data[4] == buildHex(0x70, 0x60, 0x50, 0x10));
583



8
    REQUIRE(data[5] == buildHex(0x70, 0x60, 0x50, 0x40));
584



8
    REQUIRE(data[6] == buildHex(0xff, 0x40, 0x20, 0x50));
585



8
    REQUIRE(data[7] == buildHex(0x70, 0x60, 0x50, 0x60));
586
2
}
587
588
6
TEST_CASE("Dye replaceSColor 9 1", "")
589
{
590

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
591
    uint32_t data[9];
592
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
593
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
594
2
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
595
2
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
596
2
    data[4] = buildHex(0xff, 0x30, 0x20, 0x10);
597
2
    data[5] = buildHex(0xff, 0x30, 0x20, 0x40);
598
2
    data[6] = buildHex(0xff, 0x40, 0x20, 0x50);
599
2
    data[7] = buildHex(0xff, 0x30, 0x20, 0x60);
600
2
    data[8] = buildHex(0xff, 0x30, 0x20, 0x70);
601

2
    DYEPALETTE(palette, SColor)(&data[0], 9);
602



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
603



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
604



8
    REQUIRE(data[2] == buildHex(0xff, 0x40, 0x20, 0x10));
605



8
    REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x20));
606



8
    REQUIRE(data[4] == buildHex(0x70, 0x60, 0x50, 0x10));
607



8
    REQUIRE(data[5] == buildHex(0x70, 0x60, 0x50, 0x40));
608



8
    REQUIRE(data[6] == buildHex(0xff, 0x40, 0x20, 0x50));
609



8
    REQUIRE(data[7] == buildHex(0x70, 0x60, 0x50, 0x60));
610



8
    REQUIRE(data[8] == buildHex(0x70, 0x60, 0x50, 0x70));
611
2
}
612
613
6
TEST_CASE("Dye replaceSColor 10 1", "")
614
{
615

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
616
    uint32_t data[10];
617
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
618
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
619
2
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
620
2
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
621
2
    data[4] = buildHex(0xff, 0x30, 0x20, 0x10);
622
2
    data[5] = buildHex(0xff, 0x30, 0x20, 0x40);
623
2
    data[6] = buildHex(0xff, 0x40, 0x20, 0x50);
624
2
    data[7] = buildHex(0xff, 0x30, 0x20, 0x60);
625
2
    data[8] = buildHex(0x12, 0x34, 0x56, 0x70);
626
2
    data[9] = buildHex(0xff, 0x30, 0x20, 0x80);
627

2
    DYEPALETTE(palette, SColor)(&data[0], 10);
628



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
629



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
630



8
    REQUIRE(data[2] == buildHex(0xff, 0x40, 0x20, 0x10));
631



8
    REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x20));
632



8
    REQUIRE(data[4] == buildHex(0x70, 0x60, 0x50, 0x10));
633



8
    REQUIRE(data[5] == buildHex(0x70, 0x60, 0x50, 0x40));
634



8
    REQUIRE(data[6] == buildHex(0xff, 0x40, 0x20, 0x50));
635



8
    REQUIRE(data[7] == buildHex(0x70, 0x60, 0x50, 0x60));
636



8
    REQUIRE(data[8] == buildHex(0x00, 0x00, 0x00, 0x70));
637



8
    REQUIRE(data[9] == buildHex(0x70, 0x60, 0x50, 0x80));
638
2
}
639
640
6
TEST_CASE("Dye replaceSColor 1 1 default", "")
641
{
642

10
    DyePalette palette("#00ff00,000011", 6);
643
    uint32_t data[1];
644
2
    data[0] = buildHex(0x10, 0x03, 0x02, 0x01);
645
2
    palette.replaceSColorDefault(&data[0], 1);
646



8
    REQUIRE(data[0] == buildHex(0x10, 0x03, 0x02, 0x01));
647
2
}
648
649
6
TEST_CASE("Dye replaceSColor 1 2 default", "")
650
{
651

10
    DyePalette palette("#403020,706050", 6);
652
    uint32_t data[1];
653
2
    data[0] = buildHex(0x40, 0x30, 0x20, 0x10);
654
2
    palette.replaceSColorDefault(&data[0], 1);
655



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
656
2
}
657
658
6
TEST_CASE("Dye replaceSColor 1 3 default", "")
659
{
660

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
661
    uint32_t data[1];
662
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
663
2
    palette.replaceSColorDefault(&data[0], 1);
664



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
665
2
}
666
667
6
TEST_CASE("Dye replaceSColor 2 1 default", "")
668
{
669

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
670
    uint32_t data[2];
671
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
672
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
673
2
    palette.replaceSColorDefault(&data[0], 2);
674



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
675



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
676
2
}
677
678
6
TEST_CASE("Dye replaceSColor 3 1 default", "")
679
{
680

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
681
    uint32_t data[3];
682
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
683
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
684
2
    data[2] = buildHex(0xff, 0x30, 0x20, 0x30);
685
2
    palette.replaceSColorDefault(&data[0], 3);
686



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
687



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
688



8
    REQUIRE(data[2] == buildHex(0x70, 0x60, 0x50, 0x30));
689
2
}
690
691
6
TEST_CASE("Dye replaceSColor 4 1 default", "")
692
{
693

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
694
    uint32_t data[4];
695
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
696
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
697
2
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
698
2
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
699
2
    palette.replaceSColorDefault(&data[0], 4);
700



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
701



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
702



8
    REQUIRE(data[2] == buildHex(0xff, 0x40, 0x20, 0x10));
703



8
    REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x20));
704
2
}
705
706
6
TEST_CASE("Dye replaceSColor 5 1 default", "")
707
{
708

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
709
    uint32_t data[5];
710
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
711
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
712
2
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
713
2
    data[3] = buildHex(0xff, 0x30, 0x20, 0x30);
714
2
    data[4] = buildHex(0xff, 0x30, 0x20, 0x20);
715
2
    palette.replaceSColorDefault(&data[0], 5);
716



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
717



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
718



8
    REQUIRE(data[2] == buildHex(0xff, 0x40, 0x20, 0x10));
719



8
    REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x30));
720



8
    REQUIRE(data[4] == buildHex(0x70, 0x60, 0x50, 0x20));
721
2
}
722
723
6
TEST_CASE("Dye replaceSColor 7 1 default", "")
724
{
725

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
726
    uint32_t data[7];
727
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
728
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
729
2
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
730
2
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
731
2
    data[4] = buildHex(0xff, 0x30, 0x20, 0x10);
732
2
    data[5] = buildHex(0xff, 0x30, 0x20, 0x40);
733
2
    data[6] = buildHex(0xff, 0x40, 0x20, 0x50);
734
2
    palette.replaceSColorDefault(&data[0], 7);
735



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
736



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
737



8
    REQUIRE(data[2] == buildHex(0xff, 0x40, 0x20, 0x10));
738



8
    REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x20));
739



8
    REQUIRE(data[4] == buildHex(0x70, 0x60, 0x50, 0x10));
740



8
    REQUIRE(data[5] == buildHex(0x70, 0x60, 0x50, 0x40));
741



8
    REQUIRE(data[6] == buildHex(0xff, 0x40, 0x20, 0x50));
742
2
}
743
744
6
TEST_CASE("Dye replaceSColor 8 1 default", "")
745
{
746

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
747
    uint32_t data[8];
748
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
749
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
750
2
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
751
2
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
752
2
    data[4] = buildHex(0xff, 0x30, 0x20, 0x10);
753
2
    data[5] = buildHex(0xff, 0x30, 0x20, 0x40);
754
2
    data[6] = buildHex(0xff, 0x40, 0x20, 0x50);
755
2
    data[7] = buildHex(0xff, 0x30, 0x20, 0x60);
756
2
    palette.replaceSColorDefault(&data[0], 8);
757



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
758



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
759



8
    REQUIRE(data[2] == buildHex(0xff, 0x40, 0x20, 0x10));
760



8
    REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x20));
761



8
    REQUIRE(data[4] == buildHex(0x70, 0x60, 0x50, 0x10));
762



8
    REQUIRE(data[5] == buildHex(0x70, 0x60, 0x50, 0x40));
763



8
    REQUIRE(data[6] == buildHex(0xff, 0x40, 0x20, 0x50));
764



8
    REQUIRE(data[7] == buildHex(0x70, 0x60, 0x50, 0x60));
765
2
}
766
767
6
TEST_CASE("Dye replaceSColor 9 1 default", "")
768
{
769

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
770
    uint32_t data[9];
771
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
772
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
773
2
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
774
2
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
775
2
    data[4] = buildHex(0xff, 0x30, 0x20, 0x10);
776
2
    data[5] = buildHex(0xff, 0x30, 0x20, 0x40);
777
2
    data[6] = buildHex(0xff, 0x40, 0x20, 0x50);
778
2
    data[7] = buildHex(0xff, 0x30, 0x20, 0x60);
779
2
    data[8] = buildHex(0xff, 0x30, 0x20, 0x70);
780
2
    palette.replaceSColorDefault(&data[0], 9);
781



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
782



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
783



8
    REQUIRE(data[2] == buildHex(0xff, 0x40, 0x20, 0x10));
784



8
    REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x20));
785



8
    REQUIRE(data[4] == buildHex(0x70, 0x60, 0x50, 0x10));
786



8
    REQUIRE(data[5] == buildHex(0x70, 0x60, 0x50, 0x40));
787



8
    REQUIRE(data[6] == buildHex(0xff, 0x40, 0x20, 0x50));
788



8
    REQUIRE(data[7] == buildHex(0x70, 0x60, 0x50, 0x60));
789



8
    REQUIRE(data[8] == buildHex(0x70, 0x60, 0x50, 0x70));
790
2
}
791
792
6
TEST_CASE("Dye replaceSColor 10 1 default", "")
793
{
794

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
795
    uint32_t data[10];
796
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
797
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
798
2
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
799
2
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
800
2
    data[4] = buildHex(0xff, 0x30, 0x20, 0x10);
801
2
    data[5] = buildHex(0xff, 0x30, 0x20, 0x40);
802
2
    data[6] = buildHex(0xff, 0x40, 0x20, 0x50);
803
2
    data[7] = buildHex(0xff, 0x30, 0x20, 0x60);
804
2
    data[8] = buildHex(0x12, 0x34, 0x56, 0x70);
805
2
    data[9] = buildHex(0xff, 0x30, 0x20, 0x80);
806
2
    palette.replaceSColorDefault(&data[0], 10);
807



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
808



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
809



8
    REQUIRE(data[2] == buildHex(0xff, 0x40, 0x20, 0x10));
810



8
    REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x20));
811



8
    REQUIRE(data[4] == buildHex(0x70, 0x60, 0x50, 0x10));
812



8
    REQUIRE(data[5] == buildHex(0x70, 0x60, 0x50, 0x40));
813



8
    REQUIRE(data[6] == buildHex(0xff, 0x40, 0x20, 0x50));
814



8
    REQUIRE(data[7] == buildHex(0x70, 0x60, 0x50, 0x60));
815



8
    REQUIRE(data[8] == buildHex(0x00, 0x00, 0x00, 0x70));
816



8
    REQUIRE(data[9] == buildHex(0x70, 0x60, 0x50, 0x80));
817
2
}
818
819
6
TEST_CASE("Dye replaceSColor 1 1 sse2", "")
820
{
821

10
    DyePalette palette("#00ff00,000011", 6);
822
    uint32_t data[1];
823
2
    data[0] = buildHex(0x10, 0x03, 0x02, 0x01);
824

2
    DYEPALETTE(palette, SColorSse2)(&data[0], 1);
825



8
    REQUIRE(data[0] == buildHex(0x10, 0x03, 0x02, 0x01));
826
2
}
827
828
6
TEST_CASE("Dye replaceSColor 1 2 sse2", "")
829
{
830

10
    DyePalette palette("#403020,706050", 6);
831
    uint32_t data[1];
832
2
    data[0] = buildHex(0x40, 0x30, 0x20, 0x10);
833

2
    DYEPALETTE(palette, SColorSse2)(&data[0], 1);
834



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
835
2
}
836
837
6
TEST_CASE("Dye replaceSColor 1 3 sse2", "")
838
{
839

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
840
    uint32_t data[1];
841
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
842

2
    DYEPALETTE(palette, SColorSse2)(&data[0], 1);
843



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
844
2
}
845
846
6
TEST_CASE("Dye replaceSColor 2 1 sse2", "")
847
{
848

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
849
    uint32_t data[2];
850
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
851
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
852

2
    DYEPALETTE(palette, SColorSse2)(&data[0], 2);
853



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
854



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
855
2
}
856
857
6
TEST_CASE("Dye replaceSColor 3 1 sse2", "")
858
{
859

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
860
    uint32_t data[3];
861
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
862
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
863
2
    data[2] = buildHex(0xff, 0x30, 0x20, 0x30);
864

2
    DYEPALETTE(palette, SColorSse2)(&data[0], 3);
865



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
866



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
867



8
    REQUIRE(data[2] == buildHex(0x70, 0x60, 0x50, 0x30));
868
2
}
869
870
6
TEST_CASE("Dye replaceSColor 4 1 sse2", "")
871
{
872

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
873
    uint32_t data[4];
874
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
875
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
876
2
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
877
2
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
878

2
    DYEPALETTE(palette, SColorSse2)(&data[0], 4);
879



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
880



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
881



8
    REQUIRE(data[2] == buildHex(0xff, 0x40, 0x20, 0x10));
882



8
    REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x20));
883
2
}
884
885
6
TEST_CASE("Dye replaceSColor 5 1 sse2", "")
886
{
887

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
888
    uint32_t data[5];
889
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
890
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
891
2
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
892
2
    data[3] = buildHex(0xff, 0x30, 0x20, 0x30);
893
2
    data[4] = buildHex(0xff, 0x30, 0x20, 0x20);
894

2
    DYEPALETTE(palette, SColorSse2)(&data[0], 5);
895



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
896



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
897



8
    REQUIRE(data[2] == buildHex(0xff, 0x40, 0x20, 0x10));
898



8
    REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x30));
899



8
    REQUIRE(data[4] == buildHex(0x70, 0x60, 0x50, 0x20));
900
2
}
901
902
6
TEST_CASE("Dye replaceSColor 7 1 sse2", "")
903
{
904

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
905
    uint32_t data[7];
906
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
907
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
908
2
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
909
2
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
910
2
    data[4] = buildHex(0xff, 0x30, 0x20, 0x10);
911
2
    data[5] = buildHex(0xff, 0x30, 0x20, 0x40);
912
2
    data[6] = buildHex(0xff, 0x40, 0x20, 0x50);
913

2
    DYEPALETTE(palette, SColorSse2)(&data[0], 7);
914



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
915



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
916



8
    REQUIRE(data[2] == buildHex(0xff, 0x40, 0x20, 0x10));
917



8
    REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x20));
918



8
    REQUIRE(data[4] == buildHex(0x70, 0x60, 0x50, 0x10));
919



8
    REQUIRE(data[5] == buildHex(0x70, 0x60, 0x50, 0x40));
920



8
    REQUIRE(data[6] == buildHex(0xff, 0x40, 0x20, 0x50));
921
2
}
922
923
6
TEST_CASE("Dye replaceSColor 8 1 sse2", "")
924
{
925

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
926
    uint32_t data[8];
927
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
928
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
929
2
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
930
2
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
931
2
    data[4] = buildHex(0xff, 0x30, 0x20, 0x10);
932
2
    data[5] = buildHex(0xff, 0x30, 0x20, 0x40);
933
2
    data[6] = buildHex(0xff, 0x40, 0x20, 0x50);
934
2
    data[7] = buildHex(0xff, 0x30, 0x20, 0x60);
935

2
    DYEPALETTE(palette, SColorSse2)(&data[0], 8);
936



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
937



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
938



8
    REQUIRE(data[2] == buildHex(0xff, 0x40, 0x20, 0x10));
939



8
    REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x20));
940



8
    REQUIRE(data[4] == buildHex(0x70, 0x60, 0x50, 0x10));
941



8
    REQUIRE(data[5] == buildHex(0x70, 0x60, 0x50, 0x40));
942



8
    REQUIRE(data[6] == buildHex(0xff, 0x40, 0x20, 0x50));
943



8
    REQUIRE(data[7] == buildHex(0x70, 0x60, 0x50, 0x60));
944
2
}
945
946
6
TEST_CASE("Dye replaceSColor 9 1 sse2", "")
947
{
948

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
949
    uint32_t data[9];
950
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
951
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
952
2
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
953
2
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
954
2
    data[4] = buildHex(0xff, 0x30, 0x20, 0x10);
955
2
    data[5] = buildHex(0xff, 0x30, 0x20, 0x40);
956
2
    data[6] = buildHex(0xff, 0x40, 0x20, 0x50);
957
2
    data[7] = buildHex(0xff, 0x30, 0x20, 0x60);
958
2
    data[8] = buildHex(0xff, 0x30, 0x20, 0x70);
959

2
    DYEPALETTE(palette, SColorSse2)(&data[0], 9);
960



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
961



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
962



8
    REQUIRE(data[2] == buildHex(0xff, 0x40, 0x20, 0x10));
963



8
    REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x20));
964



8
    REQUIRE(data[4] == buildHex(0x70, 0x60, 0x50, 0x10));
965



8
    REQUIRE(data[5] == buildHex(0x70, 0x60, 0x50, 0x40));
966



8
    REQUIRE(data[6] == buildHex(0xff, 0x40, 0x20, 0x50));
967



8
    REQUIRE(data[7] == buildHex(0x70, 0x60, 0x50, 0x60));
968



8
    REQUIRE(data[8] == buildHex(0x70, 0x60, 0x50, 0x70));
969
2
}
970
971
6
TEST_CASE("Dye replaceSColor 10 1 sse2", "")
972
{
973

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
974
    uint32_t data[10];
975
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
976
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
977
2
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
978
2
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
979
2
    data[4] = buildHex(0xff, 0x30, 0x20, 0x10);
980
2
    data[5] = buildHex(0xff, 0x30, 0x20, 0x40);
981
2
    data[6] = buildHex(0xff, 0x40, 0x20, 0x50);
982
2
    data[7] = buildHex(0xff, 0x30, 0x20, 0x60);
983
2
    data[8] = buildHex(0x12, 0x34, 0x56, 0x70);
984
2
    data[9] = buildHex(0xff, 0x30, 0x20, 0x80);
985

2
    DYEPALETTE(palette, SColorSse2)(&data[0], 10);
986



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
987



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
988



8
    REQUIRE(data[2] == buildHex(0xff, 0x40, 0x20, 0x10));
989



8
    REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x20));
990



8
    REQUIRE(data[4] == buildHex(0x70, 0x60, 0x50, 0x10));
991



8
    REQUIRE(data[5] == buildHex(0x70, 0x60, 0x50, 0x40));
992



8
    REQUIRE(data[6] == buildHex(0xff, 0x40, 0x20, 0x50));
993



8
    REQUIRE(data[7] == buildHex(0x70, 0x60, 0x50, 0x60));
994



8
    REQUIRE(data[8] == buildHex(0x00, 0x00, 0x00, 0x70));
995



8
    REQUIRE(data[9] == buildHex(0x70, 0x60, 0x50, 0x80));
996
2
}
997
998
6
TEST_CASE("Dye replaceSColor 1 1 avx2", "")
999
{
1000

10
    DyePalette palette("#00ff00,000011", 6);
1001
    uint32_t data[1];
1002
2
    data[0] = buildHex(0x10, 0x03, 0x02, 0x01);
1003

2
    DYEPALETTE(palette, SColorAvx2)(&data[0], 1);
1004



8
    REQUIRE(data[0] == buildHex(0x10, 0x03, 0x02, 0x01));
1005
2
}
1006
1007
6
TEST_CASE("Dye replaceSColor 1 2 avx2", "")
1008
{
1009

10
    DyePalette palette("#403020,706050", 6);
1010
    uint32_t data[1];
1011
2
    data[0] = buildHex(0x40, 0x30, 0x20, 0x10);
1012

2
    DYEPALETTE(palette, SColorAvx2)(&data[0], 1);
1013



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
1014
2
}
1015
1016
6
TEST_CASE("Dye replaceSColor 1 3 avx2", "")
1017
{
1018

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
1019
    uint32_t data[1];
1020
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
1021

2
    DYEPALETTE(palette, SColorAvx2)(&data[0], 1);
1022



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
1023
2
}
1024
1025
6
TEST_CASE("Dye replaceSColor 2 1 avx2", "")
1026
{
1027

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
1028
    uint32_t data[2];
1029
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
1030
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
1031

2
    DYEPALETTE(palette, SColorAvx2)(&data[0], 2);
1032



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
1033



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
1034
2
}
1035
1036
6
TEST_CASE("Dye replaceSColor 3 1 avx2", "")
1037
{
1038

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
1039
    uint32_t data[3];
1040
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
1041
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
1042
2
    data[2] = buildHex(0xff, 0x30, 0x20, 0x30);
1043

2
    DYEPALETTE(palette, SColorAvx2)(&data[0], 3);
1044



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
1045



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
1046



8
    REQUIRE(data[2] == buildHex(0x70, 0x60, 0x50, 0x30));
1047
2
}
1048
1049
6
TEST_CASE("Dye replaceSColor 4 1 avx2", "")
1050
{
1051

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
1052
    uint32_t data[4];
1053
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
1054
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
1055
2
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
1056
2
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
1057

2
    DYEPALETTE(palette, SColorAvx2)(&data[0], 4);
1058



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
1059



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
1060



8
    REQUIRE(data[2] == buildHex(0xff, 0x40, 0x20, 0x10));
1061



8
    REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x20));
1062
2
}
1063
1064
6
TEST_CASE("Dye replaceSColor 5 1 avx2", "")
1065
{
1066

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
1067
    uint32_t data[5];
1068
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
1069
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
1070
2
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
1071
2
    data[3] = buildHex(0xff, 0x30, 0x20, 0x30);
1072
2
    data[4] = buildHex(0xff, 0x30, 0x20, 0x20);
1073

2
    DYEPALETTE(palette, SColorAvx2)(&data[0], 5);
1074



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
1075



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
1076



8
    REQUIRE(data[2] == buildHex(0xff, 0x40, 0x20, 0x10));
1077



8
    REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x30));
1078



8
    REQUIRE(data[4] == buildHex(0x70, 0x60, 0x50, 0x20));
1079
2
}
1080
1081
6
TEST_CASE("Dye replaceSColor 7 1 avx2", "")
1082
{
1083

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
1084
    uint32_t data[7];
1085
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
1086
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
1087
2
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
1088
2
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
1089
2
    data[4] = buildHex(0xff, 0x30, 0x20, 0x10);
1090
2
    data[5] = buildHex(0xff, 0x30, 0x20, 0x40);
1091
2
    data[6] = buildHex(0xff, 0x40, 0x20, 0x50);
1092

2
    DYEPALETTE(palette, SColorAvx2)(&data[0], 7);
1093



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
1094



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
1095



8
    REQUIRE(data[2] == buildHex(0xff, 0x40, 0x20, 0x10));
1096



8
    REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x20));
1097



8
    REQUIRE(data[4] == buildHex(0x70, 0x60, 0x50, 0x10));
1098



8
    REQUIRE(data[5] == buildHex(0x70, 0x60, 0x50, 0x40));
1099



8
    REQUIRE(data[6] == buildHex(0xff, 0x40, 0x20, 0x50));
1100
2
}
1101
1102
6
TEST_CASE("Dye replaceSColor 8 1 avx2", "")
1103
{
1104

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
1105
    uint32_t data[8];
1106
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
1107
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
1108
2
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
1109
2
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
1110
2
    data[4] = buildHex(0xff, 0x30, 0x20, 0x10);
1111
2
    data[5] = buildHex(0xff, 0x30, 0x20, 0x40);
1112
2
    data[6] = buildHex(0xff, 0x40, 0x20, 0x50);
1113
2
    data[7] = buildHex(0xff, 0x30, 0x20, 0x60);
1114

2
    DYEPALETTE(palette, SColorAvx2)(&data[0], 8);
1115



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
1116



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
1117



8
    REQUIRE(data[2] == buildHex(0xff, 0x40, 0x20, 0x10));
1118



8
    REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x20));
1119



8
    REQUIRE(data[4] == buildHex(0x70, 0x60, 0x50, 0x10));
1120



8
    REQUIRE(data[5] == buildHex(0x70, 0x60, 0x50, 0x40));
1121



8
    REQUIRE(data[6] == buildHex(0xff, 0x40, 0x20, 0x50));
1122



8
    REQUIRE(data[7] == buildHex(0x70, 0x60, 0x50, 0x60));
1123
2
}
1124
1125
6
TEST_CASE("Dye replaceSColor 9 1 avx2", "")
1126
{
1127

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
1128
    uint32_t data[9];
1129
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
1130
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
1131
2
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
1132
2
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
1133
2
    data[4] = buildHex(0xff, 0x30, 0x20, 0x10);
1134
2
    data[5] = buildHex(0xff, 0x30, 0x20, 0x40);
1135
2
    data[6] = buildHex(0xff, 0x40, 0x20, 0x50);
1136
2
    data[7] = buildHex(0xff, 0x30, 0x20, 0x60);
1137
2
    data[8] = buildHex(0xff, 0x30, 0x20, 0x70);
1138

2
    DYEPALETTE(palette, SColorAvx2)(&data[0], 9);
1139



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
1140



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
1141



8
    REQUIRE(data[2] == buildHex(0xff, 0x40, 0x20, 0x10));
1142



8
    REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x20));
1143



8
    REQUIRE(data[4] == buildHex(0x70, 0x60, 0x50, 0x10));
1144



8
    REQUIRE(data[5] == buildHex(0x70, 0x60, 0x50, 0x40));
1145



8
    REQUIRE(data[6] == buildHex(0xff, 0x40, 0x20, 0x50));
1146



8
    REQUIRE(data[7] == buildHex(0x70, 0x60, 0x50, 0x60));
1147



8
    REQUIRE(data[8] == buildHex(0x70, 0x60, 0x50, 0x70));
1148
2
}
1149
1150
6
TEST_CASE("Dye replaceSColor 10 1 avx2", "")
1151
{
1152

10
    DyePalette palette("#123456,000000,ff3020,706050", 6);
1153
    uint32_t data[10];
1154
2
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
1155
2
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
1156
2
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
1157
2
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
1158
2
    data[4] = buildHex(0xff, 0x30, 0x20, 0x10);
1159
2
    data[5] = buildHex(0xff, 0x30, 0x20, 0x40);
1160
2
    data[6] = buildHex(0xff, 0x40, 0x20, 0x50);
1161
2
    data[7] = buildHex(0xff, 0x30, 0x20, 0x60);
1162
2
    data[8] = buildHex(0x12, 0x34, 0x56, 0x70);
1163
2
    data[9] = buildHex(0xff, 0x30, 0x20, 0x80);
1164

2
    DYEPALETTE(palette, SColorAvx2)(&data[0], 10);
1165



8
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
1166



8
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
1167



8
    REQUIRE(data[2] == buildHex(0xff, 0x40, 0x20, 0x10));
1168



8
    REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x20));
1169



8
    REQUIRE(data[4] == buildHex(0x70, 0x60, 0x50, 0x10));
1170



8
    REQUIRE(data[5] == buildHex(0x70, 0x60, 0x50, 0x40));
1171



8
    REQUIRE(data[6] == buildHex(0xff, 0x40, 0x20, 0x50));
1172



8
    REQUIRE(data[7] == buildHex(0x70, 0x60, 0x50, 0x60));
1173



8
    REQUIRE(data[8] == buildHex(0x00, 0x00, 0x00, 0x70));
1174



8
    REQUIRE(data[9] == buildHex(0x70, 0x60, 0x50, 0x80));
1175
2
}
1176
1177
1178
6
TEST_CASE("Dye replaceAColor 1 1", "")
1179
{
1180

10
    DyePalette palette("#00ff0010,00001120", 8);
1181
    uint32_t data[1];
1182
2
    data[0] = buildHex(0x10, 0x03, 0x02, 0x01);
1183

2
    DYEPALETTE(palette, AColor)(&data[0], 1);
1184



8
    REQUIRE(data[0] == buildHex(0x10, 0x03, 0x02, 0x01));
1185
2
}
1186
1187
6
TEST_CASE("Dye replaceAColor 1 2", "")
1188
{
1189

10
    DyePalette palette("#02ff0120,040311ff", 8);
1190
    uint32_t data[1];
1191
2
    data[0] = buildHex(0x02, 0xff, 0x01, 0x20);
1192

2
    DYEPALETTE(palette, AColor)(&data[0], 1);
1193



8
    REQUIRE(data[0] == buildHex(0x04, 0x03, 0x11, 0xff));
1194
2
}
1195
1196
6
TEST_CASE("Dye replaceAColor 1 3", "")
1197
{
1198

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1199
    uint32_t data[1];
1200
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1201

2
    DYEPALETTE(palette, AColor)(&data[0], 1);
1202



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1203
2
}
1204
1205
6
TEST_CASE("Dye replaceAColor 2 1", "")
1206
{
1207

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1208
    uint32_t data[2];
1209
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1210
2
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1211

2
    DYEPALETTE(palette, AColor)(&data[0], 2);
1212



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1213



8
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1214
2
}
1215
1216
6
TEST_CASE("Dye replaceAColor 3 1", "")
1217
{
1218

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1219
    uint32_t data[3];
1220
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1221
2
    data[1] = buildHex(0x50, 0x40, 0x40, 0x30);
1222
2
    data[2] = buildHex(0x40, 0x40, 0x40, 0x40);
1223

2
    DYEPALETTE(palette, AColor)(&data[0], 3);
1224



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1225



8
    REQUIRE(data[1] == buildHex(0x50, 0x40, 0x40, 0x30));
1226



8
    REQUIRE(data[2] == buildHex(0x20, 0x00, 0x00, 0x00));
1227
2
}
1228
1229
6
TEST_CASE("Dye replaceAColor 4 1", "")
1230
{
1231

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1232
    uint32_t data[4];
1233
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1234
2
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1235
2
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1236
2
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1237

2
    DYEPALETTE(palette, AColor)(&data[0], 4);
1238



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1239



8
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1240



8
    REQUIRE(data[2] == buildHex(0x01, 0x00, 0xee, 0x50));
1241



8
    REQUIRE(data[3] == buildHex(0x20, 0x00, 0x00, 0x00));
1242
2
}
1243
1244
6
TEST_CASE("Dye replaceAColor 5 1", "")
1245
{
1246

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1247
    uint32_t data[5];
1248
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1249
2
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1250
2
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1251
2
    data[3] = buildHex(0x50, 0x40, 0x40, 0x60);
1252
2
    data[4] = buildHex(0x40, 0x40, 0x40, 0x40);
1253

2
    DYEPALETTE(palette, AColor)(&data[0], 5);
1254



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1255



8
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1256



8
    REQUIRE(data[2] == buildHex(0x01, 0x00, 0xee, 0x50));
1257



8
    REQUIRE(data[3] == buildHex(0x50, 0x40, 0x40, 0x60));
1258



8
    REQUIRE(data[4] == buildHex(0x20, 0x00, 0x00, 0x00));
1259
2
}
1260
1261
6
TEST_CASE("Dye replaceAColor 7 1", "")
1262
{
1263

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1264
    uint32_t data[7];
1265
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1266
2
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1267
2
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1268
2
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1269
2
    data[4] = buildHex(0x01, 0x00, 0xee, 0x40);
1270
2
    data[5] = buildHex(0x40, 0x40, 0x41, 0x40);
1271
2
    data[6] = buildHex(0x01, 0x00, 0xee, 0x50);
1272

2
    DYEPALETTE(palette, AColor)(&data[0], 7);
1273



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1274



8
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1275



8
    REQUIRE(data[2] == buildHex(0x01, 0x00, 0xee, 0x50));
1276



8
    REQUIRE(data[3] == buildHex(0x20, 0x00, 0x00, 0x00));
1277



8
    REQUIRE(data[4] == buildHex(0x10, 0x20, 0x30, 0xff));
1278



8
    REQUIRE(data[5] == buildHex(0x40, 0x40, 0x41, 0x40));
1279



8
    REQUIRE(data[6] == buildHex(0x01, 0x00, 0xee, 0x50));
1280
2
}
1281
1282
6
TEST_CASE("Dye replaceAColor 8 1", "")
1283
{
1284

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1285
    uint32_t data[8];
1286
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1287
2
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1288
2
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1289
2
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1290
2
    data[4] = buildHex(0x01, 0x00, 0xee, 0x40);
1291
2
    data[5] = buildHex(0x40, 0x40, 0x41, 0x40);
1292
2
    data[6] = buildHex(0x01, 0x00, 0xee, 0x50);
1293
2
    data[7] = buildHex(0x40, 0x40, 0x40, 0x40);
1294

2
    DYEPALETTE(palette, AColor)(&data[0], 8);
1295



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1296



8
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1297



8
    REQUIRE(data[2] == buildHex(0x01, 0x00, 0xee, 0x50));
1298



8
    REQUIRE(data[3] == buildHex(0x20, 0x00, 0x00, 0x00));
1299



8
    REQUIRE(data[4] == buildHex(0x10, 0x20, 0x30, 0xff));
1300



8
    REQUIRE(data[5] == buildHex(0x40, 0x40, 0x41, 0x40));
1301



8
    REQUIRE(data[6] == buildHex(0x01, 0x00, 0xee, 0x50));
1302



8
    REQUIRE(data[7] == buildHex(0x20, 0x00, 0x00, 0x00));
1303
2
}
1304
1305
6
TEST_CASE("Dye replaceAColor 9 1", "")
1306
{
1307

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1308
    uint32_t data[9];
1309
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1310
2
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1311
2
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1312
2
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1313
2
    data[4] = buildHex(0x01, 0x00, 0xee, 0x40);
1314
2
    data[5] = buildHex(0x40, 0x40, 0x41, 0x40);
1315
2
    data[6] = buildHex(0x01, 0x00, 0xee, 0x50);
1316
2
    data[7] = buildHex(0x02, 0x40, 0x40, 0x40);
1317
2
    data[8] = buildHex(0x40, 0x40, 0x40, 0x40);
1318

2
    DYEPALETTE(palette, AColor)(&data[0], 9);
1319



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1320



8
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1321



8
    REQUIRE(data[2] == buildHex(0x01, 0x00, 0xee, 0x50));
1322



8
    REQUIRE(data[3] == buildHex(0x20, 0x00, 0x00, 0x00));
1323



8
    REQUIRE(data[4] == buildHex(0x10, 0x20, 0x30, 0xff));
1324



8
    REQUIRE(data[5] == buildHex(0x40, 0x40, 0x41, 0x40));
1325



8
    REQUIRE(data[6] == buildHex(0x01, 0x00, 0xee, 0x50));
1326



8
    REQUIRE(data[7] == buildHex(0x02, 0x40, 0x40, 0x40));
1327



8
    REQUIRE(data[8] == buildHex(0x20, 0x00, 0x00, 0x00));
1328
2
}
1329
1330
6
TEST_CASE("Dye replaceAColor 10 1", "")
1331
{
1332

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1333
    uint32_t data[10];
1334
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1335
2
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1336
2
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1337
2
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1338
2
    data[4] = buildHex(0x01, 0x00, 0xee, 0x40);
1339
2
    data[5] = buildHex(0x40, 0x40, 0x41, 0x40);
1340
2
    data[6] = buildHex(0x01, 0x00, 0xee, 0x50);
1341
2
    data[7] = buildHex(0x02, 0x40, 0x40, 0x40);
1342
2
    data[8] = buildHex(0x40, 0x40, 0x40, 0x40);
1343
2
    data[9] = buildHex(0x01, 0x00, 0xee, 0x40);
1344

2
    DYEPALETTE(palette, AColor)(&data[0], 10);
1345



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1346



8
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1347



8
    REQUIRE(data[2] == buildHex(0x01, 0x00, 0xee, 0x50));
1348



8
    REQUIRE(data[3] == buildHex(0x20, 0x00, 0x00, 0x00));
1349



8
    REQUIRE(data[4] == buildHex(0x10, 0x20, 0x30, 0xff));
1350



8
    REQUIRE(data[5] == buildHex(0x40, 0x40, 0x41, 0x40));
1351



8
    REQUIRE(data[6] == buildHex(0x01, 0x00, 0xee, 0x50));
1352



8
    REQUIRE(data[7] == buildHex(0x02, 0x40, 0x40, 0x40));
1353



8
    REQUIRE(data[8] == buildHex(0x20, 0x00, 0x00, 0x00));
1354



8
    REQUIRE(data[9] == buildHex(0x10, 0x20, 0x30, 0xff));
1355
2
}
1356
1357
6
TEST_CASE("Dye replaceAColor 1 1 default", "")
1358
{
1359

10
    DyePalette palette("#00ff0010,00001120", 8);
1360
    uint32_t data[1];
1361
2
    data[0] = buildHex(0x10, 0x03, 0x02, 0x01);
1362
2
    palette.replaceAColorDefault(&data[0], 1);
1363



8
    REQUIRE(data[0] == buildHex(0x10, 0x03, 0x02, 0x01));
1364
2
}
1365
1366
6
TEST_CASE("Dye replaceAColor 1 2 default", "")
1367
{
1368

10
    DyePalette palette("#02ff0120,040311ff", 8);
1369
    uint32_t data[1];
1370
2
    data[0] = buildHex(0x02, 0xff, 0x01, 0x20);
1371
2
    palette.replaceAColorDefault(&data[0], 1);
1372



8
    REQUIRE(data[0] == buildHex(0x04, 0x03, 0x11, 0xff));
1373
2
}
1374
1375
6
TEST_CASE("Dye replaceAColor 1 3 default", "")
1376
{
1377

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1378
    uint32_t data[1];
1379
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1380
2
    palette.replaceAColorDefault(&data[0], 1);
1381



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1382
2
}
1383
1384
6
TEST_CASE("Dye replaceAColor 2 1 default", "")
1385
{
1386

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1387
    uint32_t data[2];
1388
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1389
2
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1390
2
    palette.replaceAColorDefault(&data[0], 2);
1391



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1392



8
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1393
2
}
1394
1395
6
TEST_CASE("Dye replaceAColor 3 1 default", "")
1396
{
1397

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1398
    uint32_t data[3];
1399
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1400
2
    data[1] = buildHex(0x50, 0x40, 0x40, 0x30);
1401
2
    data[2] = buildHex(0x40, 0x40, 0x40, 0x40);
1402
2
    palette.replaceAColorDefault(&data[0], 3);
1403



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1404



8
    REQUIRE(data[1] == buildHex(0x50, 0x40, 0x40, 0x30));
1405



8
    REQUIRE(data[2] == buildHex(0x20, 0x00, 0x00, 0x00));
1406
2
}
1407
1408
6
TEST_CASE("Dye replaceAColor 4 1 default", "")
1409
{
1410

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1411
    uint32_t data[4];
1412
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1413
2
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1414
2
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1415
2
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1416
2
    palette.replaceAColorDefault(&data[0], 4);
1417



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1418



8
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1419



8
    REQUIRE(data[2] == buildHex(0x01, 0x00, 0xee, 0x50));
1420



8
    REQUIRE(data[3] == buildHex(0x20, 0x00, 0x00, 0x00));
1421
2
}
1422
1423
6
TEST_CASE("Dye replaceAColor 5 1 default", "")
1424
{
1425

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1426
    uint32_t data[5];
1427
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1428
2
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1429
2
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1430
2
    data[3] = buildHex(0x50, 0x40, 0x40, 0x60);
1431
2
    data[4] = buildHex(0x40, 0x40, 0x40, 0x40);
1432
2
    palette.replaceAColorDefault(&data[0], 5);
1433



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1434



8
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1435



8
    REQUIRE(data[2] == buildHex(0x01, 0x00, 0xee, 0x50));
1436



8
    REQUIRE(data[3] == buildHex(0x50, 0x40, 0x40, 0x60));
1437



8
    REQUIRE(data[4] == buildHex(0x20, 0x00, 0x00, 0x00));
1438
2
}
1439
1440
6
TEST_CASE("Dye replaceAColor 7 1 default", "")
1441
{
1442

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1443
    uint32_t data[7];
1444
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1445
2
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1446
2
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1447
2
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1448
2
    data[4] = buildHex(0x01, 0x00, 0xee, 0x40);
1449
2
    data[5] = buildHex(0x40, 0x40, 0x41, 0x40);
1450
2
    data[6] = buildHex(0x01, 0x00, 0xee, 0x50);
1451
2
    palette.replaceAColorDefault(&data[0], 7);
1452



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1453



8
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1454



8
    REQUIRE(data[2] == buildHex(0x01, 0x00, 0xee, 0x50));
1455



8
    REQUIRE(data[3] == buildHex(0x20, 0x00, 0x00, 0x00));
1456



8
    REQUIRE(data[4] == buildHex(0x10, 0x20, 0x30, 0xff));
1457



8
    REQUIRE(data[5] == buildHex(0x40, 0x40, 0x41, 0x40));
1458



8
    REQUIRE(data[6] == buildHex(0x01, 0x00, 0xee, 0x50));
1459
2
}
1460
1461
6
TEST_CASE("Dye replaceAColor 8 1 default", "")
1462
{
1463

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1464
    uint32_t data[8];
1465
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1466
2
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1467
2
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1468
2
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1469
2
    data[4] = buildHex(0x01, 0x00, 0xee, 0x40);
1470
2
    data[5] = buildHex(0x40, 0x40, 0x41, 0x40);
1471
2
    data[6] = buildHex(0x01, 0x00, 0xee, 0x50);
1472
2
    data[7] = buildHex(0x40, 0x40, 0x40, 0x40);
1473
2
    palette.replaceAColorDefault(&data[0], 8);
1474



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1475



8
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1476



8
    REQUIRE(data[2] == buildHex(0x01, 0x00, 0xee, 0x50));
1477



8
    REQUIRE(data[3] == buildHex(0x20, 0x00, 0x00, 0x00));
1478



8
    REQUIRE(data[4] == buildHex(0x10, 0x20, 0x30, 0xff));
1479



8
    REQUIRE(data[5] == buildHex(0x40, 0x40, 0x41, 0x40));
1480



8
    REQUIRE(data[6] == buildHex(0x01, 0x00, 0xee, 0x50));
1481



8
    REQUIRE(data[7] == buildHex(0x20, 0x00, 0x00, 0x00));
1482
2
}
1483
1484
6
TEST_CASE("Dye replaceAColor 9 1 default", "")
1485
{
1486

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1487
    uint32_t data[9];
1488
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1489
2
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1490
2
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1491
2
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1492
2
    data[4] = buildHex(0x01, 0x00, 0xee, 0x40);
1493
2
    data[5] = buildHex(0x40, 0x40, 0x41, 0x40);
1494
2
    data[6] = buildHex(0x01, 0x00, 0xee, 0x50);
1495
2
    data[7] = buildHex(0x02, 0x40, 0x40, 0x40);
1496
2
    data[8] = buildHex(0x40, 0x40, 0x40, 0x40);
1497
2
    palette.replaceAColorDefault(&data[0], 9);
1498



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1499



8
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1500



8
    REQUIRE(data[2] == buildHex(0x01, 0x00, 0xee, 0x50));
1501



8
    REQUIRE(data[3] == buildHex(0x20, 0x00, 0x00, 0x00));
1502



8
    REQUIRE(data[4] == buildHex(0x10, 0x20, 0x30, 0xff));
1503



8
    REQUIRE(data[5] == buildHex(0x40, 0x40, 0x41, 0x40));
1504



8
    REQUIRE(data[6] == buildHex(0x01, 0x00, 0xee, 0x50));
1505



8
    REQUIRE(data[7] == buildHex(0x02, 0x40, 0x40, 0x40));
1506



8
    REQUIRE(data[8] == buildHex(0x20, 0x00, 0x00, 0x00));
1507
2
}
1508
1509
6
TEST_CASE("Dye replaceAColor 10 1 default", "")
1510
{
1511

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1512
    uint32_t data[10];
1513
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1514
2
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1515
2
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1516
2
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1517
2
    data[4] = buildHex(0x01, 0x00, 0xee, 0x40);
1518
2
    data[5] = buildHex(0x40, 0x40, 0x41, 0x40);
1519
2
    data[6] = buildHex(0x01, 0x00, 0xee, 0x50);
1520
2
    data[7] = buildHex(0x02, 0x40, 0x40, 0x40);
1521
2
    data[8] = buildHex(0x40, 0x40, 0x40, 0x40);
1522
2
    data[9] = buildHex(0x01, 0x00, 0xee, 0x40);
1523
2
    palette.replaceAColorDefault(&data[0], 10);
1524



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1525



8
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1526



8
    REQUIRE(data[2] == buildHex(0x01, 0x00, 0xee, 0x50));
1527



8
    REQUIRE(data[3] == buildHex(0x20, 0x00, 0x00, 0x00));
1528



8
    REQUIRE(data[4] == buildHex(0x10, 0x20, 0x30, 0xff));
1529



8
    REQUIRE(data[5] == buildHex(0x40, 0x40, 0x41, 0x40));
1530



8
    REQUIRE(data[6] == buildHex(0x01, 0x00, 0xee, 0x50));
1531



8
    REQUIRE(data[7] == buildHex(0x02, 0x40, 0x40, 0x40));
1532



8
    REQUIRE(data[8] == buildHex(0x20, 0x00, 0x00, 0x00));
1533



8
    REQUIRE(data[9] == buildHex(0x10, 0x20, 0x30, 0xff));
1534
2
}
1535
1536
6
TEST_CASE("Dye replaceAColor 1 1 sse2", "")
1537
{
1538

10
    DyePalette palette("#00ff0010,00001120", 8);
1539
    uint32_t data[1];
1540
2
    data[0] = buildHex(0x10, 0x03, 0x02, 0x01);
1541

2
    DYEPALETTE(palette, AColorSse2)(&data[0], 1);
1542



8
    REQUIRE(data[0] == buildHex(0x10, 0x03, 0x02, 0x01));
1543
2
}
1544
1545
6
TEST_CASE("Dye replaceAColor 1 2 sse2", "")
1546
{
1547

10
    DyePalette palette("#02ff0120,040311ff", 8);
1548
    uint32_t data[1];
1549
2
    data[0] = buildHex(0x02, 0xff, 0x01, 0x20);
1550

2
    DYEPALETTE(palette, AColorSse2)(&data[0], 1);
1551



8
    REQUIRE(data[0] == buildHex(0x04, 0x03, 0x11, 0xff));
1552
2
}
1553
1554
6
TEST_CASE("Dye replaceAColor 1 3 sse2", "")
1555
{
1556

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1557
    uint32_t data[1];
1558
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1559

2
    DYEPALETTE(palette, AColorSse2)(&data[0], 1);
1560



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1561
2
}
1562
1563
6
TEST_CASE("Dye replaceAColor 2 1 sse2", "")
1564
{
1565

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1566
    uint32_t data[2];
1567
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1568
2
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1569

2
    DYEPALETTE(palette, AColorSse2)(&data[0], 2);
1570



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1571



8
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1572
2
}
1573
1574
6
TEST_CASE("Dye replaceAColor 3 1 sse2", "")
1575
{
1576

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1577
    uint32_t data[3];
1578
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1579
2
    data[1] = buildHex(0x50, 0x40, 0x40, 0x30);
1580
2
    data[2] = buildHex(0x40, 0x40, 0x40, 0x40);
1581

2
    DYEPALETTE(palette, AColorSse2)(&data[0], 3);
1582



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1583



8
    REQUIRE(data[1] == buildHex(0x50, 0x40, 0x40, 0x30));
1584



8
    REQUIRE(data[2] == buildHex(0x20, 0x00, 0x00, 0x00));
1585
2
}
1586
1587
6
TEST_CASE("Dye replaceAColor 4 1 sse2", "")
1588
{
1589

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1590
    uint32_t data[4];
1591
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1592
2
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1593
2
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1594
2
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1595

2
    DYEPALETTE(palette, AColorSse2)(&data[0], 4);
1596



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1597



8
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1598



8
    REQUIRE(data[2] == buildHex(0x01, 0x00, 0xee, 0x50));
1599



8
    REQUIRE(data[3] == buildHex(0x20, 0x00, 0x00, 0x00));
1600
2
}
1601
1602
6
TEST_CASE("Dye replaceAColor 5 1 sse2", "")
1603
{
1604

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1605
    uint32_t data[5];
1606
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1607
2
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1608
2
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1609
2
    data[3] = buildHex(0x50, 0x40, 0x40, 0x60);
1610
2
    data[4] = buildHex(0x40, 0x40, 0x40, 0x40);
1611

2
    DYEPALETTE(palette, AColorSse2)(&data[0], 5);
1612



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1613



8
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1614



8
    REQUIRE(data[2] == buildHex(0x01, 0x00, 0xee, 0x50));
1615



8
    REQUIRE(data[3] == buildHex(0x50, 0x40, 0x40, 0x60));
1616



8
    REQUIRE(data[4] == buildHex(0x20, 0x00, 0x00, 0x00));
1617
2
}
1618
1619
6
TEST_CASE("Dye replaceAColor 7 1 sse2", "")
1620
{
1621

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1622
    uint32_t data[7];
1623
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1624
2
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1625
2
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1626
2
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1627
2
    data[4] = buildHex(0x01, 0x00, 0xee, 0x40);
1628
2
    data[5] = buildHex(0x40, 0x40, 0x41, 0x40);
1629
2
    data[6] = buildHex(0x01, 0x00, 0xee, 0x50);
1630

2
    DYEPALETTE(palette, AColorSse2)(&data[0], 7);
1631



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1632



8
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1633



8
    REQUIRE(data[2] == buildHex(0x01, 0x00, 0xee, 0x50));
1634



8
    REQUIRE(data[3] == buildHex(0x20, 0x00, 0x00, 0x00));
1635



8
    REQUIRE(data[4] == buildHex(0x10, 0x20, 0x30, 0xff));
1636



8
    REQUIRE(data[5] == buildHex(0x40, 0x40, 0x41, 0x40));
1637



8
    REQUIRE(data[6] == buildHex(0x01, 0x00, 0xee, 0x50));
1638
2
}
1639
1640
6
TEST_CASE("Dye replaceAColor 8 1 sse2", "")
1641
{
1642

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1643
    uint32_t data[8];
1644
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1645
2
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1646
2
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1647
2
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1648
2
    data[4] = buildHex(0x01, 0x00, 0xee, 0x40);
1649
2
    data[5] = buildHex(0x40, 0x40, 0x41, 0x40);
1650
2
    data[6] = buildHex(0x01, 0x00, 0xee, 0x50);
1651
2
    data[7] = buildHex(0x40, 0x40, 0x40, 0x40);
1652

2
    DYEPALETTE(palette, AColorSse2)(&data[0], 8);
1653



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1654



8
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1655



8
    REQUIRE(data[2] == buildHex(0x01, 0x00, 0xee, 0x50));
1656



8
    REQUIRE(data[3] == buildHex(0x20, 0x00, 0x00, 0x00));
1657



8
    REQUIRE(data[4] == buildHex(0x10, 0x20, 0x30, 0xff));
1658



8
    REQUIRE(data[5] == buildHex(0x40, 0x40, 0x41, 0x40));
1659



8
    REQUIRE(data[6] == buildHex(0x01, 0x00, 0xee, 0x50));
1660



8
    REQUIRE(data[7] == buildHex(0x20, 0x00, 0x00, 0x00));
1661
2
}
1662
1663
6
TEST_CASE("Dye replaceAColor 9 1 sse2", "")
1664
{
1665

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1666
    uint32_t data[9];
1667
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1668
2
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1669
2
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1670
2
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1671
2
    data[4] = buildHex(0x01, 0x00, 0xee, 0x40);
1672
2
    data[5] = buildHex(0x40, 0x40, 0x41, 0x40);
1673
2
    data[6] = buildHex(0x01, 0x00, 0xee, 0x50);
1674
2
    data[7] = buildHex(0x02, 0x40, 0x40, 0x40);
1675
2
    data[8] = buildHex(0x40, 0x40, 0x40, 0x40);
1676

2
    DYEPALETTE(palette, AColorSse2)(&data[0], 9);
1677



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1678



8
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1679



8
    REQUIRE(data[2] == buildHex(0x01, 0x00, 0xee, 0x50));
1680



8
    REQUIRE(data[3] == buildHex(0x20, 0x00, 0x00, 0x00));
1681



8
    REQUIRE(data[4] == buildHex(0x10, 0x20, 0x30, 0xff));
1682



8
    REQUIRE(data[5] == buildHex(0x40, 0x40, 0x41, 0x40));
1683



8
    REQUIRE(data[6] == buildHex(0x01, 0x00, 0xee, 0x50));
1684



8
    REQUIRE(data[7] == buildHex(0x02, 0x40, 0x40, 0x40));
1685



8
    REQUIRE(data[8] == buildHex(0x20, 0x00, 0x00, 0x00));
1686
2
}
1687
1688
6
TEST_CASE("Dye replaceAColor 10 1 sse2", "")
1689
{
1690

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1691
    uint32_t data[10];
1692
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1693
2
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1694
2
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1695
2
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1696
2
    data[4] = buildHex(0x01, 0x00, 0xee, 0x40);
1697
2
    data[5] = buildHex(0x40, 0x40, 0x41, 0x40);
1698
2
    data[6] = buildHex(0x01, 0x00, 0xee, 0x50);
1699
2
    data[7] = buildHex(0x02, 0x40, 0x40, 0x40);
1700
2
    data[8] = buildHex(0x40, 0x40, 0x40, 0x40);
1701
2
    data[9] = buildHex(0x01, 0x00, 0xee, 0x40);
1702

2
    DYEPALETTE(palette, AColorSse2)(&data[0], 10);
1703



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1704



8
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1705



8
    REQUIRE(data[2] == buildHex(0x01, 0x00, 0xee, 0x50));
1706



8
    REQUIRE(data[3] == buildHex(0x20, 0x00, 0x00, 0x00));
1707



8
    REQUIRE(data[4] == buildHex(0x10, 0x20, 0x30, 0xff));
1708



8
    REQUIRE(data[5] == buildHex(0x40, 0x40, 0x41, 0x40));
1709



8
    REQUIRE(data[6] == buildHex(0x01, 0x00, 0xee, 0x50));
1710



8
    REQUIRE(data[7] == buildHex(0x02, 0x40, 0x40, 0x40));
1711



8
    REQUIRE(data[8] == buildHex(0x20, 0x00, 0x00, 0x00));
1712



8
    REQUIRE(data[9] == buildHex(0x10, 0x20, 0x30, 0xff));
1713
2
}
1714
1715
6
TEST_CASE("Dye replaceAColor 1 1 avx2", "")
1716
{
1717

10
    DyePalette palette("#00ff0010,00001120", 8);
1718
    uint32_t data[1];
1719
2
    data[0] = buildHex(0x10, 0x03, 0x02, 0x01);
1720

2
    DYEPALETTE(palette, AColorAvx2)(&data[0], 1);
1721



8
    REQUIRE(data[0] == buildHex(0x10, 0x03, 0x02, 0x01));
1722
2
}
1723
1724
6
TEST_CASE("Dye replaceAColor 1 2 avx2", "")
1725
{
1726

10
    DyePalette palette("#02ff0120,040311ff", 8);
1727
    uint32_t data[1];
1728
2
    data[0] = buildHex(0x02, 0xff, 0x01, 0x20);
1729

2
    DYEPALETTE(palette, AColorAvx2)(&data[0], 1);
1730



8
    REQUIRE(data[0] == buildHex(0x04, 0x03, 0x11, 0xff));
1731
2
}
1732
1733
6
TEST_CASE("Dye replaceAColor 1 3 avx2", "")
1734
{
1735

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1736
    uint32_t data[1];
1737
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1738

2
    DYEPALETTE(palette, AColorAvx2)(&data[0], 1);
1739



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1740
2
}
1741
1742
6
TEST_CASE("Dye replaceAColor 2 1 avx2", "")
1743
{
1744

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1745
    uint32_t data[2];
1746
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1747
2
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1748

2
    DYEPALETTE(palette, AColorAvx2)(&data[0], 2);
1749



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1750



8
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1751
2
}
1752
1753
6
TEST_CASE("Dye replaceAColor 3 1 avx2", "")
1754
{
1755

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1756
    uint32_t data[3];
1757
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1758
2
    data[1] = buildHex(0x50, 0x40, 0x40, 0x30);
1759
2
    data[2] = buildHex(0x40, 0x40, 0x40, 0x40);
1760

2
    DYEPALETTE(palette, AColorAvx2)(&data[0], 3);
1761



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1762



8
    REQUIRE(data[1] == buildHex(0x50, 0x40, 0x40, 0x30));
1763



8
    REQUIRE(data[2] == buildHex(0x20, 0x00, 0x00, 0x00));
1764
2
}
1765
1766
6
TEST_CASE("Dye replaceAColor 4 1 avx2", "")
1767
{
1768

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1769
    uint32_t data[4];
1770
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1771
2
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1772
2
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1773
2
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1774

2
    DYEPALETTE(palette, AColorAvx2)(&data[0], 4);
1775



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1776



8
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1777



8
    REQUIRE(data[2] == buildHex(0x01, 0x00, 0xee, 0x50));
1778



8
    REQUIRE(data[3] == buildHex(0x20, 0x00, 0x00, 0x00));
1779
2
}
1780
1781
6
TEST_CASE("Dye replaceAColor 5 1 avx2", "")
1782
{
1783

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1784
    uint32_t data[5];
1785
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1786
2
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1787
2
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1788
2
    data[3] = buildHex(0x50, 0x40, 0x40, 0x60);
1789
2
    data[4] = buildHex(0x40, 0x40, 0x40, 0x40);
1790

2
    DYEPALETTE(palette, AColorAvx2)(&data[0], 5);
1791



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1792



8
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1793



8
    REQUIRE(data[2] == buildHex(0x01, 0x00, 0xee, 0x50));
1794



8
    REQUIRE(data[3] == buildHex(0x50, 0x40, 0x40, 0x60));
1795



8
    REQUIRE(data[4] == buildHex(0x20, 0x00, 0x00, 0x00));
1796
2
}
1797
1798
6
TEST_CASE("Dye replaceAColor 7 1 avx2", "")
1799
{
1800

10
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1801
    uint32_t data[7];
1802
2
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1803
2
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1804
2
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1805
2
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1806
2
    data[4] = buildHex(0x01, 0x00, 0xee, 0x40);
1807
2
    data[5] = buildHex(0x40, 0x40, 0x41, 0x40);
1808
2
    data[6] = buildHex(0x01, 0x00, 0xee, 0x50);
1809

2
    DYEPALETTE(palette, AColorAvx2)(&data[0], 7);
1810



8
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1811



8
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1812



8
    REQUIRE(data[2] == buildHex(0x01, 0x00, 0xee, 0x50));
1813



8
    REQUIRE(data[3] == buildHex(0x20, 0x00, 0x00, 0x00));
1814



8
    REQUIRE(data[4] == buildHex(0x10, 0x20, 0x30, 0xff));
1815