diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-09-03 19:03:48 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-09-10 23:51:52 +0900 |
| commit | 9a2fbf6f4854b1f2cfd5979b91d5b3d7e183d487 (patch) | |
| tree | 5fc0c3e0c3cd7159119d0560b5061b3545216f35 /tests/test_printf.sh | |
| parent | b447618c33683b947c1fb26f1e7cd9033e20e5cb (diff) | |
| download | ducc-9a2fbf6f4854b1f2cfd5979b91d5b3d7e183d487.tar.gz ducc-9a2fbf6f4854b1f2cfd5979b91d5b3d7e183d487.tar.zst ducc-9a2fbf6f4854b1f2cfd5979b91d5b3d7e183d487.zip | |
test: merge test scripts
Diffstat (limited to 'tests/test_printf.sh')
| -rw-r--r-- | tests/test_printf.sh | 220 |
1 files changed, 220 insertions, 0 deletions
diff --git a/tests/test_printf.sh b/tests/test_printf.sh new file mode 100644 index 0000000..da35fcb --- /dev/null +++ b/tests/test_printf.sh @@ -0,0 +1,220 @@ +touch expected +test_diff <<'EOF' +int printf(); + +int main() { + printf(""); + return 0; +} +EOF + +cat <<'EOF' > expected +Hello, World! +EOF +test_diff <<'EOF' +int printf(); + +int main() { + printf("Hello, World!\n"); + return 0; +} +EOF + +cat <<'EOF' > expected +"Hello, World!" +EOF +test_diff <<'EOF' +int printf(); + +int main() { + printf("\"Hello, World!\"\n"); + return 0; +} +EOF + +cat <<'EOF' > expected +1 +1 +1 +1 +1 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +4 +4 +4 +4 +4 +4 +4 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +EOF + +test_diff <<'EOF' +int printf(); + +int main() { + printf("%d\n", sizeof(char)); + printf("%d\n", sizeof(signed char)); + printf("%d\n", sizeof(char signed)); + printf("%d\n", sizeof(unsigned char)); + printf("%d\n", sizeof(char unsigned)); + + printf("%d\n", sizeof(short)); + printf("%d\n", sizeof(signed short)); + printf("%d\n", sizeof(short signed)); + printf("%d\n", sizeof(short int)); + printf("%d\n", sizeof(int short)); + printf("%d\n", sizeof(signed short int)); + printf("%d\n", sizeof(signed int short)); + printf("%d\n", sizeof(short signed int)); + printf("%d\n", sizeof(short int signed)); + printf("%d\n", sizeof(int short signed)); + printf("%d\n", sizeof(int signed short)); + + printf("%d\n", sizeof(unsigned short)); + printf("%d\n", sizeof(short unsigned)); + printf("%d\n", sizeof(unsigned short int)); + printf("%d\n", sizeof(unsigned int short)); + printf("%d\n", sizeof(short unsigned int)); + printf("%d\n", sizeof(short int unsigned)); + printf("%d\n", sizeof(int short unsigned)); + printf("%d\n", sizeof(int unsigned short)); + + printf("%d\n", sizeof(int)); + printf("%d\n", sizeof(signed)); + printf("%d\n", sizeof(signed int)); + printf("%d\n", sizeof(int signed)); + + printf("%d\n", sizeof(unsigned)); + printf("%d\n", sizeof(unsigned int)); + printf("%d\n", sizeof(int unsigned)); + + printf("%d\n", sizeof(long)); + printf("%d\n", sizeof(signed long)); + printf("%d\n", sizeof(long signed)); + printf("%d\n", sizeof(long int)); + printf("%d\n", sizeof(int long)); + printf("%d\n", sizeof(signed long int)); + printf("%d\n", sizeof(signed int long)); + printf("%d\n", sizeof(long signed int)); + printf("%d\n", sizeof(long int signed)); + printf("%d\n", sizeof(int long signed)); + printf("%d\n", sizeof(int signed long)); + + printf("%d\n", sizeof(unsigned long)); + printf("%d\n", sizeof(long unsigned)); + printf("%d\n", sizeof(unsigned long int)); + printf("%d\n", sizeof(unsigned int long)); + printf("%d\n", sizeof(long unsigned int)); + printf("%d\n", sizeof(long int unsigned)); + printf("%d\n", sizeof(int long unsigned)); + printf("%d\n", sizeof(int unsigned long)); + + printf("%d\n", sizeof(long long)); + printf("%d\n", sizeof(signed long long)); + printf("%d\n", sizeof(long signed long)); + printf("%d\n", sizeof(long long signed)); + printf("%d\n", sizeof(long long int)); + printf("%d\n", sizeof(long int long)); + printf("%d\n", sizeof(int long long)); + printf("%d\n", sizeof(signed long long int)); + printf("%d\n", sizeof(signed long int long)); + printf("%d\n", sizeof(signed int long long)); + printf("%d\n", sizeof(long signed long int)); + printf("%d\n", sizeof(long signed int long)); + printf("%d\n", sizeof(int signed long long)); + printf("%d\n", sizeof(long long signed int)); + printf("%d\n", sizeof(long int signed long)); + printf("%d\n", sizeof(int long signed long)); + printf("%d\n", sizeof(long long int signed)); + printf("%d\n", sizeof(long int long signed)); + printf("%d\n", sizeof(int long long signed)); + + printf("%d\n", sizeof(unsigned long long)); + printf("%d\n", sizeof(long unsigned long)); + printf("%d\n", sizeof(long long unsigned)); + printf("%d\n", sizeof(unsigned long long int)); + printf("%d\n", sizeof(unsigned long int long)); + printf("%d\n", sizeof(unsigned int long long)); + printf("%d\n", sizeof(long unsigned long int)); + printf("%d\n", sizeof(long unsigned int long)); + printf("%d\n", sizeof(int unsigned long long)); + printf("%d\n", sizeof(long long unsigned int)); + printf("%d\n", sizeof(long int unsigned long)); + printf("%d\n", sizeof(int long unsigned long)); + printf("%d\n", sizeof(long long int unsigned)); + printf("%d\n", sizeof(long int long unsigned)); + printf("%d\n", sizeof(int long long unsigned)); +} +EOF + |
