diff options
author | OszkarSemerath <semerath@mit.bme.hu> | 2023-02-10 11:49:47 +0100 |
---|---|---|
committer | OszkarSemerath <semerath@mit.bme.hu> | 2023-02-10 11:49:47 +0100 |
commit | 55c8acd527bf0b5608e15587be9a9bfad3dc3c6b (patch) | |
tree | d095e596d76030c7b0b8711dd85487874693edbb /subprojects/store/src/test/java/tools | |
parent | VersionedMapStoreBuilder for delta and state based stores (diff) | |
download | refinery-55c8acd527bf0b5608e15587be9a9bfad3dc3c6b.tar.gz refinery-55c8acd527bf0b5608e15587be9a9bfad3dc3c6b.tar.zst refinery-55c8acd527bf0b5608e15587be9a9bfad3dc3c6b.zip |
Moved test parametrization to FuzzTestCollections.java
Diffstat (limited to 'subprojects/store/src/test/java/tools')
9 files changed, 41 insertions, 29 deletions
diff --git a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/CommitFuzzTest.java b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/CommitFuzzTest.java index 9e3f636b..b61152f5 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/CommitFuzzTest.java +++ b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/CommitFuzzTest.java | |||
@@ -18,7 +18,10 @@ import tools.refinery.store.map.internal.VersionedMapImpl; | |||
18 | import tools.refinery.store.map.tests.fuzz.utils.FuzzTestUtils; | 18 | import tools.refinery.store.map.tests.fuzz.utils.FuzzTestUtils; |
19 | import tools.refinery.store.map.tests.utils.MapTestEnvironment; | 19 | import tools.refinery.store.map.tests.utils.MapTestEnvironment; |
20 | 20 | ||
21 | import static tools.refinery.store.map.tests.fuzz.utils.FuzzTestCollections.*; | ||
22 | |||
21 | class CommitFuzzTest { | 23 | class CommitFuzzTest { |
24 | |||
22 | private void runFuzzTest(String scenario, int seed, int steps, int maxKey, int maxValue, | 25 | private void runFuzzTest(String scenario, int seed, int steps, int maxKey, int maxValue, |
23 | boolean nullDefault, int commitFrequency, | 26 | boolean nullDefault, int commitFrequency, |
24 | boolean evilHash) { | 27 | boolean evilHash) { |
@@ -67,9 +70,8 @@ class CommitFuzzTest { | |||
67 | } | 70 | } |
68 | 71 | ||
69 | static Stream<Arguments> parametrizedFastFuzz() { | 72 | static Stream<Arguments> parametrizedFastFuzz() { |
70 | return FuzzTestUtils.permutationWithSize(new Object[]{FuzzTestUtils.FAST_STEP_COUNT}, new Object[]{3, 32, 32 * 32}, | 73 | return FuzzTestUtils.permutationWithSize(stepCounts, keyCounts, valueCounts, nullDefaultOptions, |
71 | new Object[]{2, 3}, new Object[]{false, true}, new Object[]{1, 10, 100}, new Object[]{1, 2, 3}, | 74 | commitFrequencyOptions, randomSeedOptions, evilHashOptions); |
72 | new Object[]{false, true}); | ||
73 | } | 75 | } |
74 | 76 | ||
75 | @ParameterizedTest(name = "Commit {index}/{0} Steps={1} Keys={2} Values={3} nullDefault={4} commit frequency={5} " + | 77 | @ParameterizedTest(name = "Commit {index}/{0} Steps={1} Keys={2} Values={3} nullDefault={4} commit frequency={5} " + |
diff --git a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/ContentEqualsFuzzTest.java b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/ContentEqualsFuzzTest.java index 71cb3d11..c17b0a95 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/ContentEqualsFuzzTest.java +++ b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/ContentEqualsFuzzTest.java | |||
@@ -18,6 +18,7 @@ import java.util.Random; | |||
18 | import java.util.stream.Stream; | 18 | import java.util.stream.Stream; |
19 | 19 | ||
20 | import static org.junit.jupiter.api.Assertions.*; | 20 | import static org.junit.jupiter.api.Assertions.*; |
21 | import static tools.refinery.store.map.tests.fuzz.utils.FuzzTestCollections.*; | ||
21 | 22 | ||
22 | class ContentEqualsFuzzTest { | 23 | class ContentEqualsFuzzTest { |
23 | private void runFuzzTest(String scenario, int seed, int steps, int maxKey, int maxValue, | 24 | private void runFuzzTest(String scenario, int seed, int steps, int maxKey, int maxValue, |
@@ -93,10 +94,8 @@ class ContentEqualsFuzzTest { | |||
93 | } | 94 | } |
94 | 95 | ||
95 | static Stream<Arguments> parametrizedFastFuzz() { | 96 | static Stream<Arguments> parametrizedFastFuzz() { |
96 | return FuzzTestUtils.permutationWithSize(new Object[]{FuzzTestUtils.FAST_STEP_COUNT}, new Object[]{3, 32, | 97 | return FuzzTestUtils.permutationWithSize(stepCounts, keyCounts, valueCounts, nullDefaultOptions, |
97 | 32 * 32}, | 98 | commitFrequencyOptions, randomSeedOptions, evilHashOptions); |
98 | new Object[]{2, 3}, new Object[]{false, true}, new Object[]{1, 10, 100}, new Object[]{1, 2, 3}, | ||
99 | new Object[]{false, true}); | ||
100 | } | 99 | } |
101 | 100 | ||
102 | @ParameterizedTest(name = "Compare {index}/{0} Steps={1} Keys={2} Values={3} defaultNull={4} commit frequency={5}" + | 101 | @ParameterizedTest(name = "Compare {index}/{0} Steps={1} Keys={2} Values={3} defaultNull={4} commit frequency={5}" + |
diff --git a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/DiffCursorFuzzTest.java b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/DiffCursorFuzzTest.java index 8a5576aa..90aa8e01 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/DiffCursorFuzzTest.java +++ b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/DiffCursorFuzzTest.java | |||
@@ -1,6 +1,7 @@ | |||
1 | package tools.refinery.store.map.tests.fuzz; | 1 | package tools.refinery.store.map.tests.fuzz; |
2 | 2 | ||
3 | import static org.junit.jupiter.api.Assertions.fail; | 3 | import static org.junit.jupiter.api.Assertions.fail; |
4 | import static tools.refinery.store.map.tests.fuzz.utils.FuzzTestCollections.*; | ||
4 | 5 | ||
5 | import java.util.Random; | 6 | import java.util.Random; |
6 | import java.util.stream.Stream; | 7 | import java.util.stream.Stream; |
@@ -93,16 +94,14 @@ class DiffCursorFuzzTest { | |||
93 | @Timeout(value = 10) | 94 | @Timeout(value = 10) |
94 | @Tag("fuzz") | 95 | @Tag("fuzz") |
95 | void parametrizedFuzz(int ignoredTests, int steps, int noKeys, int noValues, boolean nullDefault, int commitFrequency, | 96 | void parametrizedFuzz(int ignoredTests, int steps, int noKeys, int noValues, boolean nullDefault, int commitFrequency, |
96 | int seed, | 97 | int seed, boolean evilHash) { |
97 | boolean evilHash) { | ||
98 | runFuzzTest("MutableImmutableCompareS" + steps + "K" + noKeys + "V" + noValues + "s" + seed, seed, steps, | 98 | runFuzzTest("MutableImmutableCompareS" + steps + "K" + noKeys + "V" + noValues + "s" + seed, seed, steps, |
99 | noKeys, noValues, nullDefault, commitFrequency, evilHash); | 99 | noKeys, noValues, nullDefault, commitFrequency, evilHash); |
100 | } | 100 | } |
101 | 101 | ||
102 | static Stream<Arguments> parametrizedFuzz() { | 102 | static Stream<Arguments> parametrizedFuzz() { |
103 | return FuzzTestUtils.permutationWithSize(new Object[]{FuzzTestUtils.FAST_STEP_COUNT}, new Object[]{3, 32, 32 * 32}, | 103 | return FuzzTestUtils.permutationWithSize(stepCounts, keyCounts, valueCounts, nullDefaultOptions, |
104 | new Object[]{2, 3}, new Object[]{false, true}, new Object[]{1, 10, 100}, new Object[]{1, 2, 3}, | 104 | commitFrequencyOptions, randomSeedOptions, evilHashOptions); |
105 | new Object[]{false, true}); | ||
106 | } | 105 | } |
107 | 106 | ||
108 | @ParameterizedTest(name = "Mutable-Immutable Compare {index}/{0} Steps={1} Keys={2} Values={3} nullDefault={4} " + | 107 | @ParameterizedTest(name = "Mutable-Immutable Compare {index}/{0} Steps={1} Keys={2} Values={3} nullDefault={4} " + |
@@ -111,8 +110,7 @@ class DiffCursorFuzzTest { | |||
111 | @Tag("fuzz") | 110 | @Tag("fuzz") |
112 | @Tag("slow") | 111 | @Tag("slow") |
113 | void parametrizedSlowFuzz(int ignoredTests, int steps, int noKeys, int noValues, boolean nullDefault, int commitFrequency, | 112 | void parametrizedSlowFuzz(int ignoredTests, int steps, int noKeys, int noValues, boolean nullDefault, int commitFrequency, |
114 | int seed, | 113 | int seed, boolean evilHash) { |
115 | boolean evilHash) { | ||
116 | runFuzzTest("MutableImmutableCompareS" + steps + "K" + noKeys + "V" + noValues + "s" + seed, seed, steps, noKeys, noValues, | 114 | runFuzzTest("MutableImmutableCompareS" + steps + "K" + noKeys + "V" + noValues + "s" + seed, seed, steps, noKeys, noValues, |
117 | nullDefault, commitFrequency, evilHash); | 115 | nullDefault, commitFrequency, evilHash); |
118 | } | 116 | } |
diff --git a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/MultiThreadFuzzTest.java b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/MultiThreadFuzzTest.java index 5d5f3ce3..9325a938 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/MultiThreadFuzzTest.java +++ b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/MultiThreadFuzzTest.java | |||
@@ -2,6 +2,7 @@ package tools.refinery.store.map.tests.fuzz; | |||
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; |
5 | import static tools.refinery.store.map.tests.fuzz.utils.FuzzTestCollections.*; | ||
5 | 6 | ||
6 | import java.util.Collections; | 7 | import java.util.Collections; |
7 | import java.util.LinkedList; | 8 | import java.util.LinkedList; |
@@ -78,9 +79,9 @@ class MultiThreadFuzzTest { | |||
78 | } | 79 | } |
79 | 80 | ||
80 | static Stream<Arguments> parametrizedFastFuzz() { | 81 | static Stream<Arguments> parametrizedFastFuzz() { |
81 | return FuzzTestUtils.permutationWithSize(new Object[]{FuzzTestUtils.FAST_STEP_COUNT}, new Object[]{3, 32, 32 * 32}, | 82 | return FuzzTestUtils.permutationWithSize(stepCounts, keyCounts, valueCounts, nullDefaultOptions, |
82 | new Object[]{2, 3}, new Object[]{false, true}, new Object[]{10, 100}, new Object[]{1, 2, 3}, | 83 | new Object[]{10, 100}, randomSeedOptions, |
83 | new Object[]{false, true}); | 84 | evilHashOptions); |
84 | } | 85 | } |
85 | 86 | ||
86 | @ParameterizedTest(name = "MultiThread {index}/{0} Steps={1} Keys={2} Values={3} defaultNull={4} commit " + | 87 | @ParameterizedTest(name = "MultiThread {index}/{0} Steps={1} Keys={2} Values={3} defaultNull={4} commit " + |
diff --git a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/MutableFuzzTest.java b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/MutableFuzzTest.java index 2d65ba0c..ab37ef83 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/MutableFuzzTest.java +++ b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/MutableFuzzTest.java | |||
@@ -1,6 +1,7 @@ | |||
1 | package tools.refinery.store.map.tests.fuzz; | 1 | package tools.refinery.store.map.tests.fuzz; |
2 | 2 | ||
3 | import static org.junit.jupiter.api.Assertions.fail; | 3 | import static org.junit.jupiter.api.Assertions.fail; |
4 | import static tools.refinery.store.map.tests.fuzz.utils.FuzzTestCollections.*; | ||
4 | 5 | ||
5 | import java.util.Random; | 6 | import java.util.Random; |
6 | import java.util.stream.Stream; | 7 | import java.util.stream.Stream; |
@@ -64,9 +65,8 @@ class MutableFuzzTest { | |||
64 | } | 65 | } |
65 | 66 | ||
66 | static Stream<Arguments> parametrizedFuzz() { | 67 | static Stream<Arguments> parametrizedFuzz() { |
67 | return FuzzTestUtils.permutationWithSize(new Object[]{FuzzTestUtils.FAST_STEP_COUNT}, | 68 | return FuzzTestUtils.permutationWithSize(stepCounts, keyCounts, valueCounts, nullDefaultOptions, |
68 | new Object[]{3, 32, 32 * 32, 32 * 32 * 32 * 32}, new Object[]{2, 3}, new Object[]{false, true}, | 69 | randomSeedOptions, evilHashOptions); |
69 | new Object[]{1, 2, 3}, new Object[]{false, true}); | ||
70 | } | 70 | } |
71 | 71 | ||
72 | @ParameterizedTest(name = "Mutable {index}/{0} Steps={1} Keys={2} Values={3} nullDefault={4} seed={5} " + | 72 | @ParameterizedTest(name = "Mutable {index}/{0} Steps={1} Keys={2} Values={3} nullDefault={4} seed={5} " + |
diff --git a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/MutableImmutableCompareFuzzTest.java b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/MutableImmutableCompareFuzzTest.java index da8a43c2..b58b06f9 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/MutableImmutableCompareFuzzTest.java +++ b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/MutableImmutableCompareFuzzTest.java | |||
@@ -1,6 +1,7 @@ | |||
1 | package tools.refinery.store.map.tests.fuzz; | 1 | package tools.refinery.store.map.tests.fuzz; |
2 | 2 | ||
3 | import static org.junit.jupiter.api.Assertions.fail; | 3 | import static org.junit.jupiter.api.Assertions.fail; |
4 | import static tools.refinery.store.map.tests.fuzz.utils.FuzzTestCollections.*; | ||
4 | 5 | ||
5 | import java.util.Random; | 6 | import java.util.Random; |
6 | import java.util.stream.Stream; | 7 | import java.util.stream.Stream; |
@@ -69,9 +70,8 @@ class MutableImmutableCompareFuzzTest { | |||
69 | } | 70 | } |
70 | 71 | ||
71 | static Stream<Arguments> parametrizedFastFuzz() { | 72 | static Stream<Arguments> parametrizedFastFuzz() { |
72 | return FuzzTestUtils.permutationWithSize(new Object[]{FuzzTestUtils.FAST_STEP_COUNT}, new Object[]{3, 32, 32 * 32}, | 73 | return FuzzTestUtils.permutationWithSize(stepCounts, keyCounts, valueCounts, nullDefaultOptions, |
73 | new Object[]{2, 3}, new Object[]{false, true}, new Object[]{1, 10, 100}, new Object[]{1, 2, 3}, | 74 | commitFrequencyOptions, randomSeedOptions, evilHashOptions); |
74 | new Object[]{false, true}); | ||
75 | } | 75 | } |
76 | 76 | ||
77 | @ParameterizedTest(name = "Mutable-Immutable Compare {index}/{0} Steps={1} Keys={2} Values={3} nullDefault={4} " + | 77 | @ParameterizedTest(name = "Mutable-Immutable Compare {index}/{0} Steps={1} Keys={2} Values={3} nullDefault={4} " + |
diff --git a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/RestoreFuzzTest.java b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/RestoreFuzzTest.java index bd03d1e9..77b26c41 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/RestoreFuzzTest.java +++ b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/RestoreFuzzTest.java | |||
@@ -1,6 +1,7 @@ | |||
1 | package tools.refinery.store.map.tests.fuzz; | 1 | package tools.refinery.store.map.tests.fuzz; |
2 | 2 | ||
3 | import static org.junit.jupiter.api.Assertions.fail; | 3 | import static org.junit.jupiter.api.Assertions.fail; |
4 | import static tools.refinery.store.map.tests.fuzz.utils.FuzzTestCollections.*; | ||
4 | 5 | ||
5 | import java.util.HashMap; | 6 | import java.util.HashMap; |
6 | import java.util.Map; | 7 | import java.util.Map; |
@@ -90,9 +91,8 @@ class RestoreFuzzTest { | |||
90 | } | 91 | } |
91 | 92 | ||
92 | static Stream<Arguments> parametrizedFastFuzz() { | 93 | static Stream<Arguments> parametrizedFastFuzz() { |
93 | return FuzzTestUtils.permutationWithSize(new Object[]{FuzzTestUtils.FAST_STEP_COUNT}, new Object[]{3, 32, 32 * 32}, | 94 | return FuzzTestUtils.permutationWithSize(stepCounts, keyCounts, valueCounts, nullDefaultOptions, |
94 | new Object[]{2, 3}, new Object[]{false, true}, new Object[]{1, 10, 100}, new Object[]{1, 2, 3}, | 95 | commitFrequencyOptions, randomSeedOptions, evilHashOptions); |
95 | new Object[]{false, true}); | ||
96 | } | 96 | } |
97 | 97 | ||
98 | @ParameterizedTest(name = "Restore {index}/{0} Steps={1} Keys={2} Values={3} nullDefault={4} commit frequency={5}" + | 98 | @ParameterizedTest(name = "Restore {index}/{0} Steps={1} Keys={2} Values={3} nullDefault={4} commit frequency={5}" + |
diff --git a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/SharedStoreFuzzTest.java b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/SharedStoreFuzzTest.java index 0fc9cd38..4462c55b 100644 --- a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/SharedStoreFuzzTest.java +++ b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/SharedStoreFuzzTest.java | |||
@@ -20,6 +20,8 @@ import tools.refinery.store.map.internal.VersionedMapImpl; | |||
20 | import tools.refinery.store.map.tests.fuzz.utils.FuzzTestUtils; | 20 | import tools.refinery.store.map.tests.fuzz.utils.FuzzTestUtils; |
21 | import tools.refinery.store.map.tests.utils.MapTestEnvironment; | 21 | import tools.refinery.store.map.tests.utils.MapTestEnvironment; |
22 | 22 | ||
23 | import static tools.refinery.store.map.tests.fuzz.utils.FuzzTestCollections.*; | ||
24 | |||
23 | class SharedStoreFuzzTest { | 25 | class SharedStoreFuzzTest { |
24 | private void runFuzzTest(String scenario, int seed, int steps, int maxKey, int maxValue, | 26 | private void runFuzzTest(String scenario, int seed, int steps, int maxKey, int maxValue, |
25 | boolean nullDefault, int commitFrequency, boolean evilHash) { | 27 | boolean nullDefault, int commitFrequency, boolean evilHash) { |
@@ -93,9 +95,8 @@ class SharedStoreFuzzTest { | |||
93 | } | 95 | } |
94 | 96 | ||
95 | static Stream<Arguments> parametrizedFastFuzz() { | 97 | static Stream<Arguments> parametrizedFastFuzz() { |
96 | return FuzzTestUtils.permutationWithSize(new Object[]{FuzzTestUtils.FAST_STEP_COUNT}, new Object[]{3, 32, 32 * 32}, | 98 | return FuzzTestUtils.permutationWithSize(stepCounts, keyCounts, valueCounts, nullDefaultOptions, |
97 | new Object[]{2, 3}, new Object[]{false, true}, new Object[]{1, 10, 100}, new Object[]{1, 2, 3}, | 99 | commitFrequencyOptions, randomSeedOptions, evilHashOptions); |
98 | new Object[]{false, true}); | ||
99 | } | 100 | } |
100 | 101 | ||
101 | @ParameterizedTest(name = "Shared Store {index}/{0} Steps={1} Keys={2} Values={3} nullDefault={4} commit " + | 102 | @ParameterizedTest(name = "Shared Store {index}/{0} Steps={1} Keys={2} Values={3} nullDefault={4} commit " + |
diff --git a/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/utils/FuzzTestCollections.java b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/utils/FuzzTestCollections.java new file mode 100644 index 00000000..add4ca5d --- /dev/null +++ b/subprojects/store/src/test/java/tools/refinery/store/map/tests/fuzz/utils/FuzzTestCollections.java | |||
@@ -0,0 +1,11 @@ | |||
1 | package tools.refinery.store.map.tests.fuzz.utils; | ||
2 | |||
3 | public final class FuzzTestCollections { | ||
4 | public static final Object[] stepCounts = {FuzzTestUtils.FAST_STEP_COUNT}; | ||
5 | public static final Object[] keyCounts = {3, 32, 32 * 32}; | ||
6 | public static final Object[] valueCounts = {2, 3}; | ||
7 | public static final Object[] nullDefaultOptions = {false, true}; | ||
8 | public static final Object[] commitFrequencyOptions = {1, 10, 100}; | ||
9 | public static final Object[] randomSeedOptions = {1, 2, 3}; | ||
10 | public static final Object[] evilHashOptions = {false, true}; | ||
11 | } | ||