aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/003.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/003.sh')
-rw-r--r--tests/003.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/003.sh b/tests/003.sh
new file mode 100644
index 0000000..e99b7e1
--- /dev/null
+++ b/tests/003.sh
@@ -0,0 +1,21 @@
+cat <<'EOF' > main.c
+int main() {
+ return 2*3+4*5;
+}
+EOF
+
+"$p4dcc" < main.c > main.s
+if [[ $? -ne 0 ]]; then
+ cat main.s >&2
+ exit 1
+fi
+gcc -o a.out main.s
+./a.out
+exit_code=$?
+
+expected=26
+
+if [[ ! $exit_code -eq $expected ]]; then
+ echo "expected $expected, but $exit_code" >&2
+ exit 1
+fi