Merge pull request #641 from FullName/autotests_reduce

Reduce duplicate data. Add a mostly empty skeleton test.
This commit is contained in:
irungentoo 2013-11-06 17:43:37 -08:00
commit af62804c94
2 changed files with 72 additions and 31 deletions

View File

@ -4,15 +4,12 @@ TESTS = messenger_autotest crypto_test network_test
check_PROGRAMS = messenger_autotest crypto_test network_test
messenger_autotest_SOURCES = \
../auto_tests/messenger_test.c
messenger_autotest_CFLAGS = \
$(LIBSODIUM_CFLAGS) \
$(NACL_CFLAGS) \
$(CHECK_CFLAGS)
messenger_autotest_LDADD = \
AUTOTEST_CFLAGS = \
$(LIBSODIUM_CFLAGS) \
$(NACL_CFLAGS) \
$(CHECK_CFLAGS)
AUTOTEST_LDADD = \
$(LIBSODIUM_LDFLAGS) \
$(NACL_LDFLAGS) \
libtoxcore.la \
@ -20,35 +17,26 @@ messenger_autotest_LDADD = \
$(NACL_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_CFLAGS = $(LIBSODIUM_CFLAGS) \
$(NACL_CFLAGS) \
$(CHECK_CFLAGS)
crypto_test_CFLAGS = $(AUTOTEST_CFLAGS)
crypto_test_LDADD = $(LIBSODIUM_LDFLAGS) \
$(NACL_LDFLAGS) \
libtoxcore.la \
$(LIBSODIUM_LIBS) \
$(NACL_LIBS) \
$(CHECK_LIBS)
crypto_test_LDADD = $(AUTOTEST_LDADD)
network_test_SOURCES = \
../auto_tests/network_test.c
network_test_CFLAGS = \
$(LIBSODIUM_CFLAGS) \
$(NACL_CFLAGS) \
$(CHECK_CFLAGS)
network_test_SOURCES = ../auto_tests/network_test.c
network_test_CFLAGS = $(AUTOTEST_CFLAGS)
network_test_LDADD = $(AUTOTEST_LDADD)
network_test_LDADD = \
$(LIBSODIUM_LDFLAGS) \
$(NACL_LDFLAGS) \
libtoxcore.la \
$(LIBSODIUM_LIBS) \
$(NACL_LIBS) \
$(CHECK_LIBS)
endif

View 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;
}