37 lines
849 B
TypeScript
37 lines
849 B
TypeScript
import { partition, MaterialRange } from "./range.ts";
|
|
import { assertEquals } from "https://deno.land/std@0.212.0/assert/mod.ts";
|
|
|
|
Deno.test("partition", () => {
|
|
const mRange = {
|
|
x: [0, 10],
|
|
m: [0, 10],
|
|
a: [0, 10],
|
|
s: [0, 10],
|
|
} satisfies MaterialRange;
|
|
|
|
assertEquals(partition({
|
|
quality: "x",
|
|
cond: "<",
|
|
value: 5,
|
|
}, mRange),
|
|
[
|
|
{
|
|
x: [5, 10], m: [0, 10], a: [0, 10], s: [0, 10]
|
|
},
|
|
{
|
|
x: [0, 4], m: [0, 10], a: [0, 10], s: [0, 10]
|
|
},
|
|
]);
|
|
assertEquals(partition({
|
|
quality: "x",
|
|
cond: "<",
|
|
value: 11,
|
|
}, mRange),
|
|
mRange);
|
|
assertEquals(partition({
|
|
quality: "x",
|
|
cond: "<",
|
|
value: 0,
|
|
}, mRange),
|
|
null);
|
|
}); |