Skip to content

Commit b77a221

Browse files
committed
chore: update tests to use the sampler
After adding @DictionaryProvider to IntegralMutatorFactory, the selection of mutation functions now does an addition step that runs through weightedSampler, that selects whether to stay in the selection or do an additional step and select the alias.
1 parent 1c3fa67 commit b77a221

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

src/test/java/com/code_intelligence/jazzer/mutation/mutator/aggregate/RecordMutatorTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ void testSimpleTypesRecord() {
7474
// Mutate second component, in range operation, return 23
7575
1,
7676
2,
77+
0.1, // sampler: we stay in the second function: direct value in range
7778
23L)) {
7879
SimpleTypesRecord inited = mutator.init(prng);
7980
assertThat(inited).isNotNull();

src/test/java/com/code_intelligence/jazzer/mutation/mutator/collection/ArrayMutatorTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ void testChangeSingleElement() {
210210
// mutation choice based on `IntegralMutatorFactory`
211211
// 2 == closedRange
212212
2,
213+
0.1, // sampler: we stay in the closed range mutation
213214
// value
214215
55L)) {
215216
arr = mutator.mutate(arr, prng);

src/test/java/com/code_intelligence/jazzer/mutation/mutator/collection/ListMutatorTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ void testChangeSingleElement() {
181181
// mutation choice based on `IntegralMutatorFactory`
182182
// 2 == closedRange
183183
2,
184+
0.1, // sampler: stay in closedRange mutation
184185
// value
185186
55L)) {
186187
list = mutator.mutate(list, prng);
@@ -205,10 +206,12 @@ void testChangeChunk() {
205206
5,
206207
// mutation: 0 == bitflip
207208
0,
209+
0.1, // sampler: stay in bitflip mutation
208210
// shift constant
209211
13,
210212
// and again
211213
0,
214+
0.1, // sampler: stay in bitflip mutation
212215
12)) {
213216
list = mutator.mutate(list, prng);
214217
}

src/test/java/com/code_intelligence/jazzer/mutation/mutator/collection/MapMutatorTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,12 @@ void mapMutateValues() {
146146
3,
147147
// uniform pick
148148
2,
149+
0.1, // sampler: stay in uniform pick
149150
// random integer
150151
41L,
151152
// uniform pick
152153
2,
154+
0.1, // sampler: stay in uniform pick
153155
// random integer
154156
51L)) {
155157
map = mutator.mutate(map, prng);
@@ -176,10 +178,12 @@ void mapMutateKeys() {
176178
3,
177179
// uniform pick
178180
2,
181+
0.1, // sampler: stay in uniform pick
179182
// integer
180183
7L,
181184
// uniform pick
182185
2,
186+
0.1, // sampler: stay in uniform pick
183187
// random integer
184188
8L)) {
185189
map = mutator.mutate(map, prng);

0 commit comments

Comments
 (0)