Tone.js/test/signal/Pow.js

48 lines
1.1 KiB
JavaScript
Raw Normal View History

2017-02-20 21:40:41 +00:00
define(["helper/ConstantOutput", "Tone/signal/Pow", "helper/Basic",
2015-08-24 21:29:19 +00:00
"Test", "Tone/signal/Signal"],
2017-12-30 16:26:29 +00:00
function (ConstantOutput, Pow, Basic, Test, Signal) {
2015-08-24 21:29:19 +00:00
describe("Pow", function(){
Basic(Pow);
context("Exponential Scaling", function(){
it("handles input and output connections", function(){
var pow = new Pow();
Test.connect(pow);
pow.connect(Test);
pow.dispose();
});
2017-02-20 21:40:41 +00:00
it("can do powers of 2", function(){
return ConstantOutput(function(){
var signal = new Signal(0.3);
var pow = new Pow(2);
2015-08-24 21:29:19 +00:00
signal.connect(pow);
2017-02-20 21:40:41 +00:00
pow.toMaster();
}, 0.09);
2015-08-24 21:29:19 +00:00
});
2017-02-20 21:40:41 +00:00
it("can compute negative values and powers less than 1", function(){
return ConstantOutput(function(){
var signal = new Signal(-0.49);
var pow = new Pow(0.5);
2015-08-24 21:29:19 +00:00
signal.connect(pow);
2017-02-20 21:40:41 +00:00
pow.toMaster();
}, 0.7);
2015-08-24 21:29:19 +00:00
});
2017-02-20 21:40:41 +00:00
it("can set a new exponent", function(){
return ConstantOutput(function(){
var signal = new Signal(0.5);
var pow = new Pow(1);
2015-08-24 21:29:19 +00:00
pow.value = 3;
signal.connect(pow);
2017-02-20 21:40:41 +00:00
pow.toMaster();
}, 0.125);
2015-08-24 21:29:19 +00:00
});
});
});
2017-12-30 16:26:29 +00:00
});