aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/test_char_literals.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_char_literals.sh')
-rw-r--r--tests/test_char_literals.sh72
1 files changed, 19 insertions, 53 deletions
diff --git a/tests/test_char_literals.sh b/tests/test_char_literals.sh
index 3d1bff3..c883eba 100644
--- a/tests/test_char_literals.sh
+++ b/tests/test_char_literals.sh
@@ -1,59 +1,25 @@
-cat <<'EOF' > expected
-97 48
-92 39
-10
-EOF
-test_diff <<'EOF'
-int printf();
-
-int main() {
- printf("%d %d\n", 'a', '0');
- printf("%d %d\n", '\\', '\'');
- printf("%d\n", '\n');
- return 0;
-}
-EOF
-
-cat <<'EOF' > expected
-39
-34
-63
-92
-7
-8
-12
-10
-13
-9
-11
-EOF
-test_diff <<'EOF'
-int printf();
+test_exit_code 0 <<'EOF'
+#include "../../helpers.h"
int main() {
- printf("%d\n", '\'');
- printf("%d\n", '\"');
- printf("%d\n", '\?');
- printf("%d\n", '\\');
- printf("%d\n", '\a');
- printf("%d\n", '\b');
- printf("%d\n", '\f');
- printf("%d\n", '\n');
- printf("%d\n", '\r');
- printf("%d\n", '\t');
- printf("%d\n", '\v');
- return 0;
-}
-EOF
+ ASSERT_EQ(97, 'a');
+ ASSERT_EQ(48, '0');
+ ASSERT_EQ(92, '\\');
+ ASSERT_EQ(39, '\'');
+ ASSERT_EQ(10, '\n');
-cat <<'EOF' > expected
-0
-EOF
-test_diff <<'EOF'
-int printf();
+ ASSERT_EQ(39, '\'');
+ ASSERT_EQ(34, '\"');
+ ASSERT_EQ(63, '\?');
+ ASSERT_EQ(92, '\\');
+ ASSERT_EQ(7, '\a');
+ ASSERT_EQ(8, '\b');
+ ASSERT_EQ(12, '\f');
+ ASSERT_EQ(10, '\n');
+ ASSERT_EQ(13, '\r');
+ ASSERT_EQ(9, '\t');
+ ASSERT_EQ(11, '\v');
-int main() {
- printf("%d\n", '\0');
+ ASSERT_EQ(0, '\0');
}
EOF
-