==> tests/golden.c <==1/* @ajax/mesh-abi-pipe-hash's functions against vectors the Rust computed (alpha-rust-mesh, the same inputs). */
2#include "mesh/abi/pipe_hash.h"
3#include "mesh/check.h"
4
5#include <stdint.h>
6
7int main(void) {
8 CHECK_U(mesh_pipe_type_hash((const uint8_t *)"", 0), 2166136261u);
9 CHECK_U(mesh_pipe_type_hash((const uint8_t *)"a", 1), 3826002220u);
10 CHECK_U(mesh_pipe_type_hash((const uint8_t *)"foobar", 6), 3214735720u);
11 CHECK_U(mesh_pipe_type_hash((const uint8_t *)"mesh_main", 9), 2705453452u);
12 CHECK_U(mesh_pipe_type_hash((const uint8_t *)"hello", 5), 1335831723u);
13 CHECK_U(mesh_pipe_type_hash((const uint8_t *)"pipehash", 8), 3480976965u);
14 CHECK_U(mesh_pipe_sum_part(260u, 2240916145u), 1885506305u);
15 CHECK_U(mesh_pipe_pos_mix(850755421u), 3856831683u);
16 CHECK_U(mesh_pipe_sum_part(101u, 2956447446u), 1371347838u);
17 CHECK_U(mesh_pipe_pos_mix(2400790841u), 2506353932u);
18 CHECK_U(mesh_pipe_sum_part(763u, 200257093u), 2816303525u);
19 CHECK_U(mesh_pipe_pos_mix(4197412298u), 1992078926u);
20 CHECK_U(mesh_pipe_sum_part(237u, 354514054u), 1204491966u);
21 CHECK_U(mesh_pipe_pos_mix(399354277u), 397683293u);
22 CHECK_U(mesh_pipe_sum_part(177u, 3052088790u), 3340191502u);
23 CHECK_U(mesh_pipe_pos_mix(2485334959u), 4110598773u);
24 CHECK_U(mesh_pipe_sum_part(504u, 1801784361u), 4224216313u);
25 CHECK_U(mesh_pipe_pos_mix(2353145917u), 2437209125u);
26 CHECK_U(mesh_pipe_sum_part(768u, 860290009u), 2618354137u);
27 CHECK_U(mesh_pipe_pos_mix(2778877043u), 3623851186u);
28 CHECK_U(mesh_pipe_sum_part(766u, 1394161097u), 3109594665u);
29 CHECK_U(mesh_pipe_pos_mix(881468996u), 1139295581u);
30 CHECK_U(mesh_pipe_sum_part(155u, 2799996801u), 4123493001u);
31 CHECK_U(mesh_pipe_pos_mix(2102018038u), 3100119361u);
32 CHECK_U(mesh_pipe_sum_part(440u, 3350047673u), 4057243497u);
33 CHECK_U(mesh_pipe_pos_mix(2669934340u), 2916796540u);
34 CHECK_U(mesh_pipe_sum_part(987u, 3259371886u), 2399853062u);
35 CHECK_U(mesh_pipe_pos_mix(4269120319u), 855057377u);
36 CHECK_U(mesh_pipe_sum_part(257u, 2284277392u), 1169934204u);
37 CHECK_U(mesh_pipe_pos_mix(4111462282u), 3162473780u);
38 CHECK_U(mesh_pipe_sum_part(162u, 2911194392u), 3270770516u);
39 CHECK_U(mesh_pipe_pos_mix(315483457u), 1219387017u);
40 CHECK_U(mesh_pipe_sum_part(385u, 3444898206u), 1704254070u);
41 CHECK_U(mesh_pipe_pos_mix(1598126977u), 2057941773u);
42 CHECK_U(mesh_pipe_sum_part(96u, 904366750u), 1087254238u);
43 CHECK_U(mesh_pipe_pos_mix(3822293555u), 3048888405u);
44 CHECK_U(mesh_pipe_sum_part(907u, 1456806103u), 3783369799u);
45 CHECK_U(mesh_pipe_pos_mix(837092486u), 402682790u);
46 CHECK_U(mesh_pipe_sum_part(160u, 99058793u), 97080233u);
47 CHECK_U(mesh_pipe_pos_mix(2129305969u), 3973271727u);
48 CHECK_U(mesh_pipe_sum_part(532u, 1082506416u), 2567158136u);
49 CHECK_U(mesh_pipe_pos_mix(917094424u), 1220874105u);
50 CHECK_U(mesh_pipe_sum_part(77u, 2852297750u), 3166661806u);
51 CHECK_U(mesh_pipe_pos_mix(1514476739u), 1877720478u);
52 CHECK_U(mesh_pipe_sum_part(922u, 1320572697u), 4055099593u);
53 CHECK_U(mesh_pipe_pos_mix(348044447u), 1843913059u);
54 CHECK_U(mesh_pipe_sum_part(105u, 3340568862u), 2414121366u);
55 CHECK_U(mesh_pipe_pos_mix(2613247964u), 3311477712u);
56 CHECK_U(mesh_pipe_sum_part(1047u, 326290132u), 3829334236u);
57 CHECK_U(mesh_pipe_pos_mix(3320879710u), 1424580346u);
58 CHECK_U(mesh_pipe_sum_part(162u, 152961506u), 4100050770u);
59 CHECK_U(mesh_pipe_pos_mix(218361049u), 64809804u);
60 CHECK_U(mesh_pipe_sum_part(257u, 2562013095u), 4011215963u);
61 CHECK_U(mesh_pipe_pos_mix(2706104069u), 3405754282u);
62 CHECK_U(mesh_pipe_rec_sum((const uint8_t[]){0}, 0), 0u);
63 CHECK_U(mesh_pipe_rec_sum_at((const uint8_t[]){0}, 0, 3294252724u), 2744559173u);
64 CHECK_U(mesh_pipe_rec_sum((const uint8_t[]){143}, 1), 0u);
65 CHECK_U(mesh_pipe_rec_sum_at((const uint8_t[]){143}, 1, 1887377581u), 1882226742u);
66 CHECK_U(mesh_pipe_rec_sum((const uint8_t[]){37,225,211}, 3), 0u);
67 CHECK_U(mesh_pipe_rec_sum_at((const uint8_t[]){37,225,211}, 3, 1512199674u), 2500198628u);
68 CHECK_U(mesh_pipe_rec_sum((const uint8_t[]){224,189,197,190}, 4), 3200630240u);
69 CHECK_U(mesh_pipe_rec_sum_at((const uint8_t[]){224,189,197,190}, 4, 2915532242u), 1447468841u);
70 CHECK_U(mesh_pipe_rec_sum((const uint8_t[]){156,195,23,106,119}, 5), 1779942300u);
71 CHECK_U(mesh_pipe_rec_sum_at((const uint8_t[]){156,195,23,106,119}, 5, 1536680816u), 759661680u);
72 CHECK_U(mesh_pipe_rec_sum((const uint8_t[]){253,184,20,208,76,218,235,231}, 8), 1034593501u);
73 CHECK_U(mesh_pipe_rec_sum_at((const uint8_t[]){253,184,20,208,76,218,235,231}, 8, 135224531u), 699290285u);
74 CHECK_U(mesh_pipe_rec_sum((const uint8_t[]){82,161,42,1,32,107,243,42,72,50,244,232,108,247,113,119}, 16), 123852598u);
75 CHECK_U(mesh_pipe_rec_sum_at((const uint8_t[]){82,161,42,1,32,107,243,42,72,50,244,232,108,247,113,119}, 16, 3173662836u), 3878321905u);
76 CHECK_U(mesh_pipe_rec_sum((const uint8_t[]){159,105,152,243,23,34,85,7,201,245,87,244,203,131,193,203,17,2,172,252,97,128,0,79,248,204,118,144,41,217,214,221,32,31,174,194,59,22,233,212,170,70,188,2,162,47,212,93,222,201,120,137,242,32,140,22,9,26,193,249,157,172,222}, 63), 3879361617u);
77 CHECK_U(mesh_pipe_rec_sum_at((const uint8_t[]){159,105,152,243,23,34,85,7,201,245,87,244,203,131,193,203,17,2,172,252,97,128,0,79,248,204,118,144,41,217,214,221,32,31,174,194,59,22,233,212,170,70,188,2,162,47,212,93,222,201,120,137,242,32,140,22,9,26,193,249,157,172,222}, 63, 1958212376u), 1223258155u);
78 CHECK_U(mesh_pipe_rec_sum((const uint8_t[]){251,194,182,167,123,63,108,178,80,70,241,250,46,69,219,96,234,245,88,129,51,1,58,124,16,36,28,218,73,86,126,68,181,25,164,242,126,217,186,201,219,253,137,97,14,84,24,181,246,144,26,34,183,116,160,220,47,168,185,5,212,22,198,7}, 64), 1859507050u);
79 CHECK_U(mesh_pipe_rec_sum_at((const uint8_t[]){251,194,182,167,123,63,108,178,80,70,241,250,46,69,219,96,234,245,88,129,51,1,58,124,16,36,28,218,73,86,126,68,181,25,164,242,126,217,186,201,219,253,137,97,14,84,24,181,246,144,26,34,183,116,160,220,47,168,185,5,212,22,198,7}, 64, 2998838092u), 4101720803u);
80 CHECK_U(mesh_pipe_rec_sum((const uint8_t[]){75,26,225,59,123,46,55,48,64,180,133,190,210,98,138,6,189,180,25,231,140,31,210,78,39,71,8,7,191,220,101,4,184,245,157,227,111,237,157,226,188,237,75,184,240,5,242,39,36,175,191,29,135,157,233,97,48,110,18,136,94,141,250,163,230,84,59,4,43,208,210,250,232,101,216,108,21,70,208,181,12,137,245,122,117,175,84,211,142,5,112,44,87,39,131,187,44,249,238,28}, 100), 465885403u);
81 CHECK_U(mesh_pipe_rec_sum_at((const uint8_t[]){75,26,225,59,123,46,55,48,64,180,133,190,210,98,138,6,189,180,25,231,140,31,210,78,39,71,8,7,191,220,101,4,184,245,157,227,111,237,157,226,188,237,75,184,240,5,242,39,36,175,191,29,135,157,233,97,48,110,18,136,94,141,250,163,230,84,59,4,43,208,210,250,232,101,216,108,21,70,208,181,12,137,245,122,117,175,84,211,142,5,112,44,87,39,131,187,44,249,238,28}, 100, 441493493u), 3880106164u);
82 CHECK_U(mesh_pipe_rec_sum((const uint8_t[]){179,140,68,69,157,32,194,92,136,158,197,233,223,146,191,10,152,216,62,10,114,170,53,28,96,60,90,237,212,160,119,31,240,135,134,43,181,136,115,174,178,243,147,99,52,136,171,89,117,127,35,77,135,31,66,252,193,179,155,210,186,212,220,236,148,29,157,172,173,84,100,158,68,247,117,17,45,161,157,103,174,247,255,212,126,197,168,34,188,235,45,117,80,151,228,116,63,30,32,50,9,121,13,137,146,66,57,97,184,157,83,80,19,146,213,36,109,241,12,135,28,142,119,237,231,214,110,120,108,152,113,225,100,106,206,110,193,247,200,44,137,114,199,231,1,246,170,250,188,29,149,238,141,153,57,138,32,13,230,46,222,124,104,11,253,9,215,225,67,71,189,73,16,45,235,109,213,70,229,75,72,248,52,39,57,204,18,142,217,8,121,106,127,58,185,232,111,91,212,131,48,237,212,115,250,229,146,228,62,35,252,84,55,2,120,84,113,214,173,184,86,173,112,35,58,35,30,153,97,143,118,252,85,57,141,149,198,63,196,50,188,115,212,197,54,42,189,215,186,117,227,184,13,248,41,197}, 256), 1609991894u);
83 CHECK_U(mesh_pipe_rec_sum_at((const uint8_t[]){179,140,68,69,157,32,194,92,136,158,197,233,223,146,191,10,152,216,62,10,114,170,53,28,96,60,90,237,212,160,119,31,240,135,134,43,181,136,115,174,178,243,147,99,52,136,171,89,117,127,35,77,135,31,66,252,193,179,155,210,186,212,220,236,148,29,157,172,173,84,100,158,68,247,117,17,45,161,157,103,174,247,255,212,126,197,168,34,188,235,45,117,80,151,228,116,63,30,32,50,9,121,13,137,146,66,57,97,184,157,83,80,19,146,213,36,109,241,12,135,28,142,119,237,231,214,110,120,108,152,113,225,100,106,206,110,193,247,200,44,137,114,199,231,1,246,170,250,188,29,149,238,141,153,57,138,32,13,230,46,222,124,104,11,253,9,215,225,67,71,189,73,16,45,235,109,213,70,229,75,72,248,52,39,57,204,18,142,217,8,121,106,127,58,185,232,111,91,212,131,48,237,212,115,250,229,146,228,62,35,252,84,55,2,120,84,113,214,173,184,86,173,112,35,58,35,30,153,97,143,118,252,85,57,141,149,198,63,196,50,188,115,212,197,54,42,189,215,186,117,227,184,13,248,41,197}, 256, 828566365u), 2402258072u);
84 return mesh_check_done();
85}