Rework binary to binaryN

This commit is contained in:
Luke Heerman 2024-10-10 14:41:37 -04:00
parent 947b263b9c
commit 34f4afad01
3 changed files with 18 additions and 14 deletions

View file

@ -46,7 +46,7 @@ import {
rev,
time,
run,
binary,
binaryN,
pick,
stackLeft,
stackRight,
@ -959,15 +959,15 @@ describe('Pattern', () => {
expect(run(4).firstCycle()).toStrictEqual(sequence(0, 1, 2, 3).firstCycle());
});
});
describe('binary', () => {
describe('binaryN', () => {
it('Can make a binary pattern from a decimal', () => {
expect(binary(55532).firstCycle()).toStrictEqual(
expect(binaryN(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(),
it('Can make a binary pattern from patterned inputs', () => {
expect(binaryN(pure(0x1337), pure(14)).firstCycle()).toStrictEqual(
sequence(0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1).firstCycle(),
);
});
});