Ejemplo n.º 1
0
int main(int argc, char *argv[])
{
    Suite *messenger = messenger_suite();
    SRunner *test_runner = srunner_create(messenger);
    int number_failed = 0;

    friend_id = hex_string_to_bin(friend_id_str);
    good_id_a = hex_string_to_bin(good_id_a_str);
    good_id_b = hex_string_to_bin(good_id_b_str);
    bad_id    = hex_string_to_bin(bad_id_str);

    /* setup a default friend and friendnum */
    if(m_addfriend_norequest((uint8_t *)friend_id) < 0)
        fputs("m_addfriend_norequest() failed on a valid ID!\n"
              "this was CRITICAL to the test, and the build WILL fail.\n"
              "the tests will continue now...\n\n", stderr);

    if((friend_id_num = getfriend_id((uint8_t *)friend_id)) < 0)
        fputs("getfriend_id() failed on a valid ID!\n"
              "this was CRITICAL to the test, and the build WILL fail.\n"
              "the tests will continue now...\n\n", stderr);

    srunner_run_all(test_runner, CK_NORMAL);
    number_failed = srunner_ntests_failed(test_runner);

    srunner_free(test_runner);
    free(friend_id);
    free(good_id_a);
    free(good_id_b);
    free(bad_id);

    return number_failed;
}
Ejemplo n.º 2
0
int main(int argc, char *argv[])
{
    Suite *messenger = messenger_suite();
    SRunner *test_runner = srunner_create(messenger);
    int number_failed = 0;

    friend_id = hex_string_to_bin(friend_id_str);
    good_id_a = hex_string_to_bin(good_id_a_str);
    good_id_b = hex_string_to_bin(good_id_b_str);
    bad_id    = hex_string_to_bin(bad_id_str);

    /* IPv6 status from global define */
    Messenger_Options options = {0};
    options.ipv6enabled = TOX_ENABLE_IPV6_DEFAULT;
    m = new_messenger(&options);

    /* setup a default friend and friendnum */
    if (m_addfriend_norequest(m, (uint8_t *)friend_id) < 0)
        fputs("m_addfriend_norequest() failed on a valid ID!\n"
              "this was CRITICAL to the test, and the build WILL fail.\n"
              "the tests will continue now...\n\n", stderr);

    if ((friend_id_num = getfriend_id(m, (uint8_t *)friend_id)) < 0)
        fputs("getfriend_id() failed on a valid ID!\n"
              "this was CRITICAL to the test, and the build WILL fail.\n"
              "the tests will continue now...\n\n", stderr);

    srunner_run_all(test_runner, CK_NORMAL);
    number_failed = srunner_ntests_failed(test_runner);

    srunner_free(test_runner);
    free(friend_id);
    free(good_id_a);
    free(good_id_b);
    free(bad_id);

    kill_messenger(m);

    return number_failed;
}