Tone.js/test/signal/Modulo.js

49 lines
1.1 KiB
JavaScript
Raw Normal View History

2017-02-20 21:40:41 +00:00
define(["helper/ConstantOutput", "Tone/signal/Modulo", "helper/Basic",
2018-05-18 16:07:20 +00:00
"helper/Test", "Tone/signal/Signal"],
function(ConstantOutput, Modulo, Basic, Test, Signal){
2015-08-24 21:29:19 +00:00
describe("Modulo", function(){
Basic(Modulo);
context("Exponential Scaling", function(){
it("handles input and output connections", function(){
var mod = new Modulo();
Test.connect(mod);
mod.connect(Test);
mod.dispose();
});
2017-02-20 21:40:41 +00:00
it("can evaluate 0.45 % 0.3", function(){
return ConstantOutput(function(){
var signal = new Signal(0.45);
var mod = new Modulo(0.3);
2015-08-24 21:29:19 +00:00
signal.connect(mod);
2017-02-20 21:40:41 +00:00
mod.toMaster();
}, 0.15);
2015-08-24 21:29:19 +00:00
});
2017-02-20 21:40:41 +00:00
it("can evaluate 0.1 % 0.2", function(){
return ConstantOutput(function(){
var signal = new Signal(0.1);
var mod = new Modulo(0.2);
2015-08-24 21:29:19 +00:00
signal.connect(mod);
2017-02-20 21:40:41 +00:00
mod.toMaster();
}, 0.1);
2015-08-24 21:29:19 +00:00
});
2017-02-20 21:40:41 +00:00
it("can set a new modulo value", function(){
return ConstantOutput(function(){
var signal = new Signal(0.4);
var mod = new Modulo(0.1);
2015-08-24 21:29:19 +00:00
mod.value = 0.35;
expect(mod.value).to.be.closeTo(0.35, 0.001);
signal.connect(mod);
2017-02-20 21:40:41 +00:00
mod.toMaster();
}, 0.05);
2015-08-24 21:29:19 +00:00
});
});
});
2017-12-30 16:26:29 +00:00
});