int main(int argc, char **argv) { setbuf(stdout, NULL); /* so that it's in sync with stderr when redirected */ openlog("test_hncp_nio", LOG_CONS | LOG_PERROR, LOG_DAEMON); sput_start_testing(); sput_enter_suite("hncp_nio"); /* optional */ argc -= 1; argv += 1; maybe_run_test(hncp_init_no_hwaddr); maybe_run_test(hncp_init_iofail); maybe_run_test(hncp_ok_minimal); maybe_run_test(hncp_rejoin_works); maybe_run_test(hncp_ok); sput_leave_suite(); /* optional */ sput_finish_testing(); return sput_get_return_value(); }
int run_secure_session_test(){ sput_enter_suite("ThemisPP secure session test"); sput_run_test(secure_session_test, "secure_session_test", __FILE__); return 0; }
int main(void) { sput_start_testing(); sput_enter_suite("Lab 7, Exercise 1: intlist_construct()"); sput_run_test(test_intlist_construct); test_intlist_print(); sput_enter_suite("Lab 7, Exercise 3: intlist_append()"); sput_run_test(test_intlist_append); sput_enter_suite("Lab 7, Exercise 4: intlist_capacity()"); sput_run_test(test_intlist_capacity); sput_enter_suite("Lab 7, Exercise 5: intlist_size()"); sput_run_test(test_intlist_size); sput_enter_suite("Lab 7, Exercise 6: intlist_get()"); sput_run_test(test_intlist_get); sput_enter_suite("Lab 7, Exercise 7: intlist_set()"); sput_run_test(test_intlist_set); sput_enter_suite("Lab 7, Exercise 8: intlist_removeall()"); sput_run_test(test_intlist_removeall); sput_enter_suite("Lab 8, Exercise 1: intlist_index()"); sput_run_test(test_intlist_index); sput_enter_suite("Lab 8, Exercise 2: intlist_count()"); sput_run_test(test_intlist_count); sput_enter_suite("Lab 8, Exercise 3: intlist_contains()"); sput_run_test(test_intlist_contains); sput_enter_suite("Lab 8, Exercise 4: increase_capacity()"); sput_run_test(test_increase_capacity); sput_enter_suite("Lab 8, Exercise 5: modified intlist_append()"); sput_run_test(test_modified_intlist_append); sput_enter_suite("Lab 8, Exercise 6: intlist_delete()"); sput_run_test(test_intlist_delete); sput_finish_testing(); return sput_get_return_value(); }
static void dncp_io_basic_2() { hncp_s h1, h2; dncp_s d1, d2; bool r; struct in6_addr a; char *msg = "foo"; char *ifname = LOOPBACK_NAME; (void)uloop_init(); memset(&h1, 0, sizeof(h1)); memset(&h2, 0, sizeof(h2)); memset(&d1, 0, sizeof(d1)); memset(&d2, 0, sizeof(d2)); h1.udp_port = 62000; h2.udp_port = 62001; h1.dncp = &d1; h2.dncp = &d2; d1.ext = &h1.ext; d2.ext = &h2.ext; r = hncp_io_init(&h1); sput_fail_unless(r, "dncp_io_init h1"); r = hncp_io_init(&h2); sput_fail_unless(r, "dncp_io_init h2"); /* Send a packet to ourselves */ (void)inet_pton(AF_INET6, "::1", &a); struct sockaddr_in6 src = { .sin6_family = AF_INET6, .sin6_port = htons(h1.udp_port), .sin6_addr = a #ifdef __APPLE__ , .sin6_len = sizeof(struct sockaddr_in6) #endif /* __APPLE__ */ }; struct sockaddr_in6 dst = { .sin6_family = AF_INET6, .sin6_port = htons(h2.udp_port), .sin6_addr = a #ifdef __APPLE__ , .sin6_len = sizeof(struct sockaddr_in6) #endif /* __APPLE__ */ }; smock_push_int("dncp_poll_io_recvfrom", 3); smock_push_int("dncp_poll_io_recvfrom_src", &src); smock_push_int("dncp_poll_io_recvfrom_dst", &dst); smock_push_int("dncp_poll_io_recvfrom_buf", msg); smock_push_int("dncp_poll_io_recvfrom_ifname", ifname); h1.ext.cb.send(&h1.ext, dncp_find_ep_by_name(h1.dncp, "lo"), NULL, &dst, msg, strlen(msg)); pending_packets++; uloop_run(); hncp_io_uninit(&h1); hncp_io_uninit(&h2); } int main(int argc, char **argv) { setbuf(stdout, NULL); /* so that it's in sync with stderr when redirected */ openlog("test_hncp_io", LOG_CONS | LOG_PERROR, LOG_DAEMON); sput_start_testing(); sput_enter_suite("hncp_io"); /* optional */ argc -= 1; argv += 1; sput_maybe_run_test(dncp_io_basic_2, do {} while(0)); sput_leave_suite(); /* optional */ sput_finish_testing(); return sput_get_return_value(); }
int run_secure_comparator_test(){ sput_enter_suite("ThemisPP secure comparator test"); sput_run_test(secure_comparator_test, "secure_comparator_test", __FILE__); return 0; }