From 5d72f1fa66846d97a797c01d6535cc5d34d0b513 Mon Sep 17 00:00:00 2001 From: Marc Gilleron Date: Sun, 23 May 2021 20:28:25 +0100 Subject: [PATCH] Added test for encode_weights_packed_u16 --- tests/tests.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 -------------"); }