1 /* Copyright (c) 2007-2021, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
5 #include "core/or/or.h"
6 #include "trunnel/netinfo.h"
10 test_netinfo_unsupported_addr(void *arg
)
12 const uint8_t wire_data
[] =
14 0x00, 0x00, 0x00, 0x01,
18 0x08, 0x08, 0x08, 0x08, // AVAL
20 0x03, // ATYPE (unsupported)
22 'a', 'd', 'r', 'r', '!' // AVAL (unsupported)
27 netinfo_cell_t
*parsed_cell
= NULL
;
29 ssize_t parsed
= netinfo_cell_parse(&parsed_cell
, wire_data
,
32 tt_assert(parsed
== sizeof(wire_data
));
34 netinfo_addr_t
*addr
= netinfo_cell_get_my_addrs(parsed_cell
, 0);
37 tt_int_op(3, OP_EQ
, netinfo_addr_get_addr_type(addr
));
38 tt_int_op(5, OP_EQ
, netinfo_addr_get_len(addr
));
41 netinfo_cell_free(parsed_cell
);
44 struct testcase_t netinfo_tests
[] = {
45 { "unsupported_addr", test_netinfo_unsupported_addr
, 0, NULL
, NULL
},