diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-09-11 00:04:08 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-09-11 00:35:34 +0900 |
| commit | b3efe5b6c04e809ba0a67308994c91adfbd15eff (patch) | |
| tree | 5ac9bf1702a21e9a952bce90ee934dc3bd455a42 /tests/test_char_literals.sh | |
| parent | 9a2fbf6f4854b1f2cfd5979b91d5b3d7e183d487 (diff) | |
| download | ducc-b3efe5b6c04e809ba0a67308994c91adfbd15eff.tar.gz ducc-b3efe5b6c04e809ba0a67308994c91adfbd15eff.tar.zst ducc-b3efe5b6c04e809ba0a67308994c91adfbd15eff.zip | |
test: rewrite some tests in C language
Diffstat (limited to 'tests/test_char_literals.sh')
| -rw-r--r-- | tests/test_char_literals.sh | 72 |
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 - |
