master
Marc Gilleron 2021-05-24 23:14:23 +01:00
parent 0992da120a
commit fc0239afc8
1 changed files with 6 additions and 4 deletions

View File

@ -197,10 +197,12 @@ void test_voxel_data_map_copy() {
void test_encode_weights_packed_u16() {
FixedArray<uint8_t, 4> weights;
weights[0] = 1;
weights[1] = 5;
weights[2] = 10;
weights[3] = 15;
// There is data loss of the 4 smaller bits in this encoding,
// so to test this we may use values greater than 16
weights[0] = 1 << 4;
weights[1] = 5 << 4;
weights[2] = 10 << 4;
weights[3] = 15 << 4;
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);