-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
0a3763d
commit b6b2ce6
Showing
4 changed files
with
49 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import * as Peach from "../../peach.ts/src/mod.ts"; | ||
import * as SubEdit from "./mod.ts"; | ||
import { assertEquals } from "https://deno.land/std@0.171.0/testing/asserts.ts"; | ||
|
||
import { Traversals } from "./traversals.ts"; | ||
|
||
const sampleText = Peach.String.from( | ||
Peach.String.blocks.myanmarExtendedA(Peach.Number.uniform), | ||
Peach.Number.uniform(0, 100), | ||
); | ||
|
||
Deno.test({ | ||
name: "Traversals.union.view: union() == []", | ||
fn() { | ||
const unioned = Traversals.union(); | ||
|
||
for (const tcase of Peach.Array.from(sampleText, 100)()) { | ||
assertEquals(unioned.view(tcase), []); | ||
} | ||
}, | ||
}); | ||
|
||
Deno.test({ | ||
name: "Traversals.union.view: union(traversal) ~ traversal", | ||
fn() { | ||
const traversal = SubEdit.EachMatch(/.{3}/gd); | ||
const unioned = Traversals.union(traversal); | ||
|
||
for (const tcase of Peach.Array.from(sampleText, 100)()) { | ||
assertEquals(unioned.view(tcase), traversal.view(tcase)); | ||
} | ||
}, | ||
}); | ||
|
||
Deno.test({ | ||
name: | ||
"Traversals.union.view: union(traversal, traversal) ~ traversal + traversal", | ||
fn() { | ||
const traversal = SubEdit.EachMatch(/.{3}/gd); | ||
const unioned = Traversals.union(traversal, traversal); | ||
|
||
for (const tcase of Peach.Array.from(sampleText, 100)()) { | ||
assertEquals( | ||
unioned.view(tcase), | ||
traversal.view(tcase).concat(traversal.view(tcase)), | ||
); | ||
} | ||
}, | ||
}); |
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