void test_parse_args_aio_trace_fail(void) { const char *tracefile; // -T must be specified with -A argv[argc()] = "-T"; argv[argc()] = (char *) cut_take_strdup("tracefileXXXXXX"); argv[argc()] = dummy_file; cut_assert_not_equal_int(0, parse_args(argc(), argv, &option)); }
void test_llc_link_find_sap_by_uri(void) { struct llc_link *link; int res; link = llc_link_new(); cut_assert_not_null(link, cut_message("llc_link_new()")); struct llc_service *service = llc_service_new_with_uri(NULL, void_service, "urn:nfc:xsn:foo", NULL); res = llc_link_service_bind(link, service, -1); cut_assert_not_equal_int(-1, res, cut_message("llc_link_service_bind()")); uint8_t sap = llc_link_find_sap_by_uri(link, "urn:nfc:xsn:foo"); cut_assert_not_equal_int(0, sap, cut_message("llc_link_find_sap_by_uri()")); cut_assert_equal_int(res, sap, cut_message("Wrong SAP")); llc_link_service_unbind(link, service->sap); sap = llc_link_find_sap_by_uri(link, "urn:nfc:xsn:foo"); cut_assert_equal_int(0, sap, cut_message("llc_link_find_sap_by_uri()")); llc_service_free(service); llc_link_free(link); }
void test_llc_link_encode_parameters(void) { struct llc_link *link; link = llc_link_new(); cut_assert_not_null(link, cut_message("llc_link_new()")); uint8_t buffer[1024]; int res = llc_link_encode_parameters(link, buffer, sizeof(buffer)); cut_assert_not_equal_int(-1, res, cut_message("llc_link_encode_parameters()")); res = llc_link_configure(link, buffer, res); cut_assert_equal_int(0, res, cut_message("llc_link_configure()")); }
/** * test_server_sock() 関数テスト * * @return なし */ void test_server_sock(void) { dbglog("start"); if (set_port_string(port) < 0) cut_error("set_port_string"); ssock = server_sock(); dbglog("server_sock=%d", ssock); cut_assert_not_equal_int(EX_NG, ssock); csock = inet_sock_client(); if (csock < 0) cut_error("inet_sock_client"); }
void test_deck_shuffleDeck() { cut_assert_equal_int(DECK_NULL, deck_shuffleDeck(NULL)); struct Deck *deck = deck_createDeck(MAX_GAME_PLAYERS); struct Deck *shuffled_deck = malloc(sizeof(struct Deck)); memcpy(shuffled_deck, deck, sizeof(struct Deck)); cut_assert_equal_int(FUNCTIOON_NO_ERROR, deck_shuffleDeck(shuffled_deck)); int deckSize = deck_getDeckSize(deck); int differences = 0; for (int j = 0; j < 100; j++) { differences = 0; for (int i = 0; i < deckSize; i++) if (deck->cards[i]->suit != shuffled_deck->cards[i]->suit || deck->cards[i]->value != shuffled_deck->cards[i]->value) differences++; cut_assert_not_equal_int(0, differences); } deck_deleteDeck(&deck); }
void test_get_decoded_attachment_body (void) { const char *content; const char *expected; const char *body; unsigned int size = 0; unsigned int expected_size = 0; content = cut_get_fixture_data_string("attachment", NULL); cut_assert_not_null(content); expected = mz_test_utils_load_data("t.png", &expected_size); cut_assert_not_null(expected); body = mz_utils_get_decoded_attachment_body(content, "--=-u231oNe9VILCVd42q7nh", &size); cut_assert_not_null(body); cut_assert_not_equal_int(0, size); cut_assert_equal_memory(expected, expected_size, body, size); }
void test_get_attachment_body_place (void) { const char *content; const char *body; const char *expected_body; unsigned int size = 0; content = cut_get_fixture_data_string("attachment", NULL); cut_assert_not_null(content); expected_body = cut_get_fixture_data_string("attachment_body", NULL); cut_assert_not_null(expected_body); body = mz_utils_get_attachment_body_place(content, "--=-u231oNe9VILCVd42q7nh", &size); cut_assert_not_null(body); cut_assert_not_equal_int(0, size); cut_assert_equal_int(strlen(expected_body), size); cut_assert_equal_substring(expected_body, body, size); }
/* ---- test function bodies ---- */ void test_parse_args_noarg(void) { cut_assert_not_equal_int(0, parse_args(1, argv, &option)); }