-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ test ] Add bigger tests for sorted trees
- Loading branch information
Showing
16 changed files
with
544 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
examples/sorted-tree-indexed/tests/gens/sorted-big/Main.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,20 @@ | ||
import Data.SortedBinTree.Gen | ||
import Data.Fuel | ||
import Data.List | ||
import Data.List.Lazy | ||
import Data.Primitives.Interpolation | ||
|
||
import System.Random.Pure.StdGen | ||
|
||
%default total | ||
|
||
main : IO () | ||
main = do | ||
let vals = unGenTryN 10 someStdGen $ genSortedBinTree1 $ limit 5 | ||
Lazy.for_ vals $ \(mi ** ma ** tree) => do | ||
putStrLn "--------------" | ||
let list = toList tree | ||
putStrLn "min: \{mi}, max: \{ma}, length: \{length list}" | ||
putStrLn "tree:\n\{tree}" | ||
putStrLn "as list: \{show list}" | ||
putStrLn "sorted: \{show $ sorted list}" |
196 changes: 196 additions & 0 deletions
196
examples/sorted-tree-indexed/tests/gens/sorted-big/expected
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,196 @@ | ||
-------------- | ||
min: 0, max: 9, length: 5 | ||
tree: | ||
. | ||
| | ||
|- 0 | ||
| | ||
|- . | ||
| | ||
|- . | ||
| | | ||
| |- . | ||
| | | | ||
| | |- 1 | ||
| | | | ||
| | |- 2 | ||
| | | ||
| |- 3 | ||
| | ||
|- 9 | ||
as list: [0, 1, 2, 3, 9] | ||
sorted: True | ||
-------------- | ||
min: 3, max: 7, length: 3 | ||
tree: | ||
. | ||
| | ||
|- . | ||
| | | ||
| |- 3 | ||
| | | ||
| |- 4 | ||
| | ||
|- 7 | ||
as list: [3, 4, 7] | ||
sorted: True | ||
-------------- | ||
min: 0, max: 6, length: 4 | ||
tree: | ||
. | ||
| | ||
|- . | ||
| | | ||
| |- . | ||
| | | | ||
| | |- 0 | ||
| | | | ||
| | |- 1 | ||
| | | ||
| |- 2 | ||
| | ||
|- 6 | ||
as list: [0, 1, 2, 6] | ||
sorted: True | ||
-------------- | ||
min: 3, max: 6, length: 3 | ||
tree: | ||
. | ||
| | ||
|- . | ||
| | | ||
| |- 3 | ||
| | | ||
| |- 4 | ||
| | ||
|- 6 | ||
as list: [3, 4, 6] | ||
sorted: True | ||
-------------- | ||
min: 0, max: 7, length: 5 | ||
tree: | ||
. | ||
| | ||
|- . | ||
| | | ||
| |- 0 | ||
| | | ||
| |- 1 | ||
| | ||
|- . | ||
| | ||
|- . | ||
| | | ||
| |- 3 | ||
| | | ||
| |- 4 | ||
| | ||
|- 7 | ||
as list: [0, 1, 3, 4, 7] | ||
sorted: True | ||
-------------- | ||
min: 0, max: 9, length: 6 | ||
tree: | ||
. | ||
| | ||
|- . | ||
| | | ||
| |- . | ||
| | | | ||
| | |- 0 | ||
| | | | ||
| | |- 1 | ||
| | | ||
| |- . | ||
| | | ||
| |- . | ||
| | | | ||
| | |- 2 | ||
| | | | ||
| | |- 3 | ||
| | | ||
| |- 4 | ||
| | ||
|- 9 | ||
as list: [0, 1, 2, 3, 4, 9] | ||
sorted: True | ||
-------------- | ||
min: 0, max: 6, length: 4 | ||
tree: | ||
. | ||
| | ||
|- . | ||
| | | ||
| |- 0 | ||
| | | ||
| |- 1 | ||
| | ||
|- . | ||
| | ||
|- 2 | ||
| | ||
|- 6 | ||
as list: [0, 1, 2, 6] | ||
sorted: True | ||
-------------- | ||
min: 0, max: 9, length: 5 | ||
tree: | ||
. | ||
| | ||
|- . | ||
| | | ||
| |- . | ||
| | | | ||
| | |- . | ||
| | | | | ||
| | | |- 0 | ||
| | | | | ||
| | | |- 1 | ||
| | | | ||
| | |- 2 | ||
| | | ||
| |- 4 | ||
| | ||
|- 9 | ||
as list: [0, 1, 2, 4, 9] | ||
sorted: True | ||
-------------- | ||
min: 0, max: 7, length: 4 | ||
tree: | ||
. | ||
| | ||
|- . | ||
| | | ||
| |- . | ||
| | | | ||
| | |- 0 | ||
| | | | ||
| | |- 1 | ||
| | | ||
| |- 4 | ||
| | ||
|- 7 | ||
as list: [0, 1, 4, 7] | ||
sorted: True | ||
-------------- | ||
min: 0, max: 9, length: 5 | ||
tree: | ||
. | ||
| | ||
|- . | ||
| | | ||
| |- . | ||
| | | | ||
| | |- . | ||
| | | | | ||
| | | |- 0 | ||
| | | | | ||
| | | |- 1 | ||
| | | | ||
| | |- 2 | ||
| | | ||
| |- 4 | ||
| | ||
|- 9 | ||
as list: [0, 1, 2, 4, 9] | ||
sorted: True |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions
6
examples/sorted-tree-indexed/tests/gens/sorted-small/test.ipkg
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,6 @@ | ||
package a-test | ||
|
||
depends = sorted-tree-indexed | ||
|
||
executable = a-test | ||
main = Main |
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,20 @@ | ||
import Data.SortedBinTree.Gen | ||
import Data.Fuel | ||
import Data.List | ||
import Data.List.Lazy | ||
import Data.Primitives.Interpolation | ||
|
||
import System.Random.Pure.StdGen | ||
|
||
%default total | ||
|
||
main : IO () | ||
main = do | ||
let vals = unGenTryN 10 someStdGen $ genSortedBinTree $ limit 7 | ||
Lazy.for_ vals $ \tree => do | ||
putStrLn "--------------" | ||
let list = toList tree | ||
putStrLn "length: \{length list}" | ||
putStrLn "tree:\n\{tree}" | ||
putStrLn "as list: \{show list}" | ||
putStrLn "sorted: \{show $ sorted list}" |
Oops, something went wrong.