From 9a2fbf6f4854b1f2cfd5979b91d5b3d7e183d487 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 3 Sep 2025 19:03:48 +0900 Subject: test: merge test scripts --- tests/test_string_operations.sh | 57 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 tests/test_string_operations.sh (limited to 'tests/test_string_operations.sh') diff --git a/tests/test_string_operations.sh b/tests/test_string_operations.sh new file mode 100644 index 0000000..0c9a07e --- /dev/null +++ b/tests/test_string_operations.sh @@ -0,0 +1,57 @@ +touch expected +test_diff <<'EOF' +int main() { + ""; + return 0; +} +EOF + +touch expected +test_diff <<'EOF' +int main() { + "abc"; + return 0; +} +EOF + +touch expected +test_diff <<'EOF' +int main() { + "\"foo\"bar\\\n\""; + return 0; +} +EOF + +cat <<'EOF' > expected +h +l +, +EOF + +test_diff <<'EOF' +int printf(); + +int main() { + char* h = " hello,world" + 1; + printf("%c\n", *h); + printf("%c\n", h[2]); + printf("%c\n", *(h + 5)); +} +EOF + +cat <<'EOF' > expected +105 +0 +EOF + +test_diff <<'EOF' +int printf(); + +int main() { + char* s = "hi"; + while (*s++) { + printf("%d\n", *s); + } +} +EOF + -- cgit v1.2.3-70-g09d2