changeset 12:ee302fe07296 trunk

[svn r16] * Updated all tests to have a main * Updated runalltests to both compile and run the tests
author lindquist
date Tue, 02 Oct 2007 05:27:44 +0200
parents d3ee9efe20e2
children 3d1d98329fa7
files runalltests.d test/arrayinit.d test/classes7.d test/structinit2.d
diffstat 4 files changed, 25 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/runalltests.d	Tue Oct 02 05:10:18 2007 +0200
+++ b/runalltests.d	Tue Oct 02 05:27:44 2007 +0200
@@ -6,28 +6,33 @@
 import std.stdio;
 
 int main(string[] args) {
-    string[] good;
     string[] bad;
+    string[] badrun;
 
     auto contents = listdir("test", "*.d");
     foreach(c; contents) {
-        if (system("./tester.sh "~getName(c)~" ll") != 0) {
+        auto cmd = "./tester.sh "~getName(c);
+        if (system(cmd~" ll") != 0) {
             bad ~= c;
         }
-        else {
-            good ~= c;
+        else if (system(cmd~" run") != 0) {
+            badrun ~= c;
         }
     }
 
     int ret = 0;
     if (bad.length > 0) {
-        writefln(bad.length, '/', contents.length, " tests failed:");
+        writefln(bad.length, '/', contents.length, " tests failed to compile:");
         foreach(b; bad) {
             writefln("  ",b);
         }
+        writefln(badrun.length, '/', contents.length, " tests failed to run:");
+        foreach(b; badrun) {
+            writefln("  ",b);
+        }
         ret = 1;
     }
 
-    writefln(good.length, '/', contents.length, " tests passed");
+    writefln(contents.length - bad.length - badrun.length, '/', contents.length, " tests passed");
     return ret;
 }
--- a/test/arrayinit.d	Tue Oct 02 05:10:18 2007 +0200
+++ b/test/arrayinit.d	Tue Oct 02 05:27:44 2007 +0200
@@ -3,3 +3,8 @@
 int[8] itable = [3:42,6:123];
 
 private uint[7] crc32_table = [0x00000000,0x77073096,0xee0e612c,0x990951ba,0x076dc419,0x706af48f,0xe963a535];
+
+void main()
+{
+    assert(crc32_table[3] == 0x990951ba);
+}
--- a/test/classes7.d	Tue Oct 02 05:10:18 2007 +0200
+++ b/test/classes7.d	Tue Oct 02 05:27:44 2007 +0200
@@ -17,5 +17,5 @@
 {
     scope c = new C;
     c.g();
-    assert(c.i == 43);
+    assert(c.i == 42);
 }
--- a/test/structinit2.d	Tue Oct 02 05:10:18 2007 +0200
+++ b/test/structinit2.d	Tue Oct 02 05:27:44 2007 +0200
@@ -6,3 +6,11 @@
     long l;
     float f;
 }
+
+void main()
+{
+    Imp i;
+    assert(i.i == 0);
+    assert(i.l == 0L);
+    assert(i.f !<>= 0.0f);
+}