MCPcopy Create free account
hub / github.com/ElementsProject/lightning / main

Function main

common/test/run-tlv_span.c:117–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115/* AUTOGENERATED MOCKS END */
116
117int main(int argc, char *argv[])
118{
119 u8 *wire;
120 size_t len, start;
121
122 common_setup(argv[0]);
123
124 wire = tal_hexdata(tmpctx, "0010b8538094dbd70d8a0f0439d8e64f766f022006226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f0801020a0b73696d706c6520746573741621035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d502006226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f582103aa144bcfb083a73e1f51416003083e63c6c68951c04733ab4d042d0cc2237f46f0408d43842db95b6377612674bb21e45ef4e1643289db27e32edb5c15422664b8ca7b052759729cafd7260634a6de053a292ca1859914a4b21e4b8e20e20d2f911b",
125 strlen("0010b8538094dbd70d8a0f0439d8e64f766f022006226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f0801020a0b73696d706c6520746573741621035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d502006226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f582103aa144bcfb083a73e1f51416003083e63c6c68951c04733ab4d042d0cc2237f46f0408d43842db95b6377612674bb21e45ef4e1643289db27e32edb5c15422664b8ca7b052759729cafd7260634a6de053a292ca1859914a4b21e4b8e20e20d2f911b"));
126 len = tlv_span(wire, 0, UINT64_MAX, &start);
127 assert(start == 0);
128 assert(len == tal_bytelen(wire));
129
130 len = tlv_span(wire, 1, UINT64_MAX, &start);
131 assert(start == strlen("0010b8538094dbd70d8a0f0439d8e64f766f") / 2);
132 assert(len == tal_bytelen(wire) - start);
133
134 len = tlv_span(wire, 0, 1, &start);
135 assert(start == 0);
136 assert(len == strlen("0010b8538094dbd70d8a0f0439d8e64f766f") / 2);
137 common_shutdown();
138 return 0;
139}

Callers

nothing calls this directly

Calls 5

common_setupFunction · 0.85
tal_hexdataFunction · 0.85
tlv_spanFunction · 0.85
tal_bytelenFunction · 0.85
common_shutdownFunction · 0.85

Tested by

no test coverage detected