diff --git a/tests/tests.cpp b/tests/tests.cpp index 4d9a758b..194c4c54 100644 --- a/tests/tests.cpp +++ b/tests/tests.cpp @@ -195,6 +195,17 @@ void test_voxel_data_map_copy() { ERR_FAIL_COND(!buffer->equals(**buffer2)); } +void test_encode_weights_packed_u16() { + FixedArray 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 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 -------------"); }