1 #include "incs.h" 2 3 /* 4 * basic header operation 5 */ 6 test00(void)7void test00(void) 8 { 9 RADIUS_PACKET *packet; 10 uint8_t code; 11 uint8_t id; 12 const uint8_t *pdata; 13 uint8_t authenticator[16]; 14 15 code = random(); 16 id = random(); 17 packet = radius_new_request_packet(code); 18 radius_set_id(packet, id); 19 pdata = (const uint8_t *)radius_get_data(packet); 20 CHECK(pdata[0] == code); 21 CHECK(radius_get_code(packet) == code); 22 CHECK(pdata[1] == id); 23 CHECK(radius_get_id(packet) == id); 24 CHECK(((pdata[2] << 8) | pdata[3]) == 20); 25 CHECK(radius_get_length(packet) == 20); 26 27 CHECK(radius_get_authenticator_retval(packet) == pdata + 4); 28 radius_get_authenticator(packet, authenticator); 29 CHECK(memcmp(authenticator, radius_get_authenticator_retval(packet), 16) == 0); 30 } 31 32 ADD_TEST(test00) 33