2017-02-20 21:40:41 +00:00
|
|
|
define(["helper/ConstantOutput", "helper/Basic", "Tone/signal/GreaterThanZero", "Tone/signal/Signal", "helper/Supports"],
|
|
|
|
function (ConstantOutput, Basic, GreaterThanZero, Signal, Supports) {
|
2015-08-24 21:29:19 +00:00
|
|
|
|
|
|
|
describe("GreaterThanZero", function(){
|
|
|
|
|
|
|
|
Basic(GreaterThanZero);
|
|
|
|
|
|
|
|
describe("Comparison", function(){
|
|
|
|
|
2017-02-20 21:40:41 +00:00
|
|
|
it("Outputs 0 when the value is less than 0", function(){
|
|
|
|
return ConstantOutput(function(){
|
|
|
|
var signal = new Signal(-1);
|
|
|
|
var gtz = new GreaterThanZero();
|
2015-08-24 21:29:19 +00:00
|
|
|
signal.connect(gtz);
|
2017-02-20 21:40:41 +00:00
|
|
|
gtz.toMaster();
|
|
|
|
}, 0);
|
2015-08-24 21:29:19 +00:00
|
|
|
});
|
|
|
|
|
2017-02-20 21:40:41 +00:00
|
|
|
it("Outputs 1 when the value is greater than 0", function(){
|
|
|
|
return ConstantOutput(function(){
|
|
|
|
var signal = new Signal(1);
|
|
|
|
var gtz = new GreaterThanZero();
|
2015-08-24 21:29:19 +00:00
|
|
|
signal.connect(gtz);
|
2017-02-20 21:40:41 +00:00
|
|
|
gtz.toMaster();
|
|
|
|
}, 1);
|
2015-08-24 21:29:19 +00:00
|
|
|
});
|
|
|
|
|
2016-03-16 17:13:32 +00:00
|
|
|
if (Supports.WAVESHAPER_0_POSITION){
|
|
|
|
|
2017-02-20 21:40:41 +00:00
|
|
|
it("Outputs 0 when the value is equal to 0", function(){
|
|
|
|
return ConstantOutput(function(){
|
|
|
|
var signal = new Signal(0);
|
|
|
|
var gtz = new GreaterThanZero();
|
2016-03-16 17:13:32 +00:00
|
|
|
signal.connect(gtz);
|
2017-02-20 21:40:41 +00:00
|
|
|
gtz.toMaster();
|
|
|
|
}, 0);
|
2015-08-24 21:29:19 +00:00
|
|
|
});
|
2016-03-16 17:13:32 +00:00
|
|
|
}
|
2015-08-24 21:29:19 +00:00
|
|
|
|
2017-02-20 21:40:41 +00:00
|
|
|
it("Outputs 1 when the value is slightly above 0", function(){
|
|
|
|
return ConstantOutput(function(){
|
|
|
|
var signal = new Signal(0.001);
|
|
|
|
var gtz = new GreaterThanZero();
|
2015-08-24 21:29:19 +00:00
|
|
|
signal.connect(gtz);
|
2017-02-20 21:40:41 +00:00
|
|
|
gtz.toMaster();
|
|
|
|
}, 1);
|
2015-08-24 21:29:19 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|