Added test for encode_weights_packed_u16

master
Marc Gilleron 2021-05-23 20:28:25 +01:00
parent f943339f31
commit 5d72f1fa66
1 changed files with 12 additions and 0 deletions

View File

@ -195,6 +195,17 @@ void test_voxel_data_map_copy() {
ERR_FAIL_COND(!buffer->equals(**buffer2));
}
void test_encode_weights_packed_u16() {
FixedArray<uint8_t, 4> weights;
weights[0] = 1;
weights[1] = 5;
weights[2] = 10;
weights[3] = 15;
const uint16_t encoded_weights = encode_weights_to_packed_u16(weights[0], weights[1], weights[2], weights[3]);
FixedArray<uint8_t, 4> decoded_weights = decode_weights_from_packed_u16(encoded_weights);
ERR_FAIL_COND(weights != decoded_weights);
}
#define VOXEL_TEST(fname) \
print_line(String("Running {0}").format(varray(#fname))); \
fname()
@ -206,6 +217,7 @@ void run_voxel_tests() {
VOXEL_TEST(test_voxel_data_map_paste_fill);
VOXEL_TEST(test_voxel_data_map_paste_mask);
VOXEL_TEST(test_voxel_data_map_copy);
VOXEL_TEST(test_encode_weights_packed_u16);
print_line("------------ Voxel tests end -------------");
}