Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -5,18 +5,18 @@ balanced?: func [str][parse str rule]
|
|||
|
||||
; Tests
|
||||
tests: [
|
||||
good: ["" "[]" "[][]" "[[]]" "[[][]]" "[[[[[]]][][[]]]]"]
|
||||
bad: ["[" "]" "][" "[[]" "[]]" "[]][[]" "[[[[[[]]]]]]]"]
|
||||
good: ["" "[]" "[][]" "[[]]" "[[][]]" "[[[[[]]][][[]]]]"]
|
||||
bad: ["[" "]" "][" "[[]" "[]]" "[]][[]" "[[[[[[]]]]]]]"]
|
||||
]
|
||||
|
||||
foreach str tests/good [
|
||||
if not balanced? str [print [mold str "failed!"]]
|
||||
if not balanced? str [print [mold str "failed!"]]
|
||||
]
|
||||
foreach str tests/bad [
|
||||
if balanced? str [print [mold str "failed!"]]
|
||||
if balanced? str [print [mold str "failed!"]]
|
||||
]
|
||||
|
||||
repeat i 10 [
|
||||
str: random copy/part "[][][][][][][][][][]" i * 2
|
||||
print [mold str "is" either balanced? str ["balanced"]["unbalanced"]]
|
||||
str: random copy/part "[][][][][][][][][][]" i * 2
|
||||
print [mold str "is" either balanced? str ["balanced"]["unbalanced"]]
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue