Move everything to root
This commit is contained in:
6 files changed
No files matched your search
@@ -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)
|
||||
})
|
||||
Reference in new issue
Block a user