2017-10-26 04:48:51 +00:00
|
|
|
define(["helper/ConstantOutput", "helper/Basic", "Tone/signal/GreaterThanZero", "Tone/signal/Signal"],
|
2017-12-30 16:26:29 +00:00
|
|
|
function (ConstantOutput, Basic, GreaterThanZero, Signal) {
|
2015-08-24 21:29:19 +00:00
|
|
|
|
2017-12-30 16:26:29 +00:00
|
|
|
describe("GreaterThanZero", function(){
|
2015-08-24 21:29:19 +00:00
|
|
|
|
2017-12-30 16:26:29 +00:00
|
|
|
Basic(GreaterThanZero);
|
2015-08-24 21:29:19 +00:00
|
|
|
|
2017-12-30 16:26:29 +00:00
|
|
|
describe("Comparison", function(){
|
2015-08-24 21:29:19 +00:00
|
|
|
|
2017-12-30 16:26:29 +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();
|
|
|
|
signal.connect(gtz);
|
|
|
|
gtz.toMaster();
|
|
|
|
}, 0);
|
|
|
|
});
|
2015-08-24 21:29:19 +00:00
|
|
|
|
2017-12-30 16:26:29 +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();
|
|
|
|
signal.connect(gtz);
|
|
|
|
gtz.toMaster();
|
|
|
|
}, 1);
|
|
|
|
});
|
2015-08-24 21:29:19 +00:00
|
|
|
|
2017-12-30 16:26:29 +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();
|
|
|
|
signal.connect(gtz);
|
|
|
|
gtz.toMaster();
|
|
|
|
}, 0);
|
|
|
|
});
|
2015-08-24 21:29:19 +00:00
|
|
|
|
2017-12-30 16:26:29 +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();
|
|
|
|
signal.connect(gtz);
|
|
|
|
gtz.toMaster();
|
|
|
|
}, 1);
|
|
|
|
});
|
2015-08-24 21:29:19 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|