-
Notifications
You must be signed in to change notification settings - Fork 7
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
584 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 10 | ||
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}" |
324 changes: 324 additions & 0 deletions
324
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,324 @@ | ||
-------------- | ||
min: 4, max: 12, length: 5 | ||
tree: | ||
. | ||
| | ||
|- . | ||
| | | ||
| |- . | ||
| | | | ||
| | |- . | ||
| | | | | ||
| | | |- 4 | ||
| | | | | ||
| | | |- 7 | ||
| | | | ||
| | |- 8 | ||
| | | ||
| |- 9 | ||
| | ||
|- 12 | ||
as list: [4, 7, 8, 9, 12] | ||
sorted: True | ||
-------------- | ||
min: 4, max: 11, length: 6 | ||
tree: | ||
. | ||
| | ||
|- . | ||
| | | ||
| |- . | ||
| | | | ||
| | |- . | ||
| | | | | ||
| | | |- 4 | ||
| | | | | ||
| | | |- . | ||
| | | | | ||
| | | |- 6 | ||
| | | | | ||
| | | |- 7 | ||
| | | | ||
| | |- 8 | ||
| | | ||
| |- 9 | ||
| | ||
|- 11 | ||
as list: [4, 6, 7, 8, 9, 11] | ||
sorted: True | ||
-------------- | ||
min: 5, max: 15, length: 6 | ||
tree: | ||
. | ||
| | ||
|- . | ||
| | | ||
| |- . | ||
| | | | ||
| | |- . | ||
| | | | | ||
| | | |- . | ||
| | | | | | ||
| | | | |- 5 | ||
| | | | | | ||
| | | | |- 6 | ||
| | | | | ||
| | | |- 7 | ||
| | | | ||
| | |- 8 | ||
| | | ||
| |- 9 | ||
| | ||
|- 15 | ||
as list: [5, 6, 7, 8, 9, 15] | ||
sorted: True | ||
-------------- | ||
min: 3, max: 19, length: 4 | ||
tree: | ||
. | ||
| | ||
|- 3 | ||
| | ||
|- . | ||
| | ||
|- . | ||
| | | ||
| |- 8 | ||
| | | ||
| |- 9 | ||
| | ||
|- 19 | ||
as list: [3, 8, 9, 19] | ||
sorted: True | ||
-------------- | ||
min: 3, max: 17, length: 8 | ||
tree: | ||
. | ||
| | ||
|- . | ||
| | | ||
| |- . | ||
| | | | ||
| | |- . | ||
| | | | | ||
| | | |- . | ||
| | | | | | ||
| | | | |- . | ||
| | | | | | | ||
| | | | | |- . | ||
| | | | | | | | ||
| | | | | | |- 3 | ||
| | | | | | | | ||
| | | | | | |- 4 | ||
| | | | | | | ||
| | | | | |- 5 | ||
| | | | | | ||
| | | | |- 6 | ||
| | | | | ||
| | | |- 7 | ||
| | | | ||
| | |- 8 | ||
| | | ||
| |- 9 | ||
| | ||
|- 17 | ||
as list: [3, 4, 5, 6, 7, 8, 9, 17] | ||
sorted: True | ||
-------------- | ||
min: 0, max: 14, length: 9 | ||
tree: | ||
. | ||
| | ||
|- . | ||
| | | ||
| |- . | ||
| | | | ||
| | |- . | ||
| | | | | ||
| | | |- . | ||
| | | | | | ||
| | | | |- . | ||
| | | | | | | ||
| | | | | |- . | ||
| | | | | | | | ||
| | | | | | |- . | ||
| | | | | | | | | ||
| | | | | | | |- 0 | ||
| | | | | | | | | ||
| | | | | | | |- 3 | ||
| | | | | | | | ||
| | | | | | |- 4 | ||
| | | | | | | ||
| | | | | |- 5 | ||
| | | | | | ||
| | | | |- 6 | ||
| | | | | ||
| | | |- 7 | ||
| | | | ||
| | |- 8 | ||
| | | ||
| |- 9 | ||
| | ||
|- 14 | ||
as list: [0, 3, 4, 5, 6, 7, 8, 9, 14] | ||
sorted: True | ||
-------------- | ||
min: 0, max: 12, length: 11 | ||
tree: | ||
. | ||
| | ||
|- . | ||
| | | ||
| |- . | ||
| | | | ||
| | |- . | ||
| | | | | ||
| | | |- . | ||
| | | | | | ||
| | | | |- . | ||
| | | | | | | ||
| | | | | |- . | ||
| | | | | | | | ||
| | | | | | |- . | ||
| | | | | | | | | ||
| | | | | | | |- . | ||
| | | | | | | | | | ||
| | | | | | | | |- . | ||
| | | | | | | | | | | ||
| | | | | | | | | |- 0 | ||
| | | | | | | | | | | ||
| | | | | | | | | |- 1 | ||
| | | | | | | | | | ||
| | | | | | | | |- 2 | ||
| | | | | | | | | ||
| | | | | | | |- 3 | ||
| | | | | | | | ||
| | | | | | |- 4 | ||
| | | | | | | ||
| | | | | |- 5 | ||
| | | | | | ||
| | | | |- 6 | ||
| | | | | ||
| | | |- 7 | ||
| | | | ||
| | |- 8 | ||
| | | ||
| |- 9 | ||
| | ||
|- 12 | ||
as list: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 12] | ||
sorted: True | ||
-------------- | ||
min: 0, max: 12, length: 11 | ||
tree: | ||
. | ||
| | ||
|- . | ||
| | | ||
| |- . | ||
| | | | ||
| | |- . | ||
| | | | | ||
| | | |- . | ||
| | | | | | ||
| | | | |- . | ||
| | | | | | | ||
| | | | | |- . | ||
| | | | | | | | ||
| | | | | | |- . | ||
| | | | | | | | | ||
| | | | | | | |- . | ||
| | | | | | | | | | ||
| | | | | | | | |- . | ||
| | | | | | | | | | | ||
| | | | | | | | | |- 0 | ||
| | | | | | | | | | | ||
| | | | | | | | | |- 1 | ||
| | | | | | | | | | ||
| | | | | | | | |- 2 | ||
| | | | | | | | | ||
| | | | | | | |- 3 | ||
| | | | | | | | ||
| | | | | | |- 4 | ||
| | | | | | | ||
| | | | | |- 5 | ||
| | | | | | ||
| | | | |- 6 | ||
| | | | | ||
| | | |- 7 | ||
| | | | ||
| | |- 8 | ||
| | | ||
| |- 9 | ||
| | ||
|- 12 | ||
as list: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 12] | ||
sorted: True | ||
-------------- | ||
min: 1, max: 17, length: 10 | ||
tree: | ||
. | ||
| | ||
|- . | ||
| | | ||
| |- . | ||
| | | | ||
| | |- . | ||
| | | | | ||
| | | |- . | ||
| | | | | | ||
| | | | |- . | ||
| | | | | | | ||
| | | | | |- . | ||
| | | | | | | | ||
| | | | | | |- . | ||
| | | | | | | | | ||
| | | | | | | |- . | ||
| | | | | | | | | | ||
| | | | | | | | |- 1 | ||
| | | | | | | | | | ||
| | | | | | | | |- 2 | ||
| | | | | | | | | ||
| | | | | | | |- 3 | ||
| | | | | | | | ||
| | | | | | |- 4 | ||
| | | | | | | ||
| | | | | |- 5 | ||
| | | | | | ||
| | | | |- 6 | ||
| | | | | ||
| | | |- 7 | ||
| | | | ||
| | |- 8 | ||
| | | ||
| |- 9 | ||
| | ||
|- 17 | ||
as list: [1, 2, 3, 4, 5, 6, 7, 8, 9, 17] | ||
sorted: True | ||
-------------- | ||
min: 5, max: 18, length: 6 | ||
tree: | ||
. | ||
| | ||
|- . | ||
| | | ||
| |- . | ||
| | | | ||
| | |- . | ||
| | | | | ||
| | | |- . | ||
| | | | | | ||
| | | | |- 5 | ||
| | | | | | ||
| | | | |- 6 | ||
| | | | | ||
| | | |- 7 | ||
| | | | ||
| | |- 8 | ||
| | | ||
| |- 9 | ||
| | ||
|- 18 | ||
as list: [5, 6, 7, 8, 9, 18] | ||
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 |
File renamed without changes.
File renamed without changes.
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 @@ | ||
rm -rf build | ||
|
||
flock "$1" pack -q install-deps test.ipkg && \ | ||
pack run test.ipkg | ||
|
||
rm -rf build |
File renamed without changes.
20 changes: 20 additions & 0 deletions
20
examples/sorted-tree-naive/tests/gens/sorted-small/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 $ genSortedBinTree $ limit 5 | ||
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.