Remove DEFTESTCASE and DEFTESTCASE_SLOW redefinitions

This commit is contained in:
pyruvate 2014-08-07 23:59:47 +03:00
parent 545cc91662
commit ec9082f2c3
10 changed files with 34 additions and 65 deletions

View File

@ -14,6 +14,8 @@
#include "../toxcore/util.h"
#include "helpers.h"
#if defined(_WIN32) || defined(__WIN32__) || defined (WIN32)
#define c_sleep(x) Sleep(1*x)
#else
@ -489,14 +491,6 @@ START_TEST(test_client_invalid)
}
END_TEST
#define DEFTESTCASE(NAME) \
TCase *tc_##NAME = tcase_create(#NAME); \
tcase_add_test(tc_##NAME, test_##NAME); \
suite_add_tcase(s, tc_##NAME);
#define DEFTESTCASE_SLOW(NAME, TIMEOUT) \
DEFTESTCASE(NAME) \
tcase_set_timeout(tc_##NAME, TIMEOUT);
Suite *TCP_suite(void)
{
Suite *s = suite_create("TCP");

View File

@ -1,4 +1,3 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@ -14,6 +13,8 @@
#include <check.h>
#include "helpers.h"
START_TEST(test_basics)
{
/* TODO: real test */
@ -132,15 +133,6 @@ START_TEST(test_fillup)
}
END_TEST
#define DEFTESTCASE(NAME) \
TCase *tc_##NAME = tcase_create(#NAME); \
tcase_add_test(tc_##NAME, test_##NAME); \
suite_add_tcase(s, tc_##NAME);
#define DEFTESTCASE_SLOW(NAME, TIMEOUT) \
DEFTESTCASE(NAME) \
tcase_set_timeout(tc_##NAME, TIMEOUT);
Suite *Assoc_suite(void)
{
Suite *s = suite_create("Assoc");

View File

@ -10,6 +10,8 @@
#include <stdlib.h>
#include <time.h>
#include "helpers.h"
void rand_bytes(uint8_t *b, size_t blen)
{
size_t i;
@ -270,16 +272,6 @@ START_TEST(test_large_data_symmetric)
}
END_TEST
#define DEFTESTCASE(NAME) \
TCase *NAME = tcase_create(#NAME); \
tcase_add_test(NAME, test_##NAME); \
suite_add_tcase(s, NAME);
#define DEFTESTCASE_SLOW(NAME, TIMEOUT) \
DEFTESTCASE(NAME) \
tcase_set_timeout(NAME, TIMEOUT);
Suite *crypto_suite(void)
{
Suite *s = suite_create("Crypto");

15
auto_tests/helpers.h Normal file
View File

@ -0,0 +1,15 @@
#ifndef TOXCORE_TEST_HELPERS_H
#define TOXCORE_TEST_HELPERS_H
#include <check.h>
#define DEFTESTCASE(NAME) \
TCase *tc_##NAME = tcase_create(#NAME); \
tcase_add_test(tc_##NAME, test_##NAME); \
suite_add_tcase(s, tc_##NAME);
#define DEFTESTCASE_SLOW(NAME, TIMEOUT) \
DEFTESTCASE(NAME) \
tcase_set_timeout(tc_##NAME, TIMEOUT);
#endif // TOXCORE_TEST_HELPERS_H

View File

@ -21,6 +21,8 @@
#include <string.h>
#include <check.h>
#include "helpers.h"
#define REALLY_BIG_NUMBER ((1) << (sizeof(uint16_t) * 7))
#define STRINGS_EQUAL(X, Y) (strcmp(X, Y) == 0)
@ -298,11 +300,6 @@ START_TEST(test_messenger_state_saveloadsave)
}
END_TEST
#define DEFTESTCASE(NAME) \
TCase *tc_##NAME = tcase_create(#NAME); \
tcase_add_test(tc_##NAME, test_##NAME); \
suite_add_tcase(s, tc_##NAME);
Suite *messenger_suite(void)
{
Suite *s = suite_create("Messenger");

View File

@ -11,6 +11,8 @@
#include "../toxcore/network.h"
#include "helpers.h"
START_TEST(test_addr_resolv_localhost)
{
#ifdef __CYGWIN__
@ -141,11 +143,6 @@ START_TEST(test_struct_sizes)
}
END_TEST
#define DEFTESTCASE(NAME) \
TCase *tc_##NAME = tcase_create(#NAME); \
tcase_add_test(tc_##NAME, test_##NAME); \
suite_add_tcase(s, tc_##NAME);
Suite *network_suite(void)
{
Suite *s = suite_create("Network");

View File

@ -14,6 +14,8 @@
#include "../toxcore/onion_client.h"
#include "../toxcore/util.h"
#include "helpers.h"
#if defined(_WIN32) || defined(__WIN32__) || defined (WIN32)
#define c_sleep(x) Sleep(1*x)
#else
@ -335,14 +337,6 @@ START_TEST(test_announce)
}
END_TEST
#define DEFTESTCASE(NAME) \
TCase *tc_##NAME = tcase_create(#NAME); \
tcase_add_test(tc_##NAME, test_##NAME); \
suite_add_tcase(s, tc_##NAME);
#define DEFTESTCASE_SLOW(NAME, TIMEOUT) \
DEFTESTCASE(NAME) \
tcase_set_timeout(tc_##NAME, TIMEOUT);
Suite *onion_suite(void)
{
Suite *s = suite_create("Onion");

View File

@ -9,6 +9,8 @@
#include <stdlib.h>
#include <time.h>
#include "helpers.h"
/*
#include "../<stuff to test>"
*/
@ -20,12 +22,6 @@ START_TEST(test_creativetestnamegoeshere)
}
END_TEST
#define DEFTESTCASE(NAME) \
TCase *tc_##NAME = tcase_create(#NAME); \
tcase_add_test(tc_##NAME, test_##NAME); \
suite_add_tcase(s, tc_##NAME);
Suite *creativesuitenamegoeshere_suite(void)
{
Suite *s = suite_create("creativesuitedescritptiongoeshere");

View File

@ -12,6 +12,8 @@
#include "../toxcore/tox.h"
#include "helpers.h"
#if defined(_WIN32) || defined(__WIN32__) || defined (WIN32)
#define c_sleep(x) Sleep(1*x)
#else
@ -360,14 +362,6 @@ loop_top:
}
END_TEST
#define DEFTESTCASE(NAME) \
TCase *tc_##NAME = tcase_create(#NAME); \
tcase_add_test(tc_##NAME, test_##NAME); \
suite_add_tcase(s, tc_##NAME);
#define DEFTESTCASE_SLOW(NAME, TIMEOUT) \
DEFTESTCASE(NAME) \
tcase_set_timeout(tc_##NAME, TIMEOUT);
Suite *tox_suite(void)
{
Suite *s = suite_create("Tox");

View File

@ -16,6 +16,8 @@
#include "../toxcore/crypto_core.h"
#include "../toxav/toxav.h"
#include "helpers.h"
#if defined(_WIN32) || defined(__WIN32__) || defined (WIN32)
#define c_sleep(x) Sleep(1*x)
#else
@ -214,7 +216,6 @@ case 3: /* Wait for Both to have status ended */\
if (status_control.Alice.status == Ended && status_control.Bob.status == Ended) running = 0; break; } c_sleep(20); } } printf("\n");
START_TEST(test_AV_flows)
// int test_AV_flows()
{
long long unsigned int cur_time = time(NULL);
Tox *bootstrap_node = tox_new(0);
@ -574,10 +575,7 @@ Suite *tox_suite(void)
{
Suite *s = suite_create("ToxAV");
TCase *tc_av_flows = tcase_create("AV_flows");
tcase_add_test(tc_av_flows, test_AV_flows);
tcase_set_timeout(tc_av_flows, 200);
suite_add_tcase(s, tc_av_flows);
DEFTESTCASE_SLOW(AV_flows, 200);
return s;
}