From 242c1f1f53a5c38268c68b0827e655296431358d Mon Sep 17 00:00:00 2001 From: Zihao Yu Date: Sat, 19 Dec 2020 13:24:48 +0800 Subject: [PATCH] tests,cpu-tests,string: test the return value of strcmp() according to the manual --- tests/cpu-tests/tests/string.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/cpu-tests/tests/string.c b/tests/cpu-tests/tests/string.c index 6170268..3a9200d 100644 --- a/tests/cpu-tests/tests/string.c +++ b/tests/cpu-tests/tests/string.c @@ -14,10 +14,10 @@ char str[20]; int main() { check(strcmp(s[0], s[2]) == 0); - check(strcmp(s[0], s[1]) == -1); - check(strcmp(s[0] + 1, s[1] + 1) == -1); - check(strcmp(s[0] + 2, s[1] + 2) == -1); - check(strcmp(s[0] + 3, s[1] + 3) == -1); + check(strcmp(s[0], s[1]) < 0); + check(strcmp(s[0] + 1, s[1] + 1) < 0); + check(strcmp(s[0] + 2, s[1] + 2) < 0); + check(strcmp(s[0] + 3, s[1] + 3) < 0); check(strcmp( strcat(strcpy(str, str1), s[3]), s[4]) == 0);