Move everything to root

This commit is contained in:
MindfulMinun committed 2022-06-26 11:35:57 -05:00
1 parent 9d7f83f838
commit 09c5774dea
6 files changed

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
import {
choose, fill, range, removeFromArraybyIndexes, shuffle, swap, once
} from "../iterable.ts"
import { assertThrows, assertEquals, assert } from "https://deno.land/[email protected]/testing/asserts.ts"
Deno.test("choose: throw on empty array", () => {
assertThrows(() => choose([]))
})
Deno.test("fill, yield the same value every time", () => {
const count = 50_000
const item = "hi"
let i = 0
for (const el of fill(item, count)) {
assertEquals(el, item)
i++
}
assertEquals(i, count)
})
Deno.test("range: one arg", () => {
const iter = range(50_000)
for (let i = 0; i < 50_000; i++) {
const next = iter.next()
assertEquals(next.value, i)
}
assert(iter.next().done)
})
Deno.test("range: two args", () => {
const iter = range(50_000)
for (let i = 0; i < 50_000; i++) {
const next = iter.next()
assertEquals(next.value, i)
}
assert(iter.next().done)
})