diff --git a/js/strudel.mjs b/js/strudel.mjs index 39ed2c6d..c9d0344c 100644 --- a/js/strudel.mjs +++ b/js/strudel.mjs @@ -148,7 +148,7 @@ class Pattern { - split_queries() { + splitQueries() { // Splits queries at cycle boundaries. This makes some calculations // easier to express, as all events are then constrained to happen within // a cycle. diff --git a/test/pattern.test.mjs b/test/pattern.test.mjs index babb7c35..5cd8e88d 100644 --- a/test/pattern.test.mjs +++ b/test/pattern.test.mjs @@ -1,9 +1,8 @@ - -import 'fraction.js'; +import Fraction from 'fraction.js' import { strict as assert } from 'assert'; -import {TimeSpan, Hap} from "../js/strudel.mjs"; +import {TimeSpan, Hap, Pattern, pure} from "../js/strudel.mjs"; describe('TimeSpan', function() { describe('equal()', function() { @@ -11,6 +10,11 @@ describe('TimeSpan', function() { assert.equal((new TimeSpan(0,4)).equals(new TimeSpan(0,4)), true); }); }); + describe('splitCycles', function() { + it('Should split two cycles into two', function() { + assert.equal(new TimeSpan(Fraction(0),Fraction(2)).spanCycles.length, 2) + }) + }) }); describe('Hap', function() { @@ -20,4 +24,11 @@ describe('Hap', function() { }); }); }); - \ No newline at end of file + +describe('Pattern', function() { + describe('pure', function () { + it('Can make a pattern', function() { + assert.equal(pure("hello").query(new TimeSpan(Fraction(0.5), Fraction(2.5))).length, 3) + }) + }) +}) \ No newline at end of file