1
|
1 module run.d;
|
|
2
|
|
3 import tango.io.Stdout,
|
|
4 tango.io.FilePath,
|
|
5 tango.sys.Process;
|
|
6
|
|
7
|
|
8 char[] prog = "./Dang";
|
|
9
|
|
10 void main(char[][] args)
|
|
11 {
|
|
12 auto cPath = FilePath("tests");
|
|
13
|
|
14 int succes, failure;
|
|
15
|
|
16 foreach( path ; cPath.toList((FilePath path, bool isFolder){return isFolder;}))
|
|
17 {
|
|
18 Stdout(path.name)(":").newline;
|
|
19 foreach( p ; path.toList((FilePath path, bool isFolder)
|
|
20 {
|
|
21 if(path.ext == "d" && path.name[0] != '.')
|
|
22 return true;
|
|
23 return false;
|
|
24 }))
|
|
25 {
|
|
26 auto test = new Test(p);
|
|
27 bool result = test.run();
|
|
28 if(result)
|
|
29 succes++;
|
|
30 else
|
|
31 failure++;
|
|
32 }
|
|
33 }
|
|
34
|
|
35 Stdout().newline.newline()
|
|
36 ("Result:").newline()
|
|
37 (" - Succes: ")(succes).newline()
|
|
38 (" - Failure: ")(failure).newline;
|
|
39 }
|
|
40
|
|
41 class Test
|
|
42 {
|
|
43 FilePath target;
|
|
44 public this(FilePath target)
|
|
45 {
|
|
46 this.target = target;
|
|
47 }
|
|
48
|
|
49 public bool run()
|
|
50 {
|
|
51 auto process = new Process(prog,target.path~target.file);
|
|
52
|
|
53 Stdout(" - ")(target.file)(".. ");
|
|
54
|
|
55 process.execute;
|
|
56
|
|
57 auto result = process.wait;
|
|
58 if(result.status == 0)
|
|
59 {
|
|
60 Stdout("SUCCES").newline;
|
|
61 return true;
|
|
62 }
|
|
63 else
|
|
64 {
|
|
65 Stdout("FAILURE").newline;
|
|
66 return false;
|
|
67 }
|
|
68 }
|
|
69 }
|