GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/unittests/resources/dye/dye.cc Lines: 1552 1552 100.0 %
Date: 2018-07-14 Branches: 3094 8256 37.5 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2013-2018  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
3
TEST_CASE("Dye replaceSOGLColor 1 1", "")
63
{
64
5
    DyePalette palette("#00ff00,000011", 6);
65
    uint32_t data[1];
66
1
    data[0] = buildHex(0x01, 0x02, 0x03, 0x10);
67

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



4
    REQUIRE(data[0] == buildHex(0x01, 0x02, 0x03, 0x10));
69
1
}
70
71
3
TEST_CASE("Dye replaceSOGLColor 1 2", "")
72
{
73
5
    DyePalette palette("#01ff02,030411", 6);
74
    uint32_t data[1];
75
1
    data[0] = buildHex(0x20, 0x02, 0xff, 0x01);
76

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



4
    REQUIRE(data[0] == buildHex(0x20, 0x11, 0x04, 0x03));
78
1
}
79
80
3
TEST_CASE("Dye replaceSOGLColor 1 3", "")
81
{
82
5
    DyePalette palette("#404040,200000,0100ee,102030", 6);
83
    uint32_t data[1];
84
1
    data[0] = buildHex(0x40, 0xee, 0x00, 0x01);
85

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



4
    REQUIRE(data[0] == buildHex(0x40, 0x30, 0x20, 0x10));
87
1
}
88
89
3
TEST_CASE("Dye replaceSOGLColor 2 1", "")
90
{
91
5
    DyePalette palette("#01ff02,030411", 6);
92
    uint32_t data[2];
93
1
    data[0] = buildHex(0x20, 0x02, 0xff, 0x01);
94
1
    data[1] = buildHex(0x30, 0x02, 0xff, 0x01);
95

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



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



4
    REQUIRE(data[1] == buildHex(0x30, 0x11, 0x04, 0x03));
98
1
}
99
100
3
TEST_CASE("Dye replaceSOGLColor 4 1", "")
101
{
102
5
    DyePalette palette("#01ff02,030411", 6);
103
    uint32_t data[4];
104
1
    data[0] = buildHex(0x20, 0x02, 0xff, 0x01);
105
1
    data[1] = buildHex(0x30, 0x02, 0xff, 0x01);
106
1
    data[2] = buildHex(0x40, 0x02, 0xff, 0x01);
107
1
    data[3] = buildHex(0x50, 0x02, 0xff, 0x02);
108

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



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



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



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



4
    REQUIRE(data[3] == buildHex(0x50, 0x02, 0xff, 0x02));
113
1
}
114
115
3
TEST_CASE("Dye replaceSOGLColor 8 1", "")
116
{
117
5
    DyePalette palette("#01ff02,030411,01ee02,010203", 6);
118
    uint32_t data[8];
119
1
    data[0] = buildHex(0x20, 0x02, 0xff, 0x01);
120
1
    data[1] = buildHex(0x30, 0x02, 0xff, 0x01);
121
1
    data[2] = buildHex(0x40, 0x02, 0xff, 0x01);
122
1
    data[3] = buildHex(0x50, 0x02, 0xff, 0x02);
123
1
    data[4] = buildHex(0x20, 0x02, 0xff, 0x01);
124
1
    data[5] = buildHex(0x30, 0x02, 0xff, 0x01);
125
1
    data[6] = buildHex(0x40, 0x02, 0xff, 0x01);
126
1
    data[7] = buildHex(0x60, 0x02, 0xff, 0x02);
127

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



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



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



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



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



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



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



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



4
    REQUIRE(data[7] == buildHex(0x60, 0x02, 0xff, 0x02));
136
1
}
137
138
3
TEST_CASE("Dye replaceSOGLColor 1 1 default", "")
139
{
140
5
    DyePalette palette("#00ff00,000011", 6);
141
    uint32_t data[1];
142
1
    data[0] = buildHex(0x01, 0x02, 0x03, 0x10);
143
1
    palette.replaceSOGLColorDefault(&data[0], 1);
144



4
    REQUIRE(data[0] == buildHex(0x01, 0x02, 0x03, 0x10));
145
1
}
146
147
3
TEST_CASE("Dye replaceSOGLColor 1 2 default", "")
148
{
149
5
    DyePalette palette("#01ff02,030411", 6);
150
    uint32_t data[1];
151
1
    data[0] = buildHex(0x20, 0x02, 0xff, 0x01);
152
1
    palette.replaceSOGLColorDefault(&data[0], 1);
153



4
    REQUIRE(data[0] == buildHex(0x20, 0x11, 0x04, 0x03));
154
1
}
155
156
3
TEST_CASE("Dye replaceSOGLColor 1 3 default", "")
157
{
158
5
    DyePalette palette("#404040,200000,0100ee,102030", 6);
159
    uint32_t data[1];
160
1
    data[0] = buildHex(0x40, 0xee, 0x00, 0x01);
161
1
    palette.replaceSOGLColorDefault(&data[0], 1);
162



4
    REQUIRE(data[0] == buildHex(0x40, 0x30, 0x20, 0x10));
163
1
}
164
165
3
TEST_CASE("Dye replaceSOGLColor 2 1 default", "")
166
{
167
5
    DyePalette palette("#01ff02,030411", 6);
168
    uint32_t data[2];
169
1
    data[0] = buildHex(0x20, 0x02, 0xff, 0x01);
170
1
    data[1] = buildHex(0x30, 0x02, 0xff, 0x01);
171
1
    palette.replaceSOGLColorDefault(&data[0], 2);
172



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



4
    REQUIRE(data[1] == buildHex(0x30, 0x11, 0x04, 0x03));
174
1
}
175
176
3
TEST_CASE("Dye replaceSOGLColor 4 1 default", "")
177
{
178
5
    DyePalette palette("#01ff02,030411", 6);
179
    uint32_t data[4];
180
1
    data[0] = buildHex(0x20, 0x02, 0xff, 0x01);
181
1
    data[1] = buildHex(0x30, 0x02, 0xff, 0x01);
182
1
    data[2] = buildHex(0x40, 0x02, 0xff, 0x01);
183
1
    data[3] = buildHex(0x50, 0x02, 0xff, 0x02);
184
1
    palette.replaceSOGLColorDefault(&data[0], 4);
185



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



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



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



4
    REQUIRE(data[3] == buildHex(0x50, 0x02, 0xff, 0x02));
189
1
}
190
191
3
TEST_CASE("Dye replaceSOGLColor 8 1 default", "")
192
{
193
5
    DyePalette palette("#01ff02,030411,01ee02,010203", 6);
194
    uint32_t data[8];
195
1
    data[0] = buildHex(0x20, 0x02, 0xff, 0x01);
196
1
    data[1] = buildHex(0x30, 0x02, 0xff, 0x01);
197
1
    data[2] = buildHex(0x40, 0x02, 0xff, 0x01);
198
1
    data[3] = buildHex(0x50, 0x02, 0xff, 0x02);
199
1
    data[4] = buildHex(0x20, 0x02, 0xff, 0x01);
200
1
    data[5] = buildHex(0x30, 0x02, 0xff, 0x01);
201
1
    data[6] = buildHex(0x40, 0x02, 0xff, 0x01);
202
1
    data[7] = buildHex(0x60, 0x02, 0xff, 0x02);
203
1
    palette.replaceSOGLColorDefault(&data[0], 8);
204



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



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



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



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



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



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



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



4
    REQUIRE(data[7] == buildHex(0x60, 0x02, 0xff, 0x02));
212
1
}
213
214
3
TEST_CASE("Dye replaceSOGLColor 8 1 sse2", "")
215
{
216
5
    DyePalette palette("#01ff02,030411,01ee02,010203", 6);
217
    uint32_t data[8];
218
1
    data[0] = buildHex(0x20, 0x02, 0xff, 0x01);
219
1
    data[1] = buildHex(0x30, 0x02, 0xff, 0x01);
220
1
    data[2] = buildHex(0x40, 0x02, 0xff, 0x01);
221
1
    data[3] = buildHex(0x50, 0x02, 0xff, 0x02);
222
1
    data[4] = buildHex(0x20, 0x02, 0xff, 0x01);
223
1
    data[5] = buildHex(0x30, 0x02, 0xff, 0x01);
224
1
    data[6] = buildHex(0x40, 0x02, 0xff, 0x01);
225
1
    data[7] = buildHex(0x60, 0x02, 0xff, 0x02);
226

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



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



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



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



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



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



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



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



4
    REQUIRE(data[7] == buildHex(0x60, 0x02, 0xff, 0x02));
235
1
}
236
237
3
TEST_CASE("Dye replaceSOGLColor 8 1 avx2", "")
238
{
239
5
    DyePalette palette("#01ff02,030411,01ee02,010203", 6);
240
    uint32_t data[8];
241
1
    data[0] = buildHex(0x20, 0x02, 0xff, 0x01);
242
1
    data[1] = buildHex(0x30, 0x02, 0xff, 0x01);
243
1
    data[2] = buildHex(0x40, 0x02, 0xff, 0x01);
244
1
    data[3] = buildHex(0x50, 0x02, 0xff, 0x02);
245
1
    data[4] = buildHex(0x20, 0x02, 0xff, 0x01);
246
1
    data[5] = buildHex(0x30, 0x02, 0xff, 0x01);
247
1
    data[6] = buildHex(0x40, 0x02, 0xff, 0x01);
248
1
    data[7] = buildHex(0x60, 0x02, 0xff, 0x02);
249

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



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



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



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



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



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



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



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



4
    REQUIRE(data[7] == buildHex(0x60, 0x02, 0xff, 0x02));
258
1
}
259
260
261
3
TEST_CASE("Dye replaceAOGLColor 1 1", "")
262
{
263
5
    DyePalette palette("#00ff0010,00001120", 8);
264
    uint32_t data[1];
265
1
    data[0] = buildHex(0x10, 0x03, 0x02, 0x01);
266

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



4
    REQUIRE(data[0] == buildHex(0x10, 0x03, 0x02, 0x01));
268
1
}
269
270
3
TEST_CASE("Dye replaceAOGLColor 1 2", "")
271
{
272
5
    DyePalette palette("#00ff0120,020311ff", 8);
273
    uint32_t data[1];
274
1
    data[0] = buildHex(0x20, 0x01, 0xff, 0x00);
275

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



4
    REQUIRE(data[0] == buildHex(0xff, 0x11, 0x03, 0x02));
277
1
}
278
279
3
TEST_CASE("Dye replaceAOGLColor 1 3", "")
280
{
281
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
282
    uint32_t data[1];
283
1
    data[0] = buildHex(0x40, 0xee, 0x00, 0x01);
284

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



4
    REQUIRE(data[0] == buildHex(0xff, 0x30, 0x20, 0x10));
286
1
}
287
288
3
TEST_CASE("Dye replaceAOGLColor 2 1", "")
289
{
290
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
291
    uint32_t data[2];
292
1
    data[0] = buildHex(0x40, 0xee, 0x00, 0x01);
293
1
    data[1] = buildHex(0x40, 0xee, 0x00, 0x01);
294

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



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



4
    REQUIRE(data[1] == buildHex(0xff, 0x30, 0x20, 0x10));
297
1
}
298
299
3
TEST_CASE("Dye replaceAOGLColor 4 1", "")
300
{
301
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
302
    uint32_t data[4];
303
1
    data[0] = buildHex(0x40, 0xee, 0x00, 0x01);
304
1
    data[1] = buildHex(0x40, 0xee, 0x00, 0x01);
305
1
    data[2] = buildHex(0x41, 0xee, 0x00, 0x01);
306
1
    data[3] = buildHex(0x40, 0xee, 0x00, 0x01);
307

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



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



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



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



4
    REQUIRE(data[3] == buildHex(0xff, 0x30, 0x20, 0x10));
312
1
}
313
314
3
TEST_CASE("Dye replaceAOGLColor 8 1", "")
315
{
316
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
317
    uint32_t data[8];
318
1
    data[0] = buildHex(0x40, 0xee, 0x00, 0x01);
319
1
    data[1] = buildHex(0x40, 0xee, 0x00, 0x01);
320
1
    data[2] = buildHex(0x41, 0xee, 0x00, 0x01);
321
1
    data[3] = buildHex(0x40, 0xee, 0x00, 0x01);
322
1
    data[4] = buildHex(0x40, 0xee, 0x00, 0x01);
323
1
    data[5] = buildHex(0x40, 0x40, 0x40, 0x40);
324
1
    data[6] = buildHex(0x41, 0xe0, 0x00, 0x01);
325
1
    data[7] = buildHex(0x40, 0xee, 0x00, 0x01);
326

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



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



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



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



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



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



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



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



4
    REQUIRE(data[7] == buildHex(0xff, 0x30, 0x20, 0x10));
335
1
}
336
337
3
TEST_CASE("Dye replaceAOGLColor 1 1 default", "")
338
{
339
5
    DyePalette palette("#00ff0010,00001120", 8);
340
    uint32_t data[1];
341
1
    data[0] = buildHex(0x10, 0x03, 0x02, 0x01);
342
1
    palette.replaceAOGLColorDefault(&data[0], 1);
343



4
    REQUIRE(data[0] == buildHex(0x10, 0x03, 0x02, 0x01));
344
1
}
345
346
3
TEST_CASE("Dye replaceAOGLColor 1 2 default", "")
347
{
348
5
    DyePalette palette("#00ff0120,020311ff", 8);
349
    uint32_t data[1];
350
1
    data[0] = buildHex(0x20, 0x01, 0xff, 0x00);
351
1
    palette.replaceAOGLColorDefault(&data[0], 1);
352



4
    REQUIRE(data[0] == buildHex(0xff, 0x11, 0x03, 0x02));
353
1
}
354
355
3
TEST_CASE("Dye replaceAOGLColor 1 3 default", "")
356
{
357
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
358
    uint32_t data[1];
359
1
    data[0] = buildHex(0x40, 0xee, 0x00, 0x01);
360
1
    palette.replaceAOGLColorDefault(&data[0], 1);
361



4
    REQUIRE(data[0] == buildHex(0xff, 0x30, 0x20, 0x10));
362
1
}
363
364
3
TEST_CASE("Dye replaceAOGLColor 2 1 default", "")
365
{
366
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
367
    uint32_t data[2];
368
1
    data[0] = buildHex(0x40, 0xee, 0x00, 0x01);
369
1
    data[1] = buildHex(0x40, 0xee, 0x00, 0x01);
370
1
    palette.replaceAOGLColorDefault(&data[0], 2);
371



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



4
    REQUIRE(data[1] == buildHex(0xff, 0x30, 0x20, 0x10));
373
1
}
374
375
3
TEST_CASE("Dye replaceAOGLColor 4 1 default", "")
376
{
377
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
378
    uint32_t data[4];
379
1
    data[0] = buildHex(0x40, 0xee, 0x00, 0x01);
380
1
    data[1] = buildHex(0x40, 0xee, 0x00, 0x01);
381
1
    data[2] = buildHex(0x41, 0xee, 0x00, 0x01);
382
1
    data[3] = buildHex(0x40, 0xee, 0x00, 0x01);
383
1
    palette.replaceAOGLColorDefault(&data[0], 4);
384


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



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



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



4
    REQUIRE(data[3] == buildHex(0xff, 0x30, 0x20, 0x10));
388
1
}
389
390
3
TEST_CASE("Dye replaceAOGLColor 8 1 default", "")
391
{
392
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
393
    uint32_t data[8];
394
1
    data[0] = buildHex(0x40, 0xee, 0x00, 0x01);
395
1
    data[1] = buildHex(0x40, 0xee, 0x00, 0x01);
396
1
    data[2] = buildHex(0x41, 0xee, 0x00, 0x01);
397
1
    data[3] = buildHex(0x40, 0xee, 0x00, 0x01);
398
1
    data[4] = buildHex(0x40, 0xee, 0x00, 0x01);
399
1
    data[5] = buildHex(0x40, 0x40, 0x40, 0x40);
400
1
    data[6] = buildHex(0x41, 0xe0, 0x00, 0x01);
401
1
    data[7] = buildHex(0x40, 0xee, 0x00, 0x01);
402
1
    palette.replaceAOGLColorDefault(&data[0], 8);
403



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



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



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



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



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



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



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



4
    REQUIRE(data[7] == buildHex(0xff, 0x30, 0x20, 0x10));
411
1
}
412
413
3
TEST_CASE("Dye replaceAOGLColor 8 1 sse2", "")
414
{
415
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
416
    uint32_t data[8];
417
1
    data[0] = buildHex(0x40, 0xee, 0x00, 0x01);
418
1
    data[1] = buildHex(0x40, 0xee, 0x00, 0x01);
419
1
    data[2] = buildHex(0x41, 0xee, 0x00, 0x01);
420
1
    data[3] = buildHex(0x40, 0xee, 0x00, 0x01);
421
1
    data[4] = buildHex(0x40, 0xee, 0x00, 0x01);
422
1
    data[5] = buildHex(0x40, 0x40, 0x40, 0x40);
423
1
    data[6] = buildHex(0x41, 0xe0, 0x00, 0x01);
424
1
    data[7] = buildHex(0x40, 0xee, 0x00, 0x01);
425

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



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



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



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



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



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



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



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



4
    REQUIRE(data[7] == buildHex(0xff, 0x30, 0x20, 0x10));
434
1
}
435
436
3
TEST_CASE("Dye replaceAOGLColor 8 1 avx2", "")
437
{
438
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
439
    uint32_t data[8];
440
1
    data[0] = buildHex(0x40, 0xee, 0x00, 0x01);
441
1
    data[1] = buildHex(0x40, 0xee, 0x00, 0x01);
442
1
    data[2] = buildHex(0x41, 0xee, 0x00, 0x01);
443
1
    data[3] = buildHex(0x40, 0xee, 0x00, 0x01);
444
1
    data[4] = buildHex(0x40, 0xee, 0x00, 0x01);
445
1
    data[5] = buildHex(0x40, 0x40, 0x40, 0x40);
446
1
    data[6] = buildHex(0x41, 0xe0, 0x00, 0x01);
447
1
    data[7] = buildHex(0x40, 0xee, 0x00, 0x01);
448

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



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



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



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



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



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



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



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



4
    REQUIRE(data[7] == buildHex(0xff, 0x30, 0x20, 0x10));
457
1
}
458
#endif  // USE_OPENGL
459
460
461
3
TEST_CASE("Dye replaceSColor 1 1", "")
462
{
463
5
    DyePalette palette("#00ff00,000011", 6);
464
    uint32_t data[1];
465
1
    data[0] = buildHex(0x10, 0x03, 0x02, 0x01);
466

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



4
    REQUIRE(data[0] == buildHex(0x10, 0x03, 0x02, 0x01));
468
1
}
469
470
3
TEST_CASE("Dye replaceSColor 1 2", "")
471
{
472
5
    DyePalette palette("#403020,706050", 6);
473
    uint32_t data[1];
474
1
    data[0] = buildHex(0x40, 0x30, 0x20, 0x10);
475

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



4
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
477
1
}
478
479
3
TEST_CASE("Dye replaceSColor 1 3", "")
480
{
481
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
482
    uint32_t data[1];
483
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
484

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



4
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
486
1
}
487
488
3
TEST_CASE("Dye replaceSColor 2 1", "")
489
{
490
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
491
    uint32_t data[2];
492
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
493
1
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
494

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



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



4
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
497
1
}
498
499
3
TEST_CASE("Dye replaceSColor 3 1", "")
500
{
501
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
502
    uint32_t data[3];
503
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
504
1
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
505
1
    data[2] = buildHex(0xff, 0x30, 0x20, 0x30);
506

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



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



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



4
    REQUIRE(data[2] == buildHex(0x70, 0x60, 0x50, 0x30));
510
1
}
511
512
3
TEST_CASE("Dye replaceSColor 4 1", "")
513
{
514
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
515
    uint32_t data[4];
516
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
517
1
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
518
1
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
519
1
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
520

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



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



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



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



4
    REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x20));
