diff options
author | 2021-07-29 19:55:46 +0200 | |
---|---|---|
committer | 2021-07-29 19:55:46 +0200 | |
commit | 4c04a8c8e1aedbca02b3ba8fd484c26e8b6e2413 (patch) | |
tree | d69e8e5c9c7f621b3109c28939091d07982d91dc /model-data/src/test/java/org/eclipse/viatra/solver | |
parent | Add new data structure for backend (diff) | |
download | refinery-4c04a8c8e1aedbca02b3ba8fd484c26e8b6e2413.tar.gz refinery-4c04a8c8e1aedbca02b3ba8fd484c26e8b6e2413.tar.zst refinery-4c04a8c8e1aedbca02b3ba8fd484c26e8b6e2413.zip |
Data structure cleanup with Sonar
Diffstat (limited to 'model-data/src/test/java/org/eclipse/viatra/solver')
-rw-r--r-- | model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/CommitSmokeTest.java (renamed from model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/fast/CommitSmokeTest.java) | 32 | ||||
-rw-r--r-- | model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/DiffCursorSmokeTest.java (renamed from model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/fast/DiffCursorSmokeTest.java) | 18 | ||||
-rw-r--r-- | model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/MutableImmutableCompareSmokeTest.java (renamed from model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/fast/MutableImmutableCompareSmokeTest.java) | 34 | ||||
-rw-r--r-- | model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/MutableSmokeTest.java (renamed from model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/fast/MutableSmokeTest.java) | 19 | ||||
-rw-r--r-- | model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/RestoreSmokeTest.java (renamed from model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/fast/RestoreSmokeTest.java) | 42 | ||||
-rw-r--r-- | model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/slow/SlowSmokeTest.java | 77 | ||||
-rw-r--r-- | model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/utils/SmokeTestUtils.java (renamed from model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/utils/TestPermuter.java) | 19 | ||||
-rw-r--r-- | model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/utils/SmoteTestUtilsTest.java (renamed from model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/utils/TestPermuterTest.java) | 8 | ||||
-rw-r--r-- | model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/utils/MapTestEnvironment.java (renamed from model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/support/MapTestEnvironment.java) | 2 |
9 files changed, 121 insertions, 130 deletions
diff --git a/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/fast/CommitSmokeTest.java b/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/CommitSmokeTest.java index 5c340090..25ad81d2 100644 --- a/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/fast/CommitSmokeTest.java +++ b/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/CommitSmokeTest.java | |||
@@ -1,4 +1,4 @@ | |||
1 | package org.eclipse.viatra.solver.data.map.tests.smoke.fast; | 1 | package org.eclipse.viatra.solver.data.map.tests.smoke; |
2 | 2 | ||
3 | import static org.junit.jupiter.api.Assertions.fail; | 3 | import static org.junit.jupiter.api.Assertions.fail; |
4 | 4 | ||
@@ -9,15 +9,16 @@ import org.eclipse.viatra.solver.data.map.ContinousHashProvider; | |||
9 | import org.eclipse.viatra.solver.data.map.VersionedMapStore; | 9 | import org.eclipse.viatra.solver.data.map.VersionedMapStore; |
10 | import org.eclipse.viatra.solver.data.map.VersionedMapStoreImpl; | 10 | import org.eclipse.viatra.solver.data.map.VersionedMapStoreImpl; |
11 | import org.eclipse.viatra.solver.data.map.internal.VersionedMapImpl; | 11 | import org.eclipse.viatra.solver.data.map.internal.VersionedMapImpl; |
12 | import org.eclipse.viatra.solver.data.map.tests.smoke.utils.TestPermuter; | 12 | import org.eclipse.viatra.solver.data.map.tests.smoke.utils.SmokeTestUtils; |
13 | import org.eclipse.viatra.solver.data.map.tests.support.MapTestEnvironment; | 13 | import org.eclipse.viatra.solver.data.map.tests.utils.MapTestEnvironment; |
14 | import org.junit.jupiter.api.Tag; | ||
14 | import org.junit.jupiter.api.Timeout; | 15 | import org.junit.jupiter.api.Timeout; |
15 | import org.junit.jupiter.params.ParameterizedTest; | 16 | import org.junit.jupiter.params.ParameterizedTest; |
16 | import org.junit.jupiter.params.provider.Arguments; | 17 | import org.junit.jupiter.params.provider.Arguments; |
17 | import org.junit.jupiter.params.provider.MethodSource; | 18 | import org.junit.jupiter.params.provider.MethodSource; |
18 | 19 | ||
19 | public class CommitSmokeTest { | 20 | class CommitSmokeTest { |
20 | public void runSmokeTest(String scenario, int seed, int steps, int maxKey, int maxValue, int commitFrequency, | 21 | private void runSmokeTest(String scenario, int seed, int steps, int maxKey, int maxValue, int commitFrequency, |
21 | boolean evilHash) { | 22 | boolean evilHash) { |
22 | String[] values = MapTestEnvironment.prepareValues(maxValue); | 23 | String[] values = MapTestEnvironment.prepareValues(maxValue); |
23 | ContinousHashProvider<Integer> chp = MapTestEnvironment.prepareHashProvider(evilHash); | 24 | ContinousHashProvider<Integer> chp = MapTestEnvironment.prepareHashProvider(evilHash); |
@@ -65,15 +66,30 @@ public class CommitSmokeTest { | |||
65 | @ParameterizedTest(name = "Immutable Smoke {index}/{0} Steps={1} Keys={2} Values={3} commit frequency={4} seed={5} evil-hash={6}") | 66 | @ParameterizedTest(name = "Immutable Smoke {index}/{0} Steps={1} Keys={2} Values={3} commit frequency={4} seed={5} evil-hash={6}") |
66 | @MethodSource | 67 | @MethodSource |
67 | @Timeout(value = 10) | 68 | @Timeout(value = 10) |
68 | public void parametrizedSmoke(int tests, int steps, int noKeys, int noValues, int commitFrequency, int seed, | 69 | @Tag("smoke") |
70 | void parametrizedFastSmoke(int tests, int steps, int noKeys, int noValues, int commitFrequency, int seed, | ||
69 | boolean evilHash) { | 71 | boolean evilHash) { |
70 | runSmokeTest("SmokeCommitS" + steps + "K" + noKeys + "V" + noValues + "s" + seed, seed, steps, noKeys, noValues, | 72 | runSmokeTest("SmokeCommitS" + steps + "K" + noKeys + "V" + noValues + "s" + seed, seed, steps, noKeys, noValues, |
71 | commitFrequency, evilHash); | 73 | commitFrequency, evilHash); |
72 | } | 74 | } |
73 | 75 | ||
74 | public static Stream<Arguments> parametrizedSmoke() { | 76 | static Stream<Arguments> parametrizedFastSmoke() { |
75 | return TestPermuter.permutationWithSize(new Object[] { 1000 }, new Object[] { 3, 32, 32 * 32 }, | 77 | return SmokeTestUtils.permutationWithSize(new Object[] { 1000 }, new Object[] { 3, 32, 32 * 32 }, |
76 | new Object[] { 2, 3 }, new Object[] { 1, 10, 100 }, new Object[] { 1, 2, 3 }, | 78 | new Object[] { 2, 3 }, new Object[] { 1, 10, 100 }, new Object[] { 1, 2, 3 }, |
77 | new Object[] { false, true }); | 79 | new Object[] { false, true }); |
78 | } | 80 | } |
81 | |||
82 | @ParameterizedTest(name = "Immutable Smoke {index}/{0} Steps={1} Keys={2} Values={3} commit frequency={4} seed={5} evil-hash={6}") | ||
83 | @MethodSource | ||
84 | @Tag("smoke") | ||
85 | @Tag("slow") | ||
86 | void parametrizedSlowSmoke(int tests, int steps, int noKeys, int noValues, int commitFrequency, int seed, | ||
87 | boolean evilHash) { | ||
88 | runSmokeTest("SmokeCommitS" + steps + "K" + noKeys + "V" + noValues + "s" + seed, seed, steps, noKeys, noValues, | ||
89 | commitFrequency, evilHash); | ||
90 | } | ||
91 | |||
92 | static Stream<Arguments> parametrizedSlowSmoke() { | ||
93 | return SmokeTestUtils.changeStepCount(parametrizedFastSmoke(), 1); | ||
94 | } | ||
79 | } | 95 | } |
diff --git a/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/fast/DiffCursorSmokeTest.java b/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/DiffCursorSmokeTest.java index ef51d05e..c36fac47 100644 --- a/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/fast/DiffCursorSmokeTest.java +++ b/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/DiffCursorSmokeTest.java | |||
@@ -1,4 +1,4 @@ | |||
1 | package org.eclipse.viatra.solver.data.map.tests.smoke.fast; | 1 | package org.eclipse.viatra.solver.data.map.tests.smoke; |
2 | 2 | ||
3 | import static org.junit.jupiter.api.Assertions.fail; | 3 | import static org.junit.jupiter.api.Assertions.fail; |
4 | 4 | ||
@@ -10,15 +10,16 @@ import org.eclipse.viatra.solver.data.map.DiffCursor; | |||
10 | import org.eclipse.viatra.solver.data.map.VersionedMapStore; | 10 | import org.eclipse.viatra.solver.data.map.VersionedMapStore; |
11 | import org.eclipse.viatra.solver.data.map.VersionedMapStoreImpl; | 11 | import org.eclipse.viatra.solver.data.map.VersionedMapStoreImpl; |
12 | import org.eclipse.viatra.solver.data.map.internal.VersionedMapImpl; | 12 | import org.eclipse.viatra.solver.data.map.internal.VersionedMapImpl; |
13 | import org.eclipse.viatra.solver.data.map.tests.smoke.utils.TestPermuter; | 13 | import org.eclipse.viatra.solver.data.map.tests.smoke.utils.SmokeTestUtils; |
14 | import org.eclipse.viatra.solver.data.map.tests.support.MapTestEnvironment; | 14 | import org.eclipse.viatra.solver.data.map.tests.utils.MapTestEnvironment; |
15 | import org.junit.jupiter.api.Tag; | ||
15 | import org.junit.jupiter.api.Timeout; | 16 | import org.junit.jupiter.api.Timeout; |
16 | import org.junit.jupiter.params.ParameterizedTest; | 17 | import org.junit.jupiter.params.ParameterizedTest; |
17 | import org.junit.jupiter.params.provider.Arguments; | 18 | import org.junit.jupiter.params.provider.Arguments; |
18 | import org.junit.jupiter.params.provider.MethodSource; | 19 | import org.junit.jupiter.params.provider.MethodSource; |
19 | 20 | ||
20 | public class DiffCursorSmokeTest { | 21 | class DiffCursorSmokeTest { |
21 | public void runSmokeTest(String scenario, int seed, int steps, int maxKey, int maxValue, int commitFrequency, | 22 | private void runSmokeTest(String scenario, int seed, int steps, int maxKey, int maxValue, int commitFrequency, |
22 | boolean evilHash) { | 23 | boolean evilHash) { |
23 | String[] values = MapTestEnvironment.prepareValues(maxValue); | 24 | String[] values = MapTestEnvironment.prepareValues(maxValue); |
24 | ContinousHashProvider<Integer> chp = MapTestEnvironment.prepareHashProvider(evilHash); | 25 | ContinousHashProvider<Integer> chp = MapTestEnvironment.prepareHashProvider(evilHash); |
@@ -27,7 +28,7 @@ public class DiffCursorSmokeTest { | |||
27 | iterativeRandomPutsAndCommitsThenDiffcursor(scenario, store, steps, maxKey, values, seed, commitFrequency); | 28 | iterativeRandomPutsAndCommitsThenDiffcursor(scenario, store, steps, maxKey, values, seed, commitFrequency); |
28 | } | 29 | } |
29 | 30 | ||
30 | void iterativeRandomPutsAndCommitsThenDiffcursor(String scenario, VersionedMapStore<Integer, String> store, | 31 | private void iterativeRandomPutsAndCommitsThenDiffcursor(String scenario, VersionedMapStore<Integer, String> store, |
31 | int steps, int maxKey, String[] values, int seed, int commitFrequency) { | 32 | int steps, int maxKey, String[] values, int seed, int commitFrequency) { |
32 | // 1. build a map with versions | 33 | // 1. build a map with versions |
33 | Random r = new Random(seed); | 34 | Random r = new Random(seed); |
@@ -87,14 +88,15 @@ public class DiffCursorSmokeTest { | |||
87 | @ParameterizedTest(name = "Mutable-Immutable Compare Smoke {index}/{0} Steps={1} Keys={2} Values={3} commit frequency={4} seed={5} evil-hash={6}") | 88 | @ParameterizedTest(name = "Mutable-Immutable Compare Smoke {index}/{0} Steps={1} Keys={2} Values={3} commit frequency={4} seed={5} evil-hash={6}") |
88 | @MethodSource | 89 | @MethodSource |
89 | @Timeout(value = 10) | 90 | @Timeout(value = 10) |
91 | @Tag("smoke") | ||
90 | void parametrizedSmoke(int tests, int steps, int noKeys, int noValues, int commitFrequency, int seed, | 92 | void parametrizedSmoke(int tests, int steps, int noKeys, int noValues, int commitFrequency, int seed, |
91 | boolean evilHash) { | 93 | boolean evilHash) { |
92 | runSmokeTest("SmokeMutableImmutableCompareS" + steps + "K" + noKeys + "V" + noValues + "s" + seed, seed, steps, | 94 | runSmokeTest("SmokeMutableImmutableCompareS" + steps + "K" + noKeys + "V" + noValues + "s" + seed, seed, steps, |
93 | noKeys, noValues, commitFrequency, evilHash); | 95 | noKeys, noValues, commitFrequency, evilHash); |
94 | } | 96 | } |
95 | 97 | ||
96 | public static Stream<Arguments> parametrizedSmoke() { | 98 | static Stream<Arguments> parametrizedSmoke() { |
97 | return TestPermuter.permutationWithSize(new Object[] { 1000 }, new Object[] { 3, 32, 32 * 32 }, | 99 | return SmokeTestUtils.permutationWithSize(new Object[] { 1000 }, new Object[] { 3, 32, 32 * 32 }, |
98 | new Object[] { 2, 3 }, new Object[] { 1, 10, 100 }, new Object[] { 1, 2, 3 }, | 100 | new Object[] { 2, 3 }, new Object[] { 1, 10, 100 }, new Object[] { 1, 2, 3 }, |
99 | new Object[] { false, true }); | 101 | new Object[] { false, true }); |
100 | } | 102 | } |
diff --git a/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/fast/MutableImmutableCompareSmokeTest.java b/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/MutableImmutableCompareSmokeTest.java index ac5571b3..115b1fec 100644 --- a/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/fast/MutableImmutableCompareSmokeTest.java +++ b/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/MutableImmutableCompareSmokeTest.java | |||
@@ -1,4 +1,4 @@ | |||
1 | package org.eclipse.viatra.solver.data.map.tests.smoke.fast; | 1 | package org.eclipse.viatra.solver.data.map.tests.smoke; |
2 | 2 | ||
3 | import static org.junit.jupiter.api.Assertions.fail; | 3 | import static org.junit.jupiter.api.Assertions.fail; |
4 | 4 | ||
@@ -9,15 +9,16 @@ import org.eclipse.viatra.solver.data.map.ContinousHashProvider; | |||
9 | import org.eclipse.viatra.solver.data.map.VersionedMapStore; | 9 | import org.eclipse.viatra.solver.data.map.VersionedMapStore; |
10 | import org.eclipse.viatra.solver.data.map.VersionedMapStoreImpl; | 10 | import org.eclipse.viatra.solver.data.map.VersionedMapStoreImpl; |
11 | import org.eclipse.viatra.solver.data.map.internal.VersionedMapImpl; | 11 | import org.eclipse.viatra.solver.data.map.internal.VersionedMapImpl; |
12 | import org.eclipse.viatra.solver.data.map.tests.smoke.utils.TestPermuter; | 12 | import org.eclipse.viatra.solver.data.map.tests.smoke.utils.SmokeTestUtils; |
13 | import org.eclipse.viatra.solver.data.map.tests.support.MapTestEnvironment; | 13 | import org.eclipse.viatra.solver.data.map.tests.utils.MapTestEnvironment; |
14 | import org.junit.jupiter.api.Tag; | ||
14 | import org.junit.jupiter.api.Timeout; | 15 | import org.junit.jupiter.api.Timeout; |
15 | import org.junit.jupiter.params.ParameterizedTest; | 16 | import org.junit.jupiter.params.ParameterizedTest; |
16 | import org.junit.jupiter.params.provider.Arguments; | 17 | import org.junit.jupiter.params.provider.Arguments; |
17 | import org.junit.jupiter.params.provider.MethodSource; | 18 | import org.junit.jupiter.params.provider.MethodSource; |
18 | 19 | ||
19 | public class MutableImmutableCompareSmokeTest { | 20 | class MutableImmutableCompareSmokeTest { |
20 | public void runSmokeTest(String scenario, int seed, int steps, int maxKey, int maxValue, int commitFrequency, | 21 | private void runSmokeTest(String scenario, int seed, int steps, int maxKey, int maxValue, int commitFrequency, |
21 | boolean evilHash) { | 22 | boolean evilHash) { |
22 | String[] values = MapTestEnvironment.prepareValues(maxValue); | 23 | String[] values = MapTestEnvironment.prepareValues(maxValue); |
23 | ContinousHashProvider<Integer> chp = MapTestEnvironment.prepareHashProvider(evilHash); | 24 | ContinousHashProvider<Integer> chp = MapTestEnvironment.prepareHashProvider(evilHash); |
@@ -32,7 +33,7 @@ public class MutableImmutableCompareSmokeTest { | |||
32 | commitFrequency); | 33 | commitFrequency); |
33 | } | 34 | } |
34 | 35 | ||
35 | void iterativeRandomPutsAndCommitsAndCompare(String scenario, VersionedMapImpl<Integer, String> immutable, | 36 | private void iterativeRandomPutsAndCommitsAndCompare(String scenario, VersionedMapImpl<Integer, String> immutable, |
36 | VersionedMapImpl<Integer, String> mutable, int steps, int maxKey, String[] values, Random r, | 37 | VersionedMapImpl<Integer, String> mutable, int steps, int maxKey, String[] values, Random r, |
37 | int commitFrequency) { | 38 | int commitFrequency) { |
38 | for (int i = 0; i < steps; i++) { | 39 | for (int i = 0; i < steps; i++) { |
@@ -58,15 +59,30 @@ public class MutableImmutableCompareSmokeTest { | |||
58 | @ParameterizedTest(name = "Mutable-Immutable Compare Smoke {index}/{0} Steps={1} Keys={2} Values={3} commit frequency={4} seed={5} evil-hash={6}") | 59 | @ParameterizedTest(name = "Mutable-Immutable Compare Smoke {index}/{0} Steps={1} Keys={2} Values={3} commit frequency={4} seed={5} evil-hash={6}") |
59 | @MethodSource | 60 | @MethodSource |
60 | @Timeout(value = 10) | 61 | @Timeout(value = 10) |
61 | void parametrizedSmoke(int tests, int steps, int noKeys, int noValues, int commitFrequency, int seed, | 62 | @Tag("smoke") |
63 | void parametrizedFastSmoke(int tests, int steps, int noKeys, int noValues, int commitFrequency, int seed, | ||
62 | boolean evilHash) { | 64 | boolean evilHash) { |
63 | runSmokeTest("SmokeMutableImmutableCompareS" + steps + "K" + noKeys + "V" + noValues + "s" + seed, seed, steps, | 65 | runSmokeTest("SmokeMutableImmutableCompareS" + steps + "K" + noKeys + "V" + noValues + "s" + seed, seed, steps, |
64 | noKeys, noValues, commitFrequency, evilHash); | 66 | noKeys, noValues, commitFrequency, evilHash); |
65 | } | 67 | } |
66 | 68 | ||
67 | public static Stream<Arguments> parametrizedSmoke() { | 69 | static Stream<Arguments> parametrizedFastSmoke() { |
68 | return TestPermuter.permutationWithSize(new Object[] { 1000 }, new Object[] { 3, 32, 32 * 32 }, | 70 | return SmokeTestUtils.permutationWithSize(new Object[] { 1000 }, new Object[] { 3, 32, 32 * 32 }, |
69 | new Object[] { 2, 3 }, new Object[] { 1, 10, 100 }, new Object[] { 1, 2, 3 }, | 71 | new Object[] { 2, 3 }, new Object[] { 1, 10, 100 }, new Object[] { 1, 2, 3 }, |
70 | new Object[] { false, true }); | 72 | new Object[] { false, true }); |
71 | } | 73 | } |
74 | |||
75 | @ParameterizedTest(name = "Mutable-Immutable Compare Smoke {index}/{0} Steps={1} Keys={2} Values={3} commit frequency={4} seed={5} evil-hash={6}") | ||
76 | @MethodSource | ||
77 | @Tag("smoke") | ||
78 | @Tag("slow") | ||
79 | void parametrizedSlowSmoke(int tests, int steps, int noKeys, int noValues, int commitFrequency, int seed, | ||
80 | boolean evilHash) { | ||
81 | runSmokeTest("SmokeMutableImmutableCompareS" + steps + "K" + noKeys + "V" + noValues + "s" + seed, seed, steps, | ||
82 | noKeys, noValues, commitFrequency, evilHash); | ||
83 | } | ||
84 | |||
85 | static Stream<Arguments> parametrizedSlowSmoke() { | ||
86 | return SmokeTestUtils.changeStepCount(MutableImmutableCompareSmokeTest.parametrizedSlowSmoke(), 1); | ||
87 | } | ||
72 | } | 88 | } |
diff --git a/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/fast/MutableSmokeTest.java b/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/MutableSmokeTest.java index c24c220d..999325f0 100644 --- a/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/fast/MutableSmokeTest.java +++ b/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/MutableSmokeTest.java | |||
@@ -1,4 +1,4 @@ | |||
1 | package org.eclipse.viatra.solver.data.map.tests.smoke.fast; | 1 | package org.eclipse.viatra.solver.data.map.tests.smoke; |
2 | 2 | ||
3 | import static org.junit.jupiter.api.Assertions.fail; | 3 | import static org.junit.jupiter.api.Assertions.fail; |
4 | 4 | ||
@@ -9,16 +9,16 @@ import org.eclipse.viatra.solver.data.map.ContinousHashProvider; | |||
9 | import org.eclipse.viatra.solver.data.map.VersionedMapStore; | 9 | import org.eclipse.viatra.solver.data.map.VersionedMapStore; |
10 | import org.eclipse.viatra.solver.data.map.VersionedMapStoreImpl; | 10 | import org.eclipse.viatra.solver.data.map.VersionedMapStoreImpl; |
11 | import org.eclipse.viatra.solver.data.map.internal.VersionedMapImpl; | 11 | import org.eclipse.viatra.solver.data.map.internal.VersionedMapImpl; |
12 | import org.eclipse.viatra.solver.data.map.tests.smoke.utils.TestPermuter; | 12 | import org.eclipse.viatra.solver.data.map.tests.smoke.utils.SmokeTestUtils; |
13 | import org.eclipse.viatra.solver.data.map.tests.support.MapTestEnvironment; | 13 | import org.eclipse.viatra.solver.data.map.tests.utils.MapTestEnvironment; |
14 | import org.junit.jupiter.api.Tag; | ||
14 | import org.junit.jupiter.api.Timeout; | 15 | import org.junit.jupiter.api.Timeout; |
15 | import org.junit.jupiter.params.ParameterizedTest; | 16 | import org.junit.jupiter.params.ParameterizedTest; |
16 | import org.junit.jupiter.params.provider.Arguments; | 17 | import org.junit.jupiter.params.provider.Arguments; |
17 | import org.junit.jupiter.params.provider.MethodSource; | 18 | import org.junit.jupiter.params.provider.MethodSource; |
18 | 19 | ||
19 | public class MutableSmokeTest { | 20 | class MutableSmokeTest { |
20 | 21 | private void runSmokeTest(String scenario, int seed, int steps, int maxKey, int maxValue, boolean evilHash) { | |
21 | public void runSmokeTest(String scenario, int seed, int steps, int maxKey, int maxValue, boolean evilHash) { | ||
22 | String[] values = MapTestEnvironment.prepareValues(maxValue); | 22 | String[] values = MapTestEnvironment.prepareValues(maxValue); |
23 | ContinousHashProvider<Integer> chp = MapTestEnvironment.prepareHashProvider(evilHash); | 23 | ContinousHashProvider<Integer> chp = MapTestEnvironment.prepareHashProvider(evilHash); |
24 | 24 | ||
@@ -31,7 +31,7 @@ public class MutableSmokeTest { | |||
31 | iterativeRandomPuts(scenario, steps, maxKey, values, e, r); | 31 | iterativeRandomPuts(scenario, steps, maxKey, values, e, r); |
32 | } | 32 | } |
33 | 33 | ||
34 | void iterativeRandomPuts(String scenario, int steps, int maxKey, String[] values, | 34 | private void iterativeRandomPuts(String scenario, int steps, int maxKey, String[] values, |
35 | MapTestEnvironment<Integer, String> e, Random r) { | 35 | MapTestEnvironment<Integer, String> e, Random r) { |
36 | int stopAt = -1; | 36 | int stopAt = -1; |
37 | for (int i = 0; i < steps; i++) { | 37 | for (int i = 0; i < steps; i++) { |
@@ -62,14 +62,15 @@ public class MutableSmokeTest { | |||
62 | @ParameterizedTest(name = "Mutable Smoke {index}/{0} Steps={1} Keys={2} Values={3} seed={4} evil-hash={5}") | 62 | @ParameterizedTest(name = "Mutable Smoke {index}/{0} Steps={1} Keys={2} Values={3} seed={4} evil-hash={5}") |
63 | @MethodSource | 63 | @MethodSource |
64 | @Timeout(value = 10) | 64 | @Timeout(value = 10) |
65 | @Tag("smoke") | ||
65 | void parametrizedSmoke(int test, int steps, int noKeys, int noValues, int seed, boolean evilHash) { | 66 | void parametrizedSmoke(int test, int steps, int noKeys, int noValues, int seed, boolean evilHash) { |
66 | runSmokeTest( | 67 | runSmokeTest( |
67 | "SmokeS" + steps + "K" + noKeys + "V" + noValues + "s" + seed + "H" + (evilHash ? "Evil" : "Normal"), | 68 | "SmokeS" + steps + "K" + noKeys + "V" + noValues + "s" + seed + "H" + (evilHash ? "Evil" : "Normal"), |
68 | seed, steps, noKeys, noValues, evilHash); | 69 | seed, steps, noKeys, noValues, evilHash); |
69 | } | 70 | } |
70 | 71 | ||
71 | public static Stream<Arguments> parametrizedSmoke() { | 72 | static Stream<Arguments> parametrizedSmoke() { |
72 | return TestPermuter.permutationWithSize(new Object[] { 1000 }, | 73 | return SmokeTestUtils.permutationWithSize(new Object[] { 1000 }, |
73 | new Object[] { 3, 32, 32 * 32, 32 * 32 * 32 * 32 }, new Object[] { 2, 3 }, new Object[] { 1, 2, 3 }, | 74 | new Object[] { 3, 32, 32 * 32, 32 * 32 * 32 * 32 }, new Object[] { 2, 3 }, new Object[] { 1, 2, 3 }, |
74 | new Object[] { false, true }); | 75 | new Object[] { false, true }); |
75 | } | 76 | } |
diff --git a/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/fast/RestoreSmokeTest.java b/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/RestoreSmokeTest.java index 4ca9b088..fa96f0c1 100644 --- a/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/fast/RestoreSmokeTest.java +++ b/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/RestoreSmokeTest.java | |||
@@ -1,4 +1,4 @@ | |||
1 | package org.eclipse.viatra.solver.data.map.tests.smoke.fast; | 1 | package org.eclipse.viatra.solver.data.map.tests.smoke; |
2 | 2 | ||
3 | import static org.junit.jupiter.api.Assertions.fail; | 3 | import static org.junit.jupiter.api.Assertions.fail; |
4 | 4 | ||
@@ -11,15 +11,16 @@ import org.eclipse.viatra.solver.data.map.ContinousHashProvider; | |||
11 | import org.eclipse.viatra.solver.data.map.VersionedMapStore; | 11 | import org.eclipse.viatra.solver.data.map.VersionedMapStore; |
12 | import org.eclipse.viatra.solver.data.map.VersionedMapStoreImpl; | 12 | import org.eclipse.viatra.solver.data.map.VersionedMapStoreImpl; |
13 | import org.eclipse.viatra.solver.data.map.internal.VersionedMapImpl; | 13 | import org.eclipse.viatra.solver.data.map.internal.VersionedMapImpl; |
14 | import org.eclipse.viatra.solver.data.map.tests.smoke.utils.TestPermuter; | 14 | import org.eclipse.viatra.solver.data.map.tests.smoke.utils.SmokeTestUtils; |
15 | import org.eclipse.viatra.solver.data.map.tests.support.MapTestEnvironment; | 15 | import org.eclipse.viatra.solver.data.map.tests.utils.MapTestEnvironment; |
16 | import org.junit.jupiter.api.Tag; | ||
16 | import org.junit.jupiter.api.Timeout; | 17 | import org.junit.jupiter.api.Timeout; |
17 | import org.junit.jupiter.params.ParameterizedTest; | 18 | import org.junit.jupiter.params.ParameterizedTest; |
18 | import org.junit.jupiter.params.provider.Arguments; | 19 | import org.junit.jupiter.params.provider.Arguments; |
19 | import org.junit.jupiter.params.provider.MethodSource; | 20 | import org.junit.jupiter.params.provider.MethodSource; |
20 | 21 | ||
21 | public class RestoreSmokeTest { | 22 | class RestoreSmokeTest { |
22 | public void runSmokeTest(String scenario, int seed, int steps, int maxKey, int maxValue, int commitFrequency, | 23 | private void runSmokeTest(String scenario, int seed, int steps, int maxKey, int maxValue, int commitFrequency, |
23 | boolean evilHash) { | 24 | boolean evilHash) { |
24 | String[] values = MapTestEnvironment.prepareValues(maxValue); | 25 | String[] values = MapTestEnvironment.prepareValues(maxValue); |
25 | ContinousHashProvider<Integer> chp = MapTestEnvironment.prepareHashProvider(evilHash); | 26 | ContinousHashProvider<Integer> chp = MapTestEnvironment.prepareHashProvider(evilHash); |
@@ -29,8 +30,8 @@ public class RestoreSmokeTest { | |||
29 | iterativeRandomPutsAndCommitsThenRestore(scenario, store, steps, maxKey, values, seed, commitFrequency); | 30 | iterativeRandomPutsAndCommitsThenRestore(scenario, store, steps, maxKey, values, seed, commitFrequency); |
30 | } | 31 | } |
31 | 32 | ||
32 | void iterativeRandomPutsAndCommitsThenRestore(String scenario, VersionedMapStore<Integer, String> store, int steps, | 33 | private void iterativeRandomPutsAndCommitsThenRestore(String scenario, VersionedMapStore<Integer, String> store, |
33 | int maxKey, String[] values, int seed, int commitFrequency) { | 34 | int steps, int maxKey, String[] values, int seed, int commitFrequency) { |
34 | // 1. build a map with versions | 35 | // 1. build a map with versions |
35 | Random r = new Random(seed); | 36 | Random r = new Random(seed); |
36 | VersionedMapImpl<Integer, String> versioned = (VersionedMapImpl<Integer, String>) store.createMap(); | 37 | VersionedMapImpl<Integer, String> versioned = (VersionedMapImpl<Integer, String>) store.createMap(); |
@@ -75,18 +76,33 @@ public class RestoreSmokeTest { | |||
75 | 76 | ||
76 | } | 77 | } |
77 | 78 | ||
78 | @ParameterizedTest(name = "Mutable-Immutable Compare Smoke {index}/{0} Steps={1} Keys={2} Values={3} commit frequency={4} seed={5} evil-hash={6}") | 79 | @ParameterizedTest(name = "Restore Smoke {index}/{0} Steps={1} Keys={2} Values={3} commit frequency={4} seed={5} evil-hash={6}") |
79 | @MethodSource | 80 | @MethodSource |
80 | @Timeout(value = 10) | 81 | @Timeout(value = 10) |
81 | void parametrizedSmoke(int tests, int steps, int noKeys, int noValues, int commitFrequency, int seed, | 82 | @Tag("smoke") |
83 | void parametrizedFastSmoke(int tests, int steps, int noKeys, int noValues, int commitFrequency, int seed, | ||
82 | boolean evilHash) { | 84 | boolean evilHash) { |
83 | runSmokeTest("SmokeMutableImmutableCompareS" + steps + "K" + noKeys + "V" + noValues + "s" + seed, seed, steps, | 85 | runSmokeTest("RestoreS" + steps + "K" + noKeys + "V" + noValues + "s" + seed, seed, steps, noKeys, noValues, |
84 | noKeys, noValues, commitFrequency, evilHash); | 86 | commitFrequency, evilHash); |
85 | } | 87 | } |
86 | 88 | ||
87 | public static Stream<Arguments> parametrizedSmoke() { | 89 | static Stream<Arguments> parametrizedFastSmoke() { |
88 | return TestPermuter.permutationWithSize(new Object[] { 1000 }, new Object[] { 3, 32, 32 * 32 }, | 90 | return SmokeTestUtils.permutationWithSize(new Object[] { 1000 }, new Object[] { 3, 32, 32 * 32 }, |
89 | new Object[] { 2, 3 }, new Object[] { 1, 10, 100 }, new Object[] { 1, 2, 3 }, | 91 | new Object[] { 2, 3 }, new Object[] { 1, 10, 100 }, new Object[] { 1, 2, 3 }, |
90 | new Object[] { false, true }); | 92 | new Object[] { false, true }); |
91 | } | 93 | } |
94 | |||
95 | @ParameterizedTest(name = "Restore Smoke {index}/{0} Steps={1} Keys={2} Values={3} commit frequency={4} seed={5} evil-hash={6}") | ||
96 | @MethodSource | ||
97 | @Tag("smoke") | ||
98 | @Tag("slow") | ||
99 | void parametrizedSlowSmoke(int tests, int steps, int noKeys, int noValues, int commitFrequency, int seed, | ||
100 | boolean evilHash) { | ||
101 | runSmokeTest("RestoreS" + steps + "K" + noKeys + "V" + noValues + "s" + seed, seed, steps, noKeys, noValues, | ||
102 | commitFrequency, evilHash); | ||
103 | } | ||
104 | |||
105 | static Stream<Arguments> parametrizedSlowSmoke() { | ||
106 | return SmokeTestUtils.changeStepCount(RestoreSmokeTest.parametrizedFastSmoke(), 1); | ||
107 | } | ||
92 | } | 108 | } |
diff --git a/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/slow/SlowSmokeTest.java b/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/slow/SlowSmokeTest.java deleted file mode 100644 index 004d30d9..00000000 --- a/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/slow/SlowSmokeTest.java +++ /dev/null | |||
@@ -1,77 +0,0 @@ | |||
1 | package org.eclipse.viatra.solver.data.map.tests.smoke.slow; | ||
2 | |||
3 | import java.util.Arrays; | ||
4 | import java.util.stream.Stream; | ||
5 | |||
6 | import org.eclipse.viatra.solver.data.map.tests.smoke.fast.CommitSmokeTest; | ||
7 | import org.eclipse.viatra.solver.data.map.tests.smoke.fast.MutableImmutableCompareSmokeTest; | ||
8 | import org.eclipse.viatra.solver.data.map.tests.smoke.fast.MutableSmokeTest; | ||
9 | import org.eclipse.viatra.solver.data.map.tests.smoke.fast.RestoreSmokeTest; | ||
10 | import org.junit.jupiter.api.Disabled; | ||
11 | import org.junit.jupiter.params.ParameterizedTest; | ||
12 | import org.junit.jupiter.params.provider.Arguments; | ||
13 | import org.junit.jupiter.params.provider.MethodSource; | ||
14 | |||
15 | @Disabled | ||
16 | public class SlowSmokeTest { | ||
17 | |||
18 | private static int slowStepCount = 32 * 32 * 32 * 32; | ||
19 | |||
20 | private static Stream<Arguments> changeStepCount(Stream<Arguments> arguments) { | ||
21 | return arguments.map(x -> Arguments.of(updatedStepCount(x.get()))); | ||
22 | |||
23 | } | ||
24 | |||
25 | private static Object[] updatedStepCount(Object[] arguments) { | ||
26 | Object[] copy = Arrays.copyOf(arguments, arguments.length); | ||
27 | copy[1] = slowStepCount; | ||
28 | return copy; | ||
29 | } | ||
30 | |||
31 | @ParameterizedTest(name = "Mutable Smoke {index}/{0} Steps={1} Keys={2} Values={3} seed={4} evil-hash={5}") | ||
32 | @MethodSource | ||
33 | void smoke1(int test, int steps, int noKeys, int noValues, int seed, boolean evilHash) { | ||
34 | (new MutableSmokeTest()).runSmokeTest( | ||
35 | "SmokeS" + steps + "K" + noKeys + "V" + noValues + "s" + seed + "H" + (evilHash ? "Evil" : "Normal"), | ||
36 | seed, steps, noKeys, noValues, evilHash); | ||
37 | } | ||
38 | |||
39 | private static Stream<Arguments> smoke1() { | ||
40 | return changeStepCount(MutableSmokeTest.parametrizedSmoke()); | ||
41 | } | ||
42 | |||
43 | @ParameterizedTest(name = "Immutable Smoke {index}/{0} Steps={1} Keys={2} Values={3} commit frequency={4} seed={5} evil-hash={6}") | ||
44 | @MethodSource | ||
45 | void smoke2(int tests, int steps, int noKeys, int noValues, int commitFrequency, int seed, boolean evilHash) { | ||
46 | (new CommitSmokeTest()).runSmokeTest("SmokeCommitS" + steps + "K" + noKeys + "V" + noValues + "s" + seed, seed, | ||
47 | steps, noKeys, noValues, commitFrequency, evilHash); | ||
48 | } | ||
49 | |||
50 | private static Stream<Arguments> smoke2() { | ||
51 | return changeStepCount(CommitSmokeTest.parametrizedSmoke()); | ||
52 | } | ||
53 | |||
54 | @ParameterizedTest(name = "Mutable-Immutable Compare Smoke {index}/{0} Steps={1} Keys={2} Values={3} commit frequency={4} seed={5} evil-hash={6}") | ||
55 | @MethodSource | ||
56 | void smoke3(int tests, int steps, int noKeys, int noValues, int commitFrequency, int seed, boolean evilHash) { | ||
57 | (new MutableImmutableCompareSmokeTest()).runSmokeTest( | ||
58 | "SmokeMutableImmutableCompareS" + steps + "K" + noKeys + "V" + noValues + "s" + seed, seed, steps, | ||
59 | noKeys, noValues, commitFrequency, evilHash); | ||
60 | } | ||
61 | |||
62 | private static Stream<Arguments> smoke3() { | ||
63 | return changeStepCount(MutableImmutableCompareSmokeTest.parametrizedSmoke()); | ||
64 | } | ||
65 | |||
66 | @ParameterizedTest(name = "Mutable-Immutable Compare Smoke {index}/{0} Steps={1} Keys={2} Values={3} commit frequency={4} seed={5} evil-hash={6}") | ||
67 | @MethodSource | ||
68 | void smoke4(int tests, int steps, int noKeys, int noValues, int commitFrequency, int seed, boolean evilHash) { | ||
69 | (new RestoreSmokeTest()).runSmokeTest( | ||
70 | "SmokeMutableImmutableCompareS" + steps + "K" + noKeys + "V" + noValues + "s" + seed, seed, steps, | ||
71 | noKeys, noValues, commitFrequency, evilHash); | ||
72 | } | ||
73 | |||
74 | private static Stream<Arguments> smoke4() { | ||
75 | return changeStepCount(RestoreSmokeTest.parametrizedSmoke()); | ||
76 | } | ||
77 | } | ||
diff --git a/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/utils/TestPermuter.java b/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/utils/SmokeTestUtils.java index 0f7b4642..9eab854f 100644 --- a/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/utils/TestPermuter.java +++ b/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/utils/SmokeTestUtils.java | |||
@@ -1,12 +1,29 @@ | |||
1 | package org.eclipse.viatra.solver.data.map.tests.smoke.utils; | 1 | package org.eclipse.viatra.solver.data.map.tests.smoke.utils; |
2 | 2 | ||
3 | import java.util.Arrays; | ||
3 | import java.util.LinkedList; | 4 | import java.util.LinkedList; |
4 | import java.util.List; | 5 | import java.util.List; |
5 | import java.util.stream.Stream; | 6 | import java.util.stream.Stream; |
6 | 7 | ||
7 | import org.junit.jupiter.params.provider.Arguments; | 8 | import org.junit.jupiter.params.provider.Arguments; |
8 | 9 | ||
9 | public class TestPermuter { | 10 | public final class SmokeTestUtils { |
11 | private static final int SLOW_STEP_COUNT = 32 * 32 * 32 * 32; | ||
12 | |||
13 | private SmokeTestUtils() { | ||
14 | throw new IllegalStateException("This is a static utility class and should not be instantiated directly"); | ||
15 | } | ||
16 | |||
17 | public static Stream<Arguments> changeStepCount(Stream<Arguments> arguments, int parameterIndex) { | ||
18 | return arguments.map(x -> Arguments.of(updatedStepCount(x.get(), parameterIndex))); | ||
19 | } | ||
20 | |||
21 | public static Object[] updatedStepCount(Object[] arguments, int parameterIndex) { | ||
22 | Object[] copy = Arrays.copyOf(arguments, arguments.length); | ||
23 | copy[parameterIndex] = SLOW_STEP_COUNT; | ||
24 | return copy; | ||
25 | } | ||
26 | |||
10 | static List<List<Object>> permutationInternal(int from, Object[]... valueOption) { | 27 | static List<List<Object>> permutationInternal(int from, Object[]... valueOption) { |
11 | if (valueOption.length == from) { | 28 | if (valueOption.length == from) { |
12 | return List.of(List.of()); | 29 | return List.of(List.of()); |
diff --git a/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/utils/TestPermuterTest.java b/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/utils/SmoteTestUtilsTest.java index 91f1c2e0..376b3e50 100644 --- a/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/utils/TestPermuterTest.java +++ b/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/smoke/utils/SmoteTestUtilsTest.java | |||
@@ -6,24 +6,24 @@ import java.util.List; | |||
6 | 6 | ||
7 | import org.junit.jupiter.api.Test; | 7 | import org.junit.jupiter.api.Test; |
8 | 8 | ||
9 | class TestPermuterTest { | 9 | class SmoteTestUtilsTest { |
10 | @Test | 10 | @Test |
11 | void permutationInternalTest() { | 11 | void permutationInternalTest() { |
12 | List<List<Object>> res = TestPermuter.permutationInternal(0, new Object[] { 1, 2, 3 }, | 12 | List<List<Object>> res = SmokeTestUtils.permutationInternal(0, new Object[] { 1, 2, 3 }, |
13 | new Object[] { 'a', 'b', 'c' }, new Object[] { "alpha", "beta", "gamma", "delta" }); | 13 | new Object[] { 'a', 'b', 'c' }, new Object[] { "alpha", "beta", "gamma", "delta" }); |
14 | assertEquals(3 * 3 * 4, res.size()); | 14 | assertEquals(3 * 3 * 4, res.size()); |
15 | } | 15 | } |
16 | 16 | ||
17 | @Test | 17 | @Test |
18 | void permutationTest1() { | 18 | void permutationTest1() { |
19 | var res = TestPermuter.permutation(new Object[] { 1, 2, 3 }, new Object[] { 'a', 'b', 'c' }, | 19 | var res = SmokeTestUtils.permutation(new Object[] { 1, 2, 3 }, new Object[] { 'a', 'b', 'c' }, |
20 | new Object[] { "alpha", "beta", "gamma", "delta" }); | 20 | new Object[] { "alpha", "beta", "gamma", "delta" }); |
21 | assertEquals(3 * 3 * 4, res.count()); | 21 | assertEquals(3 * 3 * 4, res.count()); |
22 | } | 22 | } |
23 | 23 | ||
24 | @Test | 24 | @Test |
25 | void permutationTest2() { | 25 | void permutationTest2() { |
26 | var res = TestPermuter.permutation(new Object[] { 1, 2, 3 }, new Object[] { 'a', 'b', 'c' }, | 26 | var res = SmokeTestUtils.permutation(new Object[] { 1, 2, 3 }, new Object[] { 'a', 'b', 'c' }, |
27 | new Object[] { "alpha", "beta", "gamma", "delta" }); | 27 | new Object[] { "alpha", "beta", "gamma", "delta" }); |
28 | var arguments = res.findFirst().get().get(); | 28 | var arguments = res.findFirst().get().get(); |
29 | assertEquals(1, arguments[0]); | 29 | assertEquals(1, arguments[0]); |
diff --git a/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/support/MapTestEnvironment.java b/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/utils/MapTestEnvironment.java index 6c55be62..59e5e913 100644 --- a/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/support/MapTestEnvironment.java +++ b/model-data/src/test/java/org/eclipse/viatra/solver/data/map/tests/utils/MapTestEnvironment.java | |||
@@ -1,4 +1,4 @@ | |||
1 | package org.eclipse.viatra.solver.data.map.tests.support; | 1 | package org.eclipse.viatra.solver.data.map.tests.utils; |
2 | 2 | ||
3 | import static org.junit.jupiter.api.Assertions.assertEquals; | 3 | import static org.junit.jupiter.api.Assertions.assertEquals; |
4 | import static org.junit.jupiter.api.Assertions.fail; | 4 | import static org.junit.jupiter.api.Assertions.fail; |