diff options
Diffstat (limited to 'tests/test_string_operations.sh')
| -rw-r--r-- | tests/test_string_operations.sh | 57 |
1 files changed, 57 insertions, 0 deletions
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 + |
