From 947b263b9ccccf10279cfe31746c7f69b5a48e42 Mon Sep 17 00:00:00 2001 From: Luke Heerman <43624284+heerman@users.noreply.github.com> Date: Thu, 10 Oct 2024 14:40:29 -0400 Subject: [PATCH] Add tests --- packages/core/test/pattern.test.mjs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/core/test/pattern.test.mjs b/packages/core/test/pattern.test.mjs index 31ec4868..03f2c60f 100644 --- a/packages/core/test/pattern.test.mjs +++ b/packages/core/test/pattern.test.mjs @@ -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(