525
1
}
526
527
3
TEST_CASE("Dye replaceSColor 5 1", "")
528
{
529
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
530
    uint32_t data[5];
531
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
532
1
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
533
1
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
534
1
    data[3] = buildHex(0xff, 0x30, 0x20, 0x30);
535
1
    data[4] = buildHex(0xff, 0x30, 0x20, 0x20);
536

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



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



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



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



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



4
    REQUIRE(data[4] == buildHex(0x70, 0x60, 0x50, 0x20));
542
1
}
543
544
3
TEST_CASE("Dye replaceSColor 7 1", "")
545
{
546
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
547
    uint32_t data[7];
548
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
549
1
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
550
1
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
551
1
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
552
1
    data[4] = buildHex(0xff, 0x30, 0x20, 0x10);
553
1
    data[5] = buildHex(0xff, 0x30, 0x20, 0x40);
554
1
    data[6] = buildHex(0xff, 0x40, 0x20, 0x50);
555

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



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



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



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



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



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



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



4
    REQUIRE(data[6] == buildHex(0xff, 0x40, 0x20, 0x50));
563
1
}
564
565
3
TEST_CASE("Dye replaceSColor 8 1", "")
566
{
567
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
568
    uint32_t data[8];
569
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
570
1
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
571
1
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
572
1
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
573
1
    data[4] = buildHex(0xff, 0x30, 0x20, 0x10);
574
1
    data[5] = buildHex(0xff, 0x30, 0x20, 0x40);
575
1
    data[6] = buildHex(0xff, 0x40, 0x20, 0x50);
576
1
    data[7] = buildHex(0xff, 0x30, 0x20, 0x60);
577

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



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



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



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



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



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



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



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



4
    REQUIRE(data[7] == buildHex(0x70, 0x60, 0x50, 0x60));
586
1
}
587
588
3
TEST_CASE("Dye replaceSColor 9 1", "")
589
{
590
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
591
    uint32_t data[9];
592
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
593
1
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
594
1
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
595
1
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
596
1
    data[4] = buildHex(0xff, 0x30, 0x20, 0x10);
597
1
    data[5] = buildHex(0xff, 0x30, 0x20, 0x40);
598
1
    data[6] = buildHex(0xff, 0x40, 0x20, 0x50);
599
1
    data[7] = buildHex(0xff, 0x30, 0x20, 0x60);
600
1
    data[8] = buildHex(0xff, 0x30, 0x20, 0x70);
601

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



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



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



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



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



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



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



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



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



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

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



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



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



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



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



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



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



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



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



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



4
    REQUIRE(data[9] == buildHex(0x70, 0x60, 0x50, 0x80));
638
1
}
639
640
3
TEST_CASE("Dye replaceSColor 1 1 default", "")
641
{
642
5
    DyePalette palette("#00ff00,000011", 6);
643
    uint32_t data[1];
644
1
    data[0] = buildHex(0x10, 0x03, 0x02, 0x01);
645
1
    palette.replaceSColorDefault(&data[0], 1);
646



4
    REQUIRE(data[0] == buildHex(0x10, 0x03, 0x02, 0x01));
647
1
}
648
649
3
TEST_CASE("Dye replaceSColor 1 2 default", "")
650
{
651
5
    DyePalette palette("#403020,706050", 6);
652
    uint32_t data[1];
653
1
    data[0] = buildHex(0x40, 0x30, 0x20, 0x10);
654
1
    palette.replaceSColorDefault(&data[0], 1);
655



4
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
656
1
}
657
658
3
TEST_CASE("Dye replaceSColor 1 3 default", "")
659
{
660
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
661
    uint32_t data[1];
662
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
663
1
    palette.replaceSColorDefault(&data[0], 1);
664



4
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
665
1
}
666
667
3
TEST_CASE("Dye replaceSColor 2 1 default", "")
668
{
669
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
670
    uint32_t data[2];
671
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
672
1
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
673
1
    palette.replaceSColorDefault(&data[0], 2);
674



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



4
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
676
1
}
677
678
3
TEST_CASE("Dye replaceSColor 3 1 default", "")
679
{
680
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
681
    uint32_t data[3];
682
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
683
1
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
684
1
    data[2] = buildHex(0xff, 0x30, 0x20, 0x30);
685
1
    palette.replaceSColorDefault(&data[0], 3);
686



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



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



4
    REQUIRE(data[2] == buildHex(0x70, 0x60, 0x50, 0x30));
689
1
}
690
691
3
TEST_CASE("Dye replaceSColor 4 1 default", "")
692
{
693
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
694
    uint32_t data[4];
695
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
696
1
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
697
1
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
698
1
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
699
1
    palette.replaceSColorDefault(&data[0], 4);
700



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



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



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



4
    REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x20));
