tests,cpu-tests,string: test the return value of strcmp() according to the manual

This commit is contained in:
Zihao Yu 2020-12-19 13:24:48 +08:00
parent 1d1ff1431d
commit 242c1f1f53

View file

@ -14,10 +14,10 @@ char str[20];
int main() { int main() {
check(strcmp(s[0], s[2]) == 0); check(strcmp(s[0], s[2]) == 0);
check(strcmp(s[0], s[1]) == -1); check(strcmp(s[0], s[1]) < 0);
check(strcmp(s[0] + 1, s[1] + 1) == -1); check(strcmp(s[0] + 1, s[1] + 1) < 0);
check(strcmp(s[0] + 2, s[1] + 2) == -1); check(strcmp(s[0] + 2, s[1] + 2) < 0);
check(strcmp(s[0] + 3, s[1] + 3) == -1); check(strcmp(s[0] + 3, s[1] + 3) < 0);
check(strcmp( strcat(strcpy(str, str1), s[3]), s[4]) == 0); check(strcmp( strcat(strcpy(str, str1), s[3]), s[4]) == 0);