logo

system-testsuite

Unix system testsuite (highlights broken bits in GNU and BusyBox)
commit: 30fdba8706f379c76435f5be3fe30079523059f4
parent 8f91c206fa921852c677fdb694e32bb5efd6a6fb
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Wed,  9 Feb 2022 20:49:28 +0100

abs: New test

Diffstat:

MKyuafile1+
MMakefile2+-
Aabs.c21+++++++++++++++++++++
3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/Kyuafile b/Kyuafile @@ -5,6 +5,7 @@ syntax(2) test_suite("system-testsuite") -- /BEGIN/,$ | LC_ALL=C.UTF-8 sort +atf_test_program{name="abs"} atf_test_program{name="true"} atf_test_program{name="false"} atf_test_program{name="sed"} diff --git a/Makefile b/Makefile @@ -1,5 +1,5 @@ LIBS = -latf-c -BINS = puts +BINS = puts abs all: $(BINS) diff --git a/abs.c b/abs.c @@ -0,0 +1,21 @@ +#include <atf-c.h> // ATF*, atf* +#include <limits.h> // INT_MIN +#include <stdlib.h> // abs + +ATF_TC(abs_int_min); +ATF_TC_HEAD(abs_int_min, tc) +{ + atf_tc_set_md_var(tc, "descr", "abs(3) returning negative value for INT_MIN"); +} +ATF_TC_BODY(abs_int_min, tc) +{ + ATF_CHECK(INT_MIN != abs(INT_MIN)); + ATF_CHECK(abs(INT_MIN) >= 0); +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, abs_int_min); + + return atf_no_error(); +}