704
1
}
705
706
3
TEST_CASE("Dye replaceSColor 5 1 default", "")
707
{
708
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
709
    uint32_t data[5];
710
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
711
1
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
712
1
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
713
1
    data[3] = buildHex(0xff, 0x30, 0x20, 0x30);
714
1
    data[4] = buildHex(0xff, 0x30, 0x20, 0x20);
715
1
    palette.replaceSColorDefault(&data[0], 5);
716



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



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



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



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



4
    REQUIRE(data[4] == buildHex(0x70, 0x60, 0x50, 0x20));
721
1
}
722
723
3
TEST_CASE("Dye replaceSColor 7 1 default", "")
724
{
725
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
726
    uint32_t data[7];
727
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
728
1
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
729
1
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
730
1
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
731
1
    data[4] = buildHex(0xff, 0x30, 0x20, 0x10);
732
1
    data[5] = buildHex(0xff, 0x30, 0x20, 0x40);
733
1
    data[6] = buildHex(0xff, 0x40, 0x20, 0x50);
734
1
    palette.replaceSColorDefault(&data[0], 7);
735



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



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



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



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



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



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



4
    REQUIRE(data[6] == buildHex(0xff, 0x40, 0x20, 0x50));
742
1
}
743
744
3
TEST_CASE("Dye replaceSColor 8 1 default", "")
745
{
746
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
747
    uint32_t data[8];
748
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
749
1
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
750
1
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
751
1
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
752
1
    data[4] = buildHex(0xff, 0x30, 0x20, 0x10);
753
1
    data[5] = buildHex(0xff, 0x30, 0x20, 0x40);
754
1
    data[6] = buildHex(0xff, 0x40, 0x20, 0x50);
755
1
    data[7] = buildHex(0xff, 0x30, 0x20, 0x60);
756
1
    palette.replaceSColorDefault(&data[0], 8);
757



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



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



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



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



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



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



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



4
    REQUIRE(data[7] == buildHex(0x70, 0x60, 0x50, 0x60));
765
1
}
766
767
3
TEST_CASE("Dye replaceSColor 9 1 default", "")
768
{
769
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
770
    uint32_t data[9];
771
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
772
1
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
773
1
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
774
1
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
775
1
    data[4] = buildHex(0xff, 0x30, 0x20, 0x10);
776
1
    data[5] = buildHex(0xff, 0x30, 0x20, 0x40);
777
1
    data[6] = buildHex(0xff, 0x40, 0x20, 0x50);
778
1
    data[7] = buildHex(0xff, 0x30, 0x20, 0x60);
779
1
    data[8] = buildHex(0xff, 0x30, 0x20, 0x70);
780
1
    palette.replaceSColorDefault(&data[0], 9);
781



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



4
    REQUIRE(data[9] == buildHex(0x70, 0x60, 0x50, 0x80));
817
1
}
818
819
3
TEST_CASE("Dye replaceSColor 1 1 sse2", "")
820
{
821
5
    DyePalette palette("#00ff00,000011", 6);
822
    uint32_t data[1];
823
1
    data[0] = buildHex(0x10, 0x03, 0x02, 0x01);
824

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



4
    REQUIRE(data[0] == buildHex(0x10, 0x03, 0x02, 0x01));
826
1
}
827
828
3
TEST_CASE("Dye replaceSColor 1 2 sse2", "")
829
{
830
5
    DyePalette palette("#403020,706050", 6);
831
    uint32_t data[1];
832
1
    data[0] = buildHex(0x40, 0x30, 0x20, 0x10);
833

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



4
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
835
1
}
836
837
3
TEST_CASE("Dye replaceSColor 1 3 sse2", "")
838
{
839
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
840
    uint32_t data[1];
841
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
842

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



4
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
844
1
}
845
846
3
TEST_CASE("Dye replaceSColor 2 1 sse2", "")
847
{
848
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
849
    uint32_t data[2];
850
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
851
1
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
852

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



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



4
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
855
1
}
856
857
3
TEST_CASE("Dye replaceSColor 3 1 sse2", "")
858
{
859
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
860
    uint32_t data[3];
861
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
862
1
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
863
1
    data[2] = buildHex(0xff, 0x30, 0x20, 0x30);
864

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



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



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



4
    REQUIRE(data[2] == buildHex(0x70, 0x60, 0x50, 0x30));
868
1
}
869
870
3
TEST_CASE("Dye replaceSColor 4 1 sse2", "")
871
{
872
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
873
    uint32_t data[4];
874
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
875
1
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
876
1
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
877
1
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
878

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



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



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



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



4
    REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x20));
