aboutsummaryrefslogtreecommitdiff
path: root/examples/SimpleTests.hx
blob: de065e66c29e558c6a3728eedc89d49e7250b9c7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import tester.Runner;
import tester.Test.Test;
import tester.Test.Outcome;

class Foo extends Test {
    override public function run():Outcome {
        if (3 < 2) {
            return Pass;
        } else {
            return Fail("Expected 1 < 2");
        }
    }
}

class Bar extends Test {
    override public function run():Outcome {
        if (false) {
            return Pass;
        } else {
            return Fail("Test is supposed to always pass.");
        }
    }
}

class SimpleTests {
    static function main() {
        var runner = new Runner();
        var tests = [
            new Foo("Foo"),
            new Bar("Bar")
        ];

        // Prepare the tests to be run.
        for (test in tests) {
            runner.addTest(test);
        }
        // Run the tests.
        runner.run();
    }
}