From c4620be999234328e7aca7edccffdba8232071af Mon Sep 17 00:00:00 2001 From: Andrii Zymohliad <azymohliad@protonmail.com> Date: Mon, 12 Mar 2018 18:22:39 +0800 Subject: [PATCH] Prettify strpbrk and strstr tests --- tests/string/strpbrk.c | 15 +++++++-------- tests/string/strstr.c | 12 ++++++------ 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/tests/string/strpbrk.c b/tests/string/strpbrk.c index 40cae665b..dc0ebf7c5 100644 --- a/tests/string/strpbrk.c +++ b/tests/string/strpbrk.c @@ -2,20 +2,19 @@ #include <stdio.h> int main(int argc, char* argv[]) { - char* str = "The quick drawn fix jumps over the lazy bug"; + char* source = "The quick drawn fix jumps over the lazy bug"; // should be "The quick drawn fix jumps over the lazy bug" - char* str1 = strpbrk(str, "From The Very Beginning"); - printf("%s\n", (str1) ? str1 : "NULL"); + char* res1 = strpbrk(source, "From The Very Beginning"); + printf("%s\n", (res1) ? res1 : "NULL"); // should be "lazy bug" - char* str2 = strpbrk(str, "lzbg"); - printf("%s\n", (str2) ? str2 : "NULL"); - + char* res2 = strpbrk(source, "lzbg"); + printf("%s\n", (res2) ? res2 : "NULL"); // should be "NULL" - char* str3 = strpbrk(str, "404"); - printf("%s\n", (str3) ? str3 : "NULL"); + char* res3 = strpbrk(source, "404"); + printf("%s\n", (res3) ? res3 : "NULL"); return 0; } diff --git a/tests/string/strstr.c b/tests/string/strstr.c index 1f6796a2f..6a074d18d 100644 --- a/tests/string/strstr.c +++ b/tests/string/strstr.c @@ -3,16 +3,16 @@ int main(int argc, char* argv[]) { // should be "rust" - char* str1 = strstr("In relibc we trust", "rust"); - printf("%s\n", (str1) ? str1 : "NULL"); + char* res1 = strstr("In relibc we trust", "rust"); + printf("%s\n", (res1) ? res1 : "NULL"); // should be "libc we trust" - char* str2 = strstr("In relibc we trust", "libc"); - printf("%s\n", (str2) ? str2 : "NULL"); + char* res2 = strstr("In relibc we trust", "libc"); + printf("%s\n", (res2) ? res2 : "NULL"); // should be "NULL" - char* str3 = strstr("In relibc we trust", "bugs"); - printf("%s\n", (str3) ? str3 : "NULL"); + char* res3 = strstr("In relibc we trust", "bugs"); + printf("%s\n", (res3) ? res3 : "NULL"); return 0; } -- GitLab