test file for core
This commit is contained in:
parent
e718fbfe80
commit
8a7d8ec24c
18
tests/core.test.js
Normal file
18
tests/core.test.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { describe, expect, test } from "vitest";
|
||||||
|
import { evolve1d, create1dStateOneCell } from "src/modules/core.js";
|
||||||
|
import { presetRuleset } from "src/modules/preset.js";
|
||||||
|
|
||||||
|
describe("Core", () => {
|
||||||
|
test("evolve1d, rules73, 9 cells", () => {
|
||||||
|
const state = [0, 0, 0, 0, 1, 0, 0, 0, 0];
|
||||||
|
const got = evolve1d(state, presetRuleset[0].rules);
|
||||||
|
const valid = [1, 1, 1, 0, 0, 0, 1, 1, 1];
|
||||||
|
expect(got.length).toBe(state.length);
|
||||||
|
expect(got).toEqual(valid);
|
||||||
|
}),
|
||||||
|
test("create1dStateOneCell, 49 cells", () => {
|
||||||
|
const got = create1dStateOneCell(49);
|
||||||
|
expect(got.length).toBe(49);
|
||||||
|
expect(got[24]).toBe(1);
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user