ATF_TC_BODY(dl_print, tc) { char buf[LINK_ADDRSTRLEN]; int r; size_t l = sizeof(buf); for (size_t i = 0; i < __arraycount(tst); i++) { r = dl_print(buf, l, &tst[i].ia); ATF_REQUIRE_STREQ(buf, tst[i].str); ATF_REQUIRE_EQ(r, tst[i].len); } l = 4; for (size_t i = 0; i < __arraycount(tst); i++) { r = dl_print(buf, l, &tst[i].ia); ATF_CHECK(strncmp(buf, tst[i].str, l - 1) == 0); if (r > (int)l) ATF_REQUIRE_EQ(buf[l - 1], '\0'); ATF_REQUIRE_EQ(r, tst[i].len); } }
void dl_println(List list) { assert_argument_not_null(list); dl_assert_element_size(list); dl_print(list); printf("\n"); }