[hackers] [scc] Add first test program || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Thu, 13 Aug 2015 20:02:11 +0200 (CEST)

commit 49ea14f17cb76c7112691a4ed951315f3d105c63
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Thu Aug 13 19:59:58 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Thu Aug 13 19:59:58 2015 +0200

    Add first test program
    
    The first program of any compiler must be a Hello world!!!

diff --git a/cc1/tests/chktest.sh b/cc1/tests/chktest.sh
new file mode 100755
index 0000000..5ce264e
--- /dev/null
+++ b/cc1/tests/chktest.sh
_AT_@ -0,0 +1,25 @@
+#!/bin/sh
+
+out=/tmp/out
+chk=/tmp/chk
+
+#trap "rm -f $out $chk" EXIT INT QUIT
+
+for i in *.c
+do
+ rm -f $out $chk
+ awk '
+ /^name:/ {printf "Running %s ", $2}
+ /^output:$/ {copyon=1}
+ /^\*/ {copyon=0}
+ copyon==1 && !/^output:$/ {print $0 >> "'$chk'"}
+ ' $i
+
+ ../cc1 $i > $out 2>&1
+ if cmp $out $chk >/dev/null 2>&1
+ then
+ echo [OK]
+ else
+ echo [FAILED]
+ fi
+done
diff --git a/cc1/tests/test001.c b/cc1/tests/test001.c
new file mode 100644
index 0000000..ce17819
--- /dev/null
+++ b/cc1/tests/test001.c
_AT_@ -0,0 +1,23 @@
+/*
+name: TEST001
+description: Basic hello world test
+output:
+F3 P
+X1 F3 printf
+F1
+X2 F1 main
+G2 F1 main {
+-
+ X1 "68656C6C6F20776F726C640A aP pP cI
+ yI #I0
+}
+*/
+
+int printf(char *fmt);
+
+int
+main(void)
+{
+ printf("hello world\n");
+ return 0;
+}
Received on Thu Aug 13 2015 - 20:02:11 CEST

This archive was generated by hypermail 2.3.0 : Thu Aug 13 2015 - 20:12:32 CEST