Tone.js/test/signal/Negate.js

59 lines
1.4 KiB
JavaScript
Raw Normal View History

2015-08-24 21:29:19 +00:00
define(["helper/Offline", "Tone/signal/Negate", "helper/Basic",
2015-08-24 15:17:21 +00:00
"Test", "Tone/source/Oscillator", "Tone/signal/Signal"],
2015-08-24 21:29:19 +00:00
function (Offline, Negate, Basic, Test, Oscillator, Signal) {
2015-08-24 15:17:21 +00:00
2015-08-24 21:29:19 +00:00
describe("Negate", function(){
2015-08-24 15:17:21 +00:00
2015-08-24 21:29:19 +00:00
Basic(Negate);
2015-08-24 15:17:21 +00:00
2015-08-24 21:29:19 +00:00
context("Negating", function(){
2015-08-24 15:17:21 +00:00
2015-08-24 21:29:19 +00:00
it("handles input and output connections", function(){
var negate = new Negate();
Test.connect(negate);
negate.connect(Test);
negate.dispose();
});
it("negateates a positive value", function(done){
var signal, negate;
var offline = new Offline();
offline.before(function(dest){
signal = new Signal(1);
negate = new Negate();
signal.connect(negate);
negate.connect(dest);
});
offline.test(function(sample){
expect(sample).to.equal(-1);
});
offline.after(function(){
signal.dispose();
negate.dispose();
done();
});
offline.run();
});
it("makes a negateative value positive", function(done){
var signal, negate;
var offline = new Offline();
offline.before(function(dest){
signal = new Signal(-10);
negate = new Negate();
signal.connect(negate);
negate.connect(dest);
});
offline.test(function(sample){
expect(sample).to.equal(10);
});
offline.after(function(){
signal.dispose();
negate.dispose();
done();
});
offline.run();
});
2015-08-24 15:17:21 +00:00
});
});
});