-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ gen ] Add an associative binary composition fun merging alternatives
- Loading branch information
Showing
12 changed files
with
133 additions
and
2 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
35 changes: 35 additions & 0 deletions
35
tests/lib/distribution/with-alts-deep-001/CheckDistribution.idr
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,35 @@ | ||
module CheckDistribution | ||
|
||
import Data.Either | ||
|
||
import DistrCheckCommon | ||
|
||
%default total | ||
|
||
g1 : Gen NonEmpty Nat | ||
g1 = oneOf | ||
[ elements [0, 1, 2, 3] | ||
, elements [4, 5] | ||
] | ||
|
||
g2 : Gen NonEmpty Nat | ||
g2 = elements [10, 11, 12, 13, 14, 15] | ||
|
||
g12 : Gen NonEmpty Nat | ||
g12 = withDeepAlts 2 g1 g2 | ||
|
||
main : IO () | ||
main = printVerdict g12 | ||
[ coverWith 8.3.percent (== 0) | ||
, coverWith 8.3.percent (== 1) | ||
, coverWith 8.3.percent (== 2) | ||
, coverWith 8.3.percent (== 3) | ||
, coverWith 8.3.percent (== 4) | ||
, coverWith 8.3.percent (== 5) | ||
, coverWith 8.3.percent (== 10) | ||
, coverWith 8.3.percent (== 11) | ||
, coverWith 8.3.percent (== 12) | ||
, coverWith 8.3.percent (== 13) | ||
, coverWith 8.3.percent (== 14) | ||
, coverWith 8.3.percent (== 15) | ||
] |
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 @@ | ||
../_common/DistrCheckCommon.idr |
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 @@ | ||
Just [ok, ok, ok, ok, ok, ok, ok, ok, ok, ok, ok, ok] |
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 @@ | ||
../_common/run |
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 @@ | ||
../_common/test.ipkg |
37 changes: 37 additions & 0 deletions
37
tests/lib/distribution/with-alts-shallow-001/CheckDistribution.idr
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,37 @@ | ||
module CheckDistribution | ||
|
||
import Data.Either | ||
|
||
import DistrCheckCommon | ||
|
||
%default total | ||
|
||
g1 : Gen NonEmpty Nat | ||
g1 = oneOf | ||
[ elements [0, 1, 2, 3] | ||
, elements [4, 5] | ||
] | ||
|
||
g2 : Gen NonEmpty Nat | ||
g2 = elements [10, 11, 12, 13, 14, 15] | ||
|
||
g12 : Gen NonEmpty Nat | ||
g12 = g1 `withAlts` g2 | ||
|
||
main : IO () | ||
main = printVerdict g12 | ||
[ coverWith 3.125.percent (== 0) | ||
, coverWith 3.125.percent (== 1) | ||
, coverWith 3.125.percent (== 2) | ||
, coverWith 3.125.percent (== 3) | ||
|
||
, coverWith 6.25.percent (== 4) | ||
, coverWith 6.25.percent (== 5) | ||
|
||
, coverWith 12.5.percent (== 10) | ||
, coverWith 12.5.percent (== 11) | ||
, coverWith 12.5.percent (== 12) | ||
, coverWith 12.5.percent (== 13) | ||
, coverWith 12.5.percent (== 14) | ||
, coverWith 12.5.percent (== 15) | ||
] |
1 change: 1 addition & 0 deletions
1
tests/lib/distribution/with-alts-shallow-001/DistrCheckCommon.idr
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 @@ | ||
../_common/DistrCheckCommon.idr |
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 @@ | ||
Just [ok, ok, ok, ok, ok, ok, ok, ok, ok, ok, ok, ok] |
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 @@ | ||
../_common/run |
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 @@ | ||
../_common/test.ipkg |