-
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
188 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package examples.docs; | ||
|
||
import net.jqwik.api.*; | ||
import net.jqwik.api.constraints.*; | ||
|
||
import java.math.*; | ||
import java.util.*; | ||
|
||
class StatisticsExamples { | ||
|
||
@Property | ||
void simpleStats(@ForAll RoundingMode mode) { | ||
Statistics.collect(mode); | ||
} | ||
|
||
@Property | ||
void integerStats(@ForAll int anInt) { | ||
Statistics.collect(anInt > 0 ? "positive" : "negative"); | ||
} | ||
|
||
@Property | ||
void combinedIntegerStats(@ForAll int anInt) { | ||
String posOrNeg = anInt > 0 ? "positive" : "negative"; | ||
String evenOrOdd = anInt % 2 == 0 ? "even" : "odd"; | ||
String bigOrSmall = Math.abs(anInt) > 50 ? "big" : "small"; | ||
Statistics.collect(posOrNeg, evenOrOdd, bigOrSmall); | ||
} | ||
|
||
@Property | ||
void twoParameterStats( | ||
@ForAll @Size(min = 1, max = 10) List<Integer> aList, // | ||
@ForAll @IntRange(min = 0, max = 10) int index // | ||
) { | ||
Statistics.collect(aList.size() > index ? "index within size" : null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters