From 875e8b54c907c60682567a6f900cbf99bedf55c5 Mon Sep 17 00:00:00 2001 From: rc_05 Date: Tue, 14 May 2024 01:07:07 +0200 Subject: First commit. --- examples/SimpleTests.hx | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 examples/SimpleTests.hx (limited to 'examples') diff --git a/examples/SimpleTests.hx b/examples/SimpleTests.hx new file mode 100644 index 0000000..de065e6 --- /dev/null +++ b/examples/SimpleTests.hx @@ -0,0 +1,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(); + } +} -- cgit v1.2.3