Add tests

This commit is contained in:
Luke Heerman 2024-10-10 14:40:29 -04:00
parent 0a408e464a
commit 947b263b9c

View File

@ -46,6 +46,7 @@ import {
rev,
time,
run,
binary,
pick,
stackLeft,
stackRight,
@ -958,6 +959,18 @@ describe('Pattern', () => {
expect(run(4).firstCycle()).toStrictEqual(sequence(0, 1, 2, 3).firstCycle());
});
});
describe('binary', () => {
it('Can make a binary pattern from a decimal', () => {
expect(binary(55532).firstCycle()).toStrictEqual(
sequence(1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0).firstCycle(),
);
});
it('Can make a binary pattern from a numerical pattern', () => {
expect(binary(pure(0x1337)).firstCycle()).toStrictEqual(
sequence(0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1).firstCycle(),
);
});
});
describe('ribbon', () => {
it('Can ribbon', () => {
expect(cat(0, 1, 2, 3, 4, 5, 6, 7).ribbon(2, 4).fast(4).firstCycle()).toStrictEqual(