nightmaremail

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 2bd54624f2c71c17b3b7ab5c955e3b17cdc9c53b
parent 3f6f81b6a15af234493af55c05948b73ef966126
Author: Rolf Eike Beer <eike@sf-mail.de>
Date:   Sun, 24 May 2020 12:24:06 +0200

tests: remove now useless tests again

All of these functions are gone now and replaced by libc ones.

This reverts commit 8654051c7e7d3bd67fea4362bb5781951622dc42.

Diffstat:
Mtests/.gitignore | 2--
Mtests/Makefile | 22+---------------------
Dtests/unittest_byte.c | 62--------------------------------------------------------------
Dtests/unittest_str.c | 98-------------------------------------------------------------------------------
4 files changed, 1 insertion(+), 183 deletions(-)

diff --git a/tests/.gitignore b/tests/.gitignore @@ -1,4 +1,2 @@ *.o -unittest_byte -unittest_str unittest_stralloc diff --git a/tests/Makefile b/tests/Makefile @@ -9,7 +9,7 @@ default: it .PHONY: clean default it test -TESTBINS = unittest_byte unittest_str unittest_stralloc +TESTBINS = unittest_stralloc clean: rm -f $(TESTBINS) *.o @@ -21,26 +21,6 @@ test: it ./$$tbin || exit 1 ; \ done -unittest_byte: \ -../load unittest_byte.o ../str.a - ../load unittest_byte ../str.a \ - `pkg-config --libs check` - -unittest_byte.o: \ -../compile unittest_byte.c ../byte.h - ../compile unittest_byte.c -I.. \ - `pkg-config --cflags check` - -unittest_str: \ -../load unittest_str.o ../str.a - ../load unittest_str ../str.a \ - `pkg-config --libs check` - -unittest_str.o: \ -../compile unittest_str.c ../str.h - ../compile unittest_str.c -I.. \ - `pkg-config --cflags check` - unittest_stralloc: \ ../load unittest_stralloc.o ../stralloc.a ../str.a ../error.a ../load unittest_stralloc ../stralloc.a ../str.a ../error.a \ diff --git a/tests/unittest_byte.c b/tests/unittest_byte.c @@ -1,62 +0,0 @@ -#include <check.h> - -#include "byte.h" - -START_TEST(test_byte_equal) -{ - ck_assert_int_ne(byte_equal("", 0, ""), 0); - ck_assert_int_ne(byte_equal("", 1, ""), 0); - - ck_assert_int_ne(byte_equal("", 0, "a"), 0); - ck_assert_int_eq(byte_equal("", 1, "a"), 0); - - ck_assert_int_ne(byte_equal("b", 0, "a"), 0); - ck_assert_int_eq(byte_equal("b", 1, "a"), 0); - - ck_assert_int_ne(byte_equal("b", 0, ""), 0); - ck_assert_int_eq(byte_equal("b", 1, ""), 0); - - ck_assert_int_ne(byte_equal("notqmail", 8, "notqmail"), 0); - ck_assert_int_ne(byte_equal("notqmail", 9, "notqmail"), 0); - ck_assert_int_ne(byte_equal("notqmail", 4, "notqmail"), 0); - - ck_assert_int_ne(byte_equal("netqmail", 1, "notqmail"), 0); - ck_assert_int_eq(byte_equal("netqmail", 8, "notqmail"), 0); - - ck_assert_int_ne(byte_equal("a\0b\0", 3, "a\0bc"), 0); - ck_assert_int_eq(byte_equal("a\0b\0", 4, "a\0bc"), 0); -} -END_TEST - -TCase -*str_something(void) -{ - TCase *tc = tcase_create("basic operations"); - - tcase_add_test(tc, test_byte_equal); - - return tc; -} - -Suite -*str_suite(void) -{ - Suite *s = suite_create("notqmail byte"); - - suite_add_tcase(s, str_something()); - - return s; -} - -int -main(void) -{ - int number_failed; - - SRunner *sr = srunner_create(str_suite()); - srunner_run_all(sr, CK_NORMAL); - number_failed = srunner_ntests_failed(sr); - srunner_free(sr); - - return number_failed; -} diff --git a/tests/unittest_str.c b/tests/unittest_str.c @@ -1,98 +0,0 @@ -#include <check.h> - -#include "str.h" - -START_TEST(test_str_len) -{ - ck_assert_uint_eq(str_len(""), 0); - ck_assert_uint_eq(str_len("notqmail"), 8); -} -END_TEST - -START_TEST(test_str_diff) -{ - ck_assert_int_eq(str_diff("", ""), 0); - - ck_assert_int_ne(str_diff("", "a"), 0); - - ck_assert_int_ne(str_diff("b", "a"), 0); - - ck_assert_int_ne(str_diff("b", ""), 0); - - ck_assert_int_eq(str_diff("notqmail", "notqmail"), 0); - - ck_assert_int_ne(str_diff("netqmail", "notqmail"), 0); -} -END_TEST - -START_TEST(test_str_diffn) -{ - ck_assert_int_eq(str_diffn("", "", 0), 0); - ck_assert_int_eq(str_diffn("", "", 1), 0); - - ck_assert_int_eq(str_diffn("", "a", 0), 0); - ck_assert_int_ne(str_diffn("", "a", 1), 0); - - ck_assert_int_eq(str_diffn("b", "a", 0), 0); - ck_assert_int_ne(str_diffn("b", "a", 1), 0); - - ck_assert_int_eq(str_diffn("b", "", 0), 0); - ck_assert_int_ne(str_diffn("b", "", 1), 0); - - ck_assert_int_eq(str_diffn("notqmail", "notqmail", 8), 0); - ck_assert_int_eq(str_diffn("notqmail", "notqmail", 4), 0); - - ck_assert_int_eq(str_diffn("netqmail", "notqmail", 1), 0); - ck_assert_int_ne(str_diffn("netqmail", "notqmail", 8), 0); -} -END_TEST - -START_TEST(test_str_cpy) -{ - char outbuf[32]; - - memset(outbuf, 'x', sizeof(outbuf)); - str_copy(outbuf, ""); - ck_assert_str_eq(outbuf, ""); - - memset(outbuf, 'x', sizeof(outbuf)); - str_copy(outbuf, "notqmail"); - ck_assert_str_eq(outbuf, "notqmail"); -} -END_TEST - -TCase -*str_something(void) -{ - TCase *tc = tcase_create("basic operations"); - - tcase_add_test(tc, test_str_len); - tcase_add_test(tc, test_str_diff); - tcase_add_test(tc, test_str_diffn); - tcase_add_test(tc, test_str_cpy); - - return tc; -} - -Suite -*str_suite(void) -{ - Suite *s = suite_create("notqmail str"); - - suite_add_tcase(s, str_something()); - - return s; -} - -int -main(void) -{ - int number_failed; - - SRunner *sr = srunner_create(str_suite()); - srunner_run_all(sr, CK_NORMAL); - number_failed = srunner_ntests_failed(sr); - srunner_free(sr); - - return number_failed; -}