From: Maria Matejka Date: Wed, 27 Nov 2024 11:01:58 +0000 (+0100) Subject: String tests: fixed too strict strcmp checks X-Git-Tag: v2.16~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=54499f8850fd5b3a25639dc06d5618ae98ac1537;p=thirdparty%2Fbird.git String tests: fixed too strict strcmp checks The strcmp function is not guaranteed to return -1 or +1 but any negative or positive value if the input strings are different. Fixed the false assumption which triggered a build bug on emulated arm64. --- diff --git a/lib/printf_test.c b/lib/printf_test.c index 88ecf05e2..996f34ae8 100644 --- a/lib/printf_test.c +++ b/lib/printf_test.c @@ -108,8 +108,8 @@ static int t_bstrcmp(void) { bt_assert(bstrcmp("aa", "aa") == 0); - bt_assert(bstrcmp("aa", "bb") == -1); - bt_assert(bstrcmp("bb", "aa") == 1); + bt_assert(bstrcmp("aa", "bb") < 0); + bt_assert(bstrcmp("bb", "aa") > 0); bt_assert(bstrcmp(NULL, NULL) == 0); bt_assert(bstrcmp(NULL, "bb") == -1); bt_assert(bstrcmp("bb", NULL) == 1);