Skip to content

Commit 5cf7dda

Browse files
committed
js: Mirror decodeVertexV1Deltas test from native code
This test has the same data as the correponding test from demo/tests.cpp and expands testing coverage for 16-bit delta decoding that V1_Custom test was previously lacking.
1 parent 00760ff commit 5cf7dda

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

js/meshopt_decoder.test.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,25 @@ var tests = {
9999
assert.deepStrictEqual(result, expected);
100100
},
101101

102+
decodeVertexBufferV1_Deltas: function () {
103+
var encoded = new Uint8Array([
104+
0xa1, 0x99, 0x99, 0x01, 0x2a, 0xaa, 0xaa, 0xaa, 0x02, 0x04, 0x44, 0x44, 0x44, 0x43, 0x33, 0x33, 0x33, 0x02, 0x06, 0x66, 0x66, 0x66, 0x66,
105+
0x66, 0x66, 0x66, 0x02, 0x08, 0x88, 0x88, 0x88, 0x87, 0x77, 0x77, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
106+
0x00, 0x00, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0x01, 0x01,
107+
]);
108+
109+
var expected = new Uint16Array([
110+
248, 248, 240, 240, 249, 250, 243, 244, 250, 252, 246, 248, 251, 254, 249, 252, 252, 256, 252, 256, 253, 258, 255, 260, 254, 260, 258,
111+
264, 255, 262, 261, 268, 256, 264, 264, 272, 257, 262, 267, 268, 258, 260, 270, 264, 259, 258, 273, 260, 260, 256, 276, 256, 261, 254,
112+
279, 252, 262, 252, 282, 248, 263, 250, 285, 244,
113+
]);
114+
115+
var result = new Uint16Array(expected.length);
116+
decoder.decodeVertexBuffer(new Uint8Array(result.buffer), 16, 8, encoded);
117+
118+
assert.deepStrictEqual(result, expected);
119+
},
120+
102121
decodeIndexBuffer16: function () {
103122
var encoded = new Uint8Array([
104123
0xe0, 0xf0, 0x10, 0xfe, 0xff, 0xf0, 0x0c, 0xff, 0x02, 0x02, 0x02, 0x00, 0x76, 0x87, 0x56, 0x67, 0x78, 0xa9, 0x86, 0x65, 0x89, 0x68, 0x98,

0 commit comments

Comments
 (0)