From fdefb18fc1e2a97cc1df9344283601e0ad614a1e Mon Sep 17 00:00:00 2001 From: "Coren[m]" Date: Wed, 6 Nov 2013 20:32:02 +0100 Subject: [PATCH] Reduce duplicate data. Add a mostly empty skeleton test. --- auto_tests/Makefile.inc | 50 ++++++++++++++--------------------- auto_tests/skeleton_test.c | 53 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 31 deletions(-) create mode 100644 auto_tests/skeleton_test.c diff --git a/auto_tests/Makefile.inc b/auto_tests/Makefile.inc index 6c59eebb..9c06bc78 100644 --- a/auto_tests/Makefile.inc +++ b/auto_tests/Makefile.inc @@ -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 diff --git a/auto_tests/skeleton_test.c b/auto_tests/skeleton_test.c new file mode 100644 index 00000000..89ef1b8b --- /dev/null +++ b/auto_tests/skeleton_test.c @@ -0,0 +1,53 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include + +/* +#include "../" +*/ + +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; +} +