mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Merge pull request #641 from FullName/autotests_reduce
Reduce duplicate data. Add a mostly empty skeleton test.
This commit is contained in:
commit
af62804c94
|
@ -4,15 +4,12 @@ TESTS = messenger_autotest crypto_test network_test
|
||||||
|
|
||||||
check_PROGRAMS = messenger_autotest crypto_test network_test
|
check_PROGRAMS = messenger_autotest crypto_test network_test
|
||||||
|
|
||||||
messenger_autotest_SOURCES = \
|
AUTOTEST_CFLAGS = \
|
||||||
../auto_tests/messenger_test.c
|
$(LIBSODIUM_CFLAGS) \
|
||||||
|
$(NACL_CFLAGS) \
|
||||||
messenger_autotest_CFLAGS = \
|
$(CHECK_CFLAGS)
|
||||||
$(LIBSODIUM_CFLAGS) \
|
|
||||||
$(NACL_CFLAGS) \
|
AUTOTEST_LDADD = \
|
||||||
$(CHECK_CFLAGS)
|
|
||||||
|
|
||||||
messenger_autotest_LDADD = \
|
|
||||||
$(LIBSODIUM_LDFLAGS) \
|
$(LIBSODIUM_LDFLAGS) \
|
||||||
$(NACL_LDFLAGS) \
|
$(NACL_LDFLAGS) \
|
||||||
libtoxcore.la \
|
libtoxcore.la \
|
||||||
|
@ -20,35 +17,26 @@ messenger_autotest_LDADD = \
|
||||||
$(NACL_LIBS) \
|
$(NACL_LIBS) \
|
||||||
$(CHECK_LIBS)
|
$(CHECK_LIBS)
|
||||||
|
|
||||||
|
messenger_autotest_SOURCES = ../auto_tests/messenger_test.c
|
||||||
|
|
||||||
|
messenger_autotest_CFLAGS = $(AUTOTEST_CFLAGS)
|
||||||
|
|
||||||
|
messenger_autotest_LDADD = $(AUTOTEST_LDADD)
|
||||||
|
|
||||||
|
|
||||||
crypto_test_SOURCES = ../auto_tests/crypto_test.c
|
crypto_test_SOURCES = ../auto_tests/crypto_test.c
|
||||||
|
|
||||||
crypto_test_CFLAGS = $(LIBSODIUM_CFLAGS) \
|
crypto_test_CFLAGS = $(AUTOTEST_CFLAGS)
|
||||||
$(NACL_CFLAGS) \
|
|
||||||
$(CHECK_CFLAGS)
|
|
||||||
|
|
||||||
crypto_test_LDADD = $(LIBSODIUM_LDFLAGS) \
|
crypto_test_LDADD = $(AUTOTEST_LDADD)
|
||||||
$(NACL_LDFLAGS) \
|
|
||||||
libtoxcore.la \
|
|
||||||
$(LIBSODIUM_LIBS) \
|
|
||||||
$(NACL_LIBS) \
|
|
||||||
$(CHECK_LIBS)
|
|
||||||
|
|
||||||
network_test_SOURCES = \
|
|
||||||
../auto_tests/network_test.c
|
|
||||||
|
|
||||||
network_test_CFLAGS = \
|
network_test_SOURCES = ../auto_tests/network_test.c
|
||||||
$(LIBSODIUM_CFLAGS) \
|
|
||||||
$(NACL_CFLAGS) \
|
network_test_CFLAGS = $(AUTOTEST_CFLAGS)
|
||||||
$(CHECK_CFLAGS)
|
|
||||||
|
network_test_LDADD = $(AUTOTEST_LDADD)
|
||||||
|
|
||||||
network_test_LDADD = \
|
|
||||||
$(LIBSODIUM_LDFLAGS) \
|
|
||||||
$(NACL_LDFLAGS) \
|
|
||||||
libtoxcore.la \
|
|
||||||
$(LIBSODIUM_LIBS) \
|
|
||||||
$(NACL_LIBS) \
|
|
||||||
$(CHECK_LIBS)
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
53
auto_tests/skeleton_test.c
Normal file
53
auto_tests/skeleton_test.c
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <check.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include "../<stuff to test>"
|
||||||
|
*/
|
||||||
|
|
||||||
|
START_TEST(test_creativetestnamegoeshere)
|
||||||
|
{
|
||||||
|
uint8_t test = 0;
|
||||||
|
ck_assert_msg(test == 0, "test: expected result 0, got %u.", test);
|
||||||
|
}
|
||||||
|
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");
|
||||||
|
|
||||||
|
DEFTESTCASE(/* remove test_ from test function names */ creativetestnamegoeshere);
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
srand((unsigned int) time(NULL));
|
||||||
|
|
||||||
|
Suite *creativesuitenamegoeshere = creativesuitenamegoeshere_suite();
|
||||||
|
SRunner *test_runner = srunner_create(creativesuitenamegoeshere);
|
||||||
|
|
||||||
|
int number_failed = 0;
|
||||||
|
srunner_run_all(test_runner, CK_NORMAL);
|
||||||
|
number_failed = srunner_ntests_failed(test_runner);
|
||||||
|
|
||||||
|
srunner_free(test_runner);
|
||||||
|
|
||||||
|
return number_failed;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user