/* SPDX-License-Identifier: MIT */ #include "../common/mbx_packets.h" #include #include #include int main(void) { const unsigned expected[19]={0x10000063,0x14202f80,0xe0000000,0x503,0, 0x40000000,0x300b0800,0,0,0x3f800000,0x7f00ff00, 0x42800000,0,0x3f800000,0x7f00ff00,0,0x42800000,0x3f800000,0x7f00ff00}; struct mbx_vertex vertices[3]={{0,0,0x3f800000,0xff00ff00}, {0x42800000,0,0x3f800000,0xff00ff00},{0,0x42800000,0x3f800000,0xff00ff00}}; unsigned words[21],before[21],bad[]={0x80000000,0x7f800000,0x7fc00000,0x42800001}; unsigned i; for(i=0;i<21;++i)words[i]=0xa5a5a5a5; assert(!mbx_encode_triangle(32,32,vertices,words+1,19)); assert(words[0]==0xa5a5a5a5&&words[20]==0xa5a5a5a5); assert(!memcmp(words+1,expected,sizeof(expected))); memcpy(before,words,sizeof(words)); for(i=0;i