diff options
| author | J08nY | 2024-08-02 15:50:10 +0200 |
|---|---|---|
| committer | J08nY | 2024-08-02 15:50:10 +0200 |
| commit | 93ab84c656830261db6561b70794c7343a008ff4 (patch) | |
| tree | c2373e19c1515bbd7afd5e2f5fea631ed98a3de8 /common | |
| parent | 40c50615d1476b8347e6f6575c4f49911e3a55ff (diff) | |
| download | ECTester-93ab84c656830261db6561b70794c7343a008ff4.tar.gz ECTester-93ab84c656830261db6561b70794c7343a008ff4.tar.zst ECTester-93ab84c656830261db6561b70794c7343a008ff4.zip | |
Diffstat (limited to 'common')
| -rw-r--r-- | common/src/main/java/cz/crcs/ectester/common/test/CompoundTest.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/common/src/main/java/cz/crcs/ectester/common/test/CompoundTest.java b/common/src/main/java/cz/crcs/ectester/common/test/CompoundTest.java index ccb0f21..3681400 100644 --- a/common/src/main/java/cz/crcs/ectester/common/test/CompoundTest.java +++ b/common/src/main/java/cz/crcs/ectester/common/test/CompoundTest.java @@ -26,12 +26,25 @@ public class CompoundTest extends Test implements Cloneable { return new Result(Result.Value.SUCCESS, "All sub-tests had the expected result."); }; + public final static Function<Test[], Result> EXPECT_ALL_SUCCESS = tests -> EXPECT_ALL.apply(Result.ExpectedValue.SUCCESS, tests); + public final static Function<Test[], Result> EXPECT_ALL_FAILURE = tests -> EXPECT_ALL.apply(Result.ExpectedValue.FAILURE, tests); + public final static Function<Test[], Result> EXPECT_ALL_ANY = tests -> EXPECT_ALL.apply(Result.ExpectedValue.ANY, tests); + public final static Consumer<Test[]> RUN_ALL = tests -> { for (Test t : tests) { t.run(); } }; + public final static Consumer<Test[]> RUN_ALL_IF_FIRST = tests -> { + tests[0].run(); + if (tests[0].getResult().getValue().equals(Result.Value.SUCCESS)) { + for (int i = 1; i < tests.length; i++) { + tests[i].run(); + } + } + }; + public final static Consumer<Test[]> RUN_GREEDY_ALL = tests -> { for (Test t : tests) { t.run(); |
