it string in tests
This commit is contained in:
parent
9366ce61f3
commit
ab5b54413b
|
@ -7,10 +7,14 @@ let makeTest = (~only=false, str, item1, item2) =>
|
|||
: test(str, () => expect(item1)->toEqual(item2))
|
||||
|
||||
describe("Stdlib", () => {
|
||||
makeTest("min", Stdlib.Random.sample([1.0, 2.0], {probs: [0.5, 0.5], size: 10}) |> E.A.length, 10)
|
||||
makeTest(
|
||||
"min",
|
||||
Stdlib.Random.sample([1.0, 2.0], {probs: [0.5, 0.5], size: 10}) |> E.A.uniq |> E.A.Floats.sort,
|
||||
"Length of Random.sample",
|
||||
Stdlib.Random.sample([1.0, 2.0], {probs: [0.5, 0.5], size: 10})->E.A.length,
|
||||
10,
|
||||
)
|
||||
makeTest(
|
||||
"Random.sample returns elements from input array (will fail with very slim probability)",
|
||||
Stdlib.Random.sample([1.0, 2.0], {probs: [0.5, 0.5], size: 10})->E.A.uniq->E.A.Floats.sort,
|
||||
[1.0, 2.0],
|
||||
)
|
||||
})
|
||||
|
|
|
@ -226,6 +226,6 @@ module T = Dist({
|
|||
})
|
||||
|
||||
let sampleN = (t: t, n): array<float> => {
|
||||
let normalized = t |> T.normalize |> getShape
|
||||
let normalized = t->T.normalize->getShape
|
||||
Stdlib.Random.sample(normalized.xs, {probs: normalized.ys, size: n})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user