883
1
}
884
885
3
TEST_CASE("Dye replaceSColor 5 1 sse2", "")
886
{
887
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
888
    uint32_t data[5];
889
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
890
1
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
891
1
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
892
1
    data[3] = buildHex(0xff, 0x30, 0x20, 0x30);
893
1
    data[4] = buildHex(0xff, 0x30, 0x20, 0x20);
894

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



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



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



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



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



4
    REQUIRE(data[4] == buildHex(0x70, 0x60, 0x50, 0x20));
900
1
}
901
902
3
TEST_CASE("Dye replaceSColor 7 1 sse2", "")
903
{
904
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
905
    uint32_t data[7];
906
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
907
1
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
908
1
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
909
1
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
910
1
    data[4] = buildHex(0xff, 0x30, 0x20, 0x10);
911
1
    data[5] = buildHex(0xff, 0x30, 0x20, 0x40);
912
1
    data[6] = buildHex(0xff, 0x40, 0x20, 0x50);
913

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



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



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



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



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



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



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



4
    REQUIRE(data[6] == buildHex(0xff, 0x40, 0x20, 0x50));
921
1
}
922
923
3
TEST_CASE("Dye replaceSColor 8 1 sse2", "")
924
{
925
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
926
    uint32_t data[8];
927
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
928
1
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
929
1
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
930
1
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
931
1
    data[4] = buildHex(0xff, 0x30, 0x20, 0x10);
932
1
    data[5] = buildHex(0xff, 0x30, 0x20, 0x40);
933
1
    data[6] = buildHex(0xff, 0x40, 0x20, 0x50);
934
1
    data[7] = buildHex(0xff, 0x30, 0x20, 0x60);
935

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



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



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



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



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



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



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



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



4
    REQUIRE(data[7] == buildHex(0x70, 0x60, 0x50, 0x60));
944
1
}
945
946
3
TEST_CASE("Dye replaceSColor 9 1 sse2", "")
947
{
948
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
949
    uint32_t data[9];
950
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
951
1
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
952
1
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
953
1
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
954
1
    data[4] = buildHex(0xff, 0x30, 0x20, 0x10);
955
1
    data[5] = buildHex(0xff, 0x30, 0x20, 0x40);
956
1
    data[6] = buildHex(0xff, 0x40, 0x20, 0x50);
957
1
    data[7] = buildHex(0xff, 0x30, 0x20, 0x60);
958
1
    data[8] = buildHex(0xff, 0x30, 0x20, 0x70);
959

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



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



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



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



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



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



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



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



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



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

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



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



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



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



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



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



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



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



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



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



4
    REQUIRE(data[9] == buildHex(0x70, 0x60, 0x50, 0x80));
996
1
}
997
998
3
TEST_CASE("Dye replaceSColor 1 1 avx2", "")
999
{
1000
5
    DyePalette palette("#00ff00,000011", 6);
1001
    uint32_t data[1];
1002
1
    data[0] = buildHex(0x10, 0x03, 0x02, 0x01);
1003

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



4
    REQUIRE(data[0] == buildHex(0x10, 0x03, 0x02, 0x01));
1005
1
}
1006
1007
3
TEST_CASE("Dye replaceSColor 1 2 avx2", "")
1008
{
1009
5
    DyePalette palette("#403020,706050", 6);
1010
    uint32_t data[1];
1011
1
    data[0] = buildHex(0x40, 0x30, 0x20, 0x10);
1012

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



4
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
1014
1
}
1015
1016
3
TEST_CASE("Dye replaceSColor 1 3 avx2", "")
1017
{
1018
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
1019
    uint32_t data[1];
1020
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
1021

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



4
    REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
1023
1
}
1024
1025
3
TEST_CASE("Dye replaceSColor 2 1 avx2", "")
1026
{
1027
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
1028
    uint32_t data[2];
1029
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
1030
1
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
1031

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



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



4
    REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
1034
1
}
1035
1036
3
TEST_CASE("Dye replaceSColor 3 1 avx2", "")
1037
{
1038
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
1039
    uint32_t data[3];
1040
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
1041
1
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
1042
1
    data[2] = buildHex(0xff, 0x30, 0x20, 0x30);
1043

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



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



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



4
    REQUIRE(data[2] == buildHex(0x70, 0x60, 0x50, 0x30));
1047
1
}
1048
1049
3
TEST_CASE("Dye replaceSColor 4 1 avx2", "")
1050
{
1051
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
1052
    uint32_t data[4];
1053
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
1054
1
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
1055
1
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
1056
1
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
1057

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



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



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



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



4
    REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x20));
1062
1
}
1063
1064
3
TEST_CASE("Dye replaceSColor 5 1 avx2", "")
1065
{
1066
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
1067
    uint32_t data[5];
1068
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
1069
1
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
1070
1
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
1071
1
    data[3] = buildHex(0xff, 0x30, 0x20, 0x30);
1072
1
    data[4] = buildHex(0xff, 0x30, 0x20, 0x20);
1073

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



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



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



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



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



4
    REQUIRE(data[4] == buildHex(0x70, 0x60, 0x50, 0x20));
1079
1
}
1080
1081
3
TEST_CASE("Dye replaceSColor 7 1 avx2", "")
1082
{
1083
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
1084
    uint32_t data[7];
1085
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
1086
1
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
1087
1
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
1088
1
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
1089
1
    data[4] = buildHex(0xff, 0x30, 0x20, 0x10);
1090
1
    data[5] = buildHex(0xff, 0x30, 0x20, 0x40);
1091
1
    data[6] = buildHex(0xff, 0x40, 0x20, 0x50);
1092

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



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



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



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



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



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



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



4
    REQUIRE(data[6] == buildHex(0xff, 0x40, 0x20, 0x50));
1100
1
}
1101
1102
3
TEST_CASE("Dye replaceSColor 8 1 avx2", "")
1103
{
1104
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
1105
    uint32_t data[8];
1106
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
1107
1
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
1108
1
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
1109
1
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
1110
1
    data[4] = buildHex(0xff, 0x30, 0x20, 0x10);
1111
1
    data[5] = buildHex(0xff, 0x30, 0x20, 0x40);
1112
1
    data[6] = buildHex(0xff, 0x40, 0x20, 0x50);
1113
1
    data[7] = buildHex(0xff, 0x30, 0x20, 0x60);
1114

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



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



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



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



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



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



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



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



4
    REQUIRE(data[7] == buildHex(0x70, 0x60, 0x50, 0x60));
1123
1
}
1124
1125
3
TEST_CASE("Dye replaceSColor 9 1 avx2", "")
1126
{
1127
5
    DyePalette palette("#123456,000000,ff3020,706050", 6);
1128
    uint32_t data[9];
1129
1
    data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
1130
1
    data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
1131
1
    data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
1132
1
    data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
1133
1
    data[4] = buildHex(0xff, 0x30, 0x20, 0x10);
1134
1
    data[5] = buildHex(0xff, 0x30, 0x20, 0x40);
1135
1
    data[6] = buildHex(0xff, 0x40, 0x20, 0x50);
1136
1
    data[7] = buildHex(0xff, 0x30, 0x20, 0x60);
1137
1
    data[8] = buildHex(0xff, 0x30, 0x20, 0x70);
1138

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



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



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



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



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



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



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



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



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



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

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



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



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



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



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



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



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



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



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



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



4
    REQUIRE(data[9] == buildHex(0x70, 0x60, 0x50, 0x80));
1175
1
}
1176
1177
1178
3
TEST_CASE("Dye replaceAColor 1 1", "")
1179
{
1180
5
    DyePalette palette("#00ff0010,00001120", 8);
1181
    uint32_t data[1];
1182
1
    data[0] = buildHex(0x10, 0x03, 0x02, 0x01);
1183

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



4
    REQUIRE(data[0] == buildHex(0x10, 0x03, 0x02, 0x01));
1185
1
}
1186
1187
3
TEST_CASE("Dye replaceAColor 1 2", "")
1188
{
1189
5
    DyePalette palette("#02ff0120,040311ff", 8);
1190
    uint32_t data[1];
1191
1
    data[0] = buildHex(0x02, 0xff, 0x01, 0x20);
1192

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



4
    REQUIRE(data[0] == buildHex(0x04, 0x03, 0x11, 0xff));
1194
1
}
1195
1196
3
TEST_CASE("Dye replaceAColor 1 3", "")
1197
{
1198
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1199
    uint32_t data[1];
1200
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1201

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



4
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1203
1
}
1204
1205
3
TEST_CASE("Dye replaceAColor 2 1", "")
1206
{
1207
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1208
    uint32_t data[2];
1209
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1210
1
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1211

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



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



4
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1214
1
}
1215
1216
3
TEST_CASE("Dye replaceAColor 3 1", "")
1217
{
1218
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1219
    uint32_t data[3];
1220
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1221
1
    data[1] = buildHex(0x50, 0x40, 0x40, 0x30);
1222
1
    data[2] = buildHex(0x40, 0x40, 0x40, 0x40);
1223

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



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



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



4
    REQUIRE(data[2] == buildHex(0x20, 0x00, 0x00, 0x00));
1227
1
}
1228
1229
3
TEST_CASE("Dye replaceAColor 4 1", "")
1230
{
1231
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1232
    uint32_t data[4];
1233
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1234
1
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1235
1
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1236
1
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1237

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



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



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



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



4
    REQUIRE(data[3] == buildHex(0x20, 0x00, 0x00, 0x00));
1242
1
}
1243
1244
3
TEST_CASE("Dye replaceAColor 5 1", "")
1245
{
1246
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1247
    uint32_t data[5];
1248
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1249
1
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1250
1
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1251
1
    data[3] = buildHex(0x50, 0x40, 0x40, 0x60);
1252
1
    data[4] = buildHex(0x40, 0x40, 0x40, 0x40);
1253

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



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



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



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



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



4
    REQUIRE(data[4] == buildHex(0x20, 0x00, 0x00, 0x00));
1259
1
}
1260
1261
3
TEST_CASE("Dye replaceAColor 7 1", "")
1262
{
1263
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1264
    uint32_t data[7];
1265
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1266
1
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1267
1
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1268
1
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1269
1
    data[4] = buildHex(0x01, 0x00, 0xee, 0x40);
1270
1
    data[5] = buildHex(0x40, 0x40, 0x41, 0x40);
1271
1
    data[6] = buildHex(0x01, 0x00, 0xee, 0x50);
1272

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



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



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



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



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



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



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



4
    REQUIRE(data[6] == buildHex(0x01, 0x00, 0xee, 0x50));
1280
1
}
1281
1282
3
TEST_CASE("Dye replaceAColor 8 1", "")
1283
{
1284
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1285
    uint32_t data[8];
1286
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1287
1
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1288
1
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1289
1
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1290
1
    data[4] = buildHex(0x01, 0x00, 0xee, 0x40);
1291
1
    data[5] = buildHex(0x40, 0x40, 0x41, 0x40);
1292
1
    data[6] = buildHex(0x01, 0x00, 0xee, 0x50);
1293
1
    data[7] = buildHex(0x40, 0x40, 0x40, 0x40);
1294

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



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



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



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



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



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



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



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



4
    REQUIRE(data[7] == buildHex(0x20, 0x00, 0x00, 0x00));
1303
1
}
1304
1305
3
TEST_CASE("Dye replaceAColor 9 1", "")
1306
{
1307
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1308
    uint32_t data[9];
1309
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1310
1
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1311
1
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1312
1
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1313
1
    data[4] = buildHex(0x01, 0x00, 0xee, 0x40);
1314
1
    data[5] = buildHex(0x40, 0x40, 0x41, 0x40);
1315
1
    data[6] = buildHex(0x01, 0x00, 0xee, 0x50);
1316
1
    data[7] = buildHex(0x02, 0x40, 0x40, 0x40);
1317
1
    data[8] = buildHex(0x40, 0x40, 0x40, 0x40);
1318

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



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



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



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



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



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



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



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



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



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

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



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



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



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



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



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



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



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



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



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



4
    REQUIRE(data[9] == buildHex(0x10, 0x20, 0x30, 0xff));
1355
1
}
1356
1357
3
TEST_CASE("Dye replaceAColor 1 1 default", "")
1358
{
1359
5
    DyePalette palette("#00ff0010,00001120", 8);
1360
    uint32_t data[1];
1361
1
    data[0] = buildHex(0x10, 0x03, 0x02, 0x01);
1362
1
    palette.replaceAColorDefault(&data[0], 1);
1363



4
    REQUIRE(data[0] == buildHex(0x10, 0x03, 0x02, 0x01));
1364
1
}
1365
1366
3
TEST_CASE("Dye replaceAColor 1 2 default", "")
1367
{
1368
5
    DyePalette palette("#02ff0120,040311ff", 8);
1369
    uint32_t data[1];
1370
1
    data[0] = buildHex(0x02, 0xff, 0x01, 0x20);
1371
1
    palette.replaceAColorDefault(&data[0], 1);
1372



4
    REQUIRE(data[0] == buildHex(0x04, 0x03, 0x11, 0xff));
1373
1
}
1374
1375
3
TEST_CASE("Dye replaceAColor 1 3 default", "")
1376
{
1377
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1378
    uint32_t data[1];
1379
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1380
1
    palette.replaceAColorDefault(&data[0], 1);
1381



4
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1382
1
}
1383
1384
3
TEST_CASE("Dye replaceAColor 2 1 default", "")
1385
{
1386
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1387
    uint32_t data[2];
1388
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1389
1
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1390
1
    palette.replaceAColorDefault(&data[0], 2);
1391



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



4
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1393
1
}
1394
1395
3
TEST_CASE("Dye replaceAColor 3 1 default", "")
1396
{
1397
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1398
    uint32_t data[3];
1399
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1400
1
    data[1] = buildHex(0x50, 0x40, 0x40, 0x30);
1401
1
    data[2] = buildHex(0x40, 0x40, 0x40, 0x40);
1402
1
    palette.replaceAColorDefault(&data[0], 3);
1403



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



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



4
    REQUIRE(data[2] == buildHex(0x20, 0x00, 0x00, 0x00));
1406
1
}
1407
1408
3
TEST_CASE("Dye replaceAColor 4 1 default", "")
1409
{
1410
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1411
    uint32_t data[4];
1412
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1413
1
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1414
1
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1415
1
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1416
1
    palette.replaceAColorDefault(&data[0], 4);
1417



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



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



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



4
    REQUIRE(data[3] == buildHex(0x20, 0x00, 0x00, 0x00));
1421
1
}
1422
1423
3
TEST_CASE("Dye replaceAColor 5 1 default", "")
1424
{
1425
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1426
    uint32_t data[5];
1427
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1428
1
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1429
1
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1430
1
    data[3] = buildHex(0x50, 0x40, 0x40, 0x60);
1431
1
    data[4] = buildHex(0x40, 0x40, 0x40, 0x40);
1432
1
    palette.replaceAColorDefault(&data[0], 5);
1433



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



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



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



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



4
    REQUIRE(data[4] == buildHex(0x20, 0x00, 0x00, 0x00));
1438
1
}
1439
1440
3
TEST_CASE("Dye replaceAColor 7 1 default", "")
1441
{
1442
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1443
    uint32_t data[7];
1444
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1445
1
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1446
1
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1447
1
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1448
1
    data[4] = buildHex(0x01, 0x00, 0xee, 0x40);
1449
1
    data[5] = buildHex(0x40, 0x40, 0x41, 0x40);
1450
1
    data[6] = buildHex(0x01, 0x00, 0xee, 0x50);
1451
1
    palette.replaceAColorDefault(&data[0], 7);
1452



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



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



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



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



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



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



4
    REQUIRE(data[6] == buildHex(0x01, 0x00, 0xee, 0x50));
1459
1
}
1460
1461
3
TEST_CASE("Dye replaceAColor 8 1 default", "")
1462
{
1463
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1464
    uint32_t data[8];
1465
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1466
1
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1467
1
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1468
1
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1469
1
    data[4] = buildHex(0x01, 0x00, 0xee, 0x40);
1470
1
    data[5] = buildHex(0x40, 0x40, 0x41, 0x40);
1471
1
    data[6] = buildHex(0x01, 0x00, 0xee, 0x50);
1472
1
    data[7] = buildHex(0x40, 0x40, 0x40, 0x40);
1473
1
    palette.replaceAColorDefault(&data[0], 8);
1474



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



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



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



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



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



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



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



4
    REQUIRE(data[7] == buildHex(0x20, 0x00, 0x00, 0x00));
1482
1
}
1483
1484
3
TEST_CASE("Dye replaceAColor 9 1 default", "")
1485
{
1486
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1487
    uint32_t data[9];
1488
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1489
1
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1490
1
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1491
1
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1492
1
    data[4] = buildHex(0x01, 0x00, 0xee, 0x40);
1493
1
    data[5] = buildHex(0x40, 0x40, 0x41, 0x40);
1494
1
    data[6] = buildHex(0x01, 0x00, 0xee, 0x50);
1495
1
    data[7] = buildHex(0x02, 0x40, 0x40, 0x40);
1496
1
    data[8] = buildHex(0x40, 0x40, 0x40, 0x40);
1497
1
    palette.replaceAColorDefault(&data[0], 9);
1498



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



4
    REQUIRE(data[9] == buildHex(0x10, 0x20, 0x30, 0xff));
1534
1
}
1535
1536
3
TEST_CASE("Dye replaceAColor 1 1 sse2", "")
1537
{
1538
5
    DyePalette palette("#00ff0010,00001120", 8);
1539
    uint32_t data[1];
1540
1
    data[0] = buildHex(0x10, 0x03, 0x02, 0x01);
1541

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



4
    REQUIRE(data[0] == buildHex(0x10, 0x03, 0x02, 0x01));
1543
1
}
1544
1545
3
TEST_CASE("Dye replaceAColor 1 2 sse2", "")
1546
{
1547
5
    DyePalette palette("#02ff0120,040311ff", 8);
1548
    uint32_t data[1];
1549
1
    data[0] = buildHex(0x02, 0xff, 0x01, 0x20);
1550

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



4
    REQUIRE(data[0] == buildHex(0x04, 0x03, 0x11, 0xff));
1552
1
}
1553
1554
3
TEST_CASE("Dye replaceAColor 1 3 sse2", "")
1555
{
1556
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1557
    uint32_t data[1];
1558
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1559

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



4
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1561
1
}
1562
1563
3
TEST_CASE("Dye replaceAColor 2 1 sse2", "")
1564
{
1565
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1566
    uint32_t data[2];
1567
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1568
1
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1569

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



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



4
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1572
1
}
1573
1574
3
TEST_CASE("Dye replaceAColor 3 1 sse2", "")
1575
{
1576
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1577
    uint32_t data[3];
1578
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1579
1
    data[1] = buildHex(0x50, 0x40, 0x40, 0x30);
1580
1
    data[2] = buildHex(0x40, 0x40, 0x40, 0x40);
1581

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



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



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



4
    REQUIRE(data[2] == buildHex(0x20, 0x00, 0x00, 0x00));
1585
1
}
1586
1587
3
TEST_CASE("Dye replaceAColor 4 1 sse2", "")
1588
{
1589
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1590
    uint32_t data[4];
1591
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1592
1
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1593
1
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1594
1
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1595

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



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



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



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



4
    REQUIRE(data[3] == buildHex(0x20, 0x00, 0x00, 0x00));
1600
1
}
1601
1602
3
TEST_CASE("Dye replaceAColor 5 1 sse2", "")
1603
{
1604
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1605
    uint32_t data[5];
1606
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1607
1
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1608
1
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1609
1
    data[3] = buildHex(0x50, 0x40, 0x40, 0x60);
1610
1
    data[4] = buildHex(0x40, 0x40, 0x40, 0x40);
1611

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



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



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



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



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



4
    REQUIRE(data[4] == buildHex(0x20, 0x00, 0x00, 0x00));
1617
1
}
1618
1619
3
TEST_CASE("Dye replaceAColor 7 1 sse2", "")
1620
{
1621
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1622
    uint32_t data[7];
1623
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1624
1
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1625
1
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1626
1
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1627
1
    data[4] = buildHex(0x01, 0x00, 0xee, 0x40);
1628
1
    data[5] = buildHex(0x40, 0x40, 0x41, 0x40);
1629
1
    data[6] = buildHex(0x01, 0x00, 0xee, 0x50);
1630

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



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



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



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



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



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



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



4
    REQUIRE(data[6] == buildHex(0x01, 0x00, 0xee, 0x50));
1638
1
}
1639
1640
3
TEST_CASE("Dye replaceAColor 8 1 sse2", "")
1641
{
1642
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1643
    uint32_t data[8];
1644
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1645
1
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1646
1
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1647
1
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1648
1
    data[4] = buildHex(0x01, 0x00, 0xee, 0x40);
1649
1
    data[5] = buildHex(0x40, 0x40, 0x41, 0x40);
1650
1
    data[6] = buildHex(0x01, 0x00, 0xee, 0x50);
1651
1
    data[7] = buildHex(0x40, 0x40, 0x40, 0x40);
1652

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



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



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



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



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



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



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



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



4
    REQUIRE(data[7] == buildHex(0x20, 0x00, 0x00, 0x00));
1661
1
}
1662
1663
3
TEST_CASE("Dye replaceAColor 9 1 sse2", "")
1664
{
1665
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1666
    uint32_t data[9];
1667
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1668
1
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1669
1
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1670
1
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1671
1
    data[4] = buildHex(0x01, 0x00, 0xee, 0x40);
1672
1
    data[5] = buildHex(0x40, 0x40, 0x41, 0x40);
1673
1
    data[6] = buildHex(0x01, 0x00, 0xee, 0x50);
1674
1
    data[7] = buildHex(0x02, 0x40, 0x40, 0x40);
1675
1
    data[8] = buildHex(0x40, 0x40, 0x40, 0x40);
1676

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



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



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



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



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



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



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



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



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



4
    REQUIRE(data[8] == buildHex(0x20, 0x00, 0x00, 0x00));
1686
1
}
1687
1688
3
TEST_CASE("Dye replaceAColor 10 1 sse2", "")
1689
{
1690
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1691
    uint32_t data[10];
1692
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1693
1
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1694
1
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1695
1
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1696
1
    data[4] = buildHex(0x01, 0x00, 0xee, 0x40);
1697
1
    data[5] = buildHex(0x40, 0x40, 0x41, 0x40);
1698
1
    data[6] = buildHex(0x01, 0x00, 0xee, 0x50);
1699
1
    data[7] = buildHex(0x02, 0x40, 0x40, 0x40);
1700
1
    data[8] = buildHex(0x40, 0x40, 0x40, 0x40);
1701
1
    data[9] = buildHex(0x01, 0x00, 0xee, 0x40);
1702

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



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



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



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



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



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



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



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



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



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



4
    REQUIRE(data[9] == buildHex(0x10, 0x20, 0x30, 0xff));
1713
1
}
1714
1715
3
TEST_CASE("Dye replaceAColor 1 1 avx2", "")
1716
{
1717
5
    DyePalette palette("#00ff0010,00001120", 8);
1718
    uint32_t data[1];
1719
1
    data[0] = buildHex(0x10, 0x03, 0x02, 0x01);
1720

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



4
    REQUIRE(data[0] == buildHex(0x10, 0x03, 0x02, 0x01));
1722
1
}
1723
1724
3
TEST_CASE("Dye replaceAColor 1 2 avx2", "")
1725
{
1726
5
    DyePalette palette("#02ff0120,040311ff", 8);
1727
    uint32_t data[1];
1728
1
    data[0] = buildHex(0x02, 0xff, 0x01, 0x20);
1729

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



4
    REQUIRE(data[0] == buildHex(0x04, 0x03, 0x11, 0xff));
1731
1
}
1732
1733
3
TEST_CASE("Dye replaceAColor 1 3 avx2", "")
1734
{
1735
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1736
    uint32_t data[1];
1737
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1738

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



4
    REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
1740
1
}
1741
1742
3
TEST_CASE("Dye replaceAColor 2 1 avx2", "")
1743
{
1744
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1745
    uint32_t data[2];
1746
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1747
1
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1748

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



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



4
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1751
1
}
1752
1753
3
TEST_CASE("Dye replaceAColor 3 1 avx2", "")
1754
{
1755
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1756
    uint32_t data[3];
1757
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1758
1
    data[1] = buildHex(0x50, 0x40, 0x40, 0x30);
1759
1
    data[2] = buildHex(0x40, 0x40, 0x40, 0x40);
1760

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



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



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



4
    REQUIRE(data[2] == buildHex(0x20, 0x00, 0x00, 0x00));
1764
1
}
1765
1766
3
TEST_CASE("Dye replaceAColor 4 1 avx2", "")
1767
{
1768
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1769
    uint32_t data[4];
1770
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1771
1
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1772
1
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1773
1
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1774

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



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



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



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



4
    REQUIRE(data[3] == buildHex(0x20, 0x00, 0x00, 0x00));
1779
1
}
1780
1781
3
TEST_CASE("Dye replaceAColor 5 1 avx2", "")
1782
{
1783
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1784
    uint32_t data[5];
1785
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1786
1
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1787
1
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1788
1
    data[3] = buildHex(0x50, 0x40, 0x40, 0x60);
1789
1
    data[4] = buildHex(0x40, 0x40, 0x40, 0x40);
1790

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



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



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



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



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



4
    REQUIRE(data[4] == buildHex(0x20, 0x00, 0x00, 0x00));
1796
1
}
1797
1798
3
TEST_CASE("Dye replaceAColor 7 1 avx2", "")
1799
{
1800
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1801
    uint32_t data[7];
1802
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1803
1
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1804
1
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1805
1
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1806
1
    data[4] = buildHex(0x01, 0x00, 0xee, 0x40);
1807
1
    data[5] = buildHex(0x40, 0x40, 0x41, 0x40);
1808
1
    data[6] = buildHex(0x01, 0x00, 0xee, 0x50);
1809

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



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



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



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



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



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




4
    REQUIRE(data[5] == buildHex(0x40, 0x40, 0x41, 0x40));
1816



4
    REQUIRE(data[6] == buildHex(0x01, 0x00, 0xee, 0x50));
1817
1
}
1818
1819
3
TEST_CASE("Dye replaceAColor 8 1 avx2", "")
1820
{
1821
5
    DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
1822
    uint32_t data[8];
1823
1
    data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
1824
1
    data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
1825
1
    data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
1826
1
    data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
1827
1
    data[4] = buildHex(0x01, 0x00, 0xee, 0x40);
1828
1
    data[5] = buildHex(0x40, 0x40, 0x41, 0x40);
1829
1
    data[6] = buildHex(0x01, 0x00, 0xee, 0x50);
1830
1
    data[7] = buildHex(0x40, 0x40, 0x40, 0x40);
1831

1
    DYEPALETTE(palette, AColorAvx2)(&data[0], 8);
1832



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



4
    REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
1834



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



4
    REQUIRE(data[3] == buildHex(0x20, 0x00, 0x00, 0x00));
1836



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



4
    REQUIRE(data[5] == buildHex(0x40, 0x40, 0x41, 0x40));
1838



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



&cr