Tone.js/test/signal/NOT.js
2015-08-24 17:29:19 -04:00

51 lines
No EOL
1.1 KiB
JavaScript

define(["helper/Offline", "helper/Basic", "Tone/signal/NOT", "Tone/signal/Signal"],
function (Offline, Basic, NOT, Signal) {
describe("NOT", function(){
Basic(NOT);
describe("Logic", function(){
it("outputs 0 when the input is 1", function(done){
var signal, not;
var offline = new Offline();
offline.before(function(dest){
signal = new Signal(1);
not = new NOT();
signal.connect(not);
not.connect(dest);
});
offline.test(function(sample){
expect(sample).to.equal(0);
});
offline.after(function(){
signal.dispose();
not.dispose();
done();
});
offline.run();
});
it("outputs 1 when the input is 0", function(done){
var signal, not;
var offline = new Offline();
offline.before(function(dest){
signal = new Signal(0);
not = new NOT();
signal.connect(not);
not.connect(dest);
});
offline.test(function(sample){
expect(sample).to.equal(1);
});
offline.after(function(){
signal.dispose();
not.dispose();
done();
});
offline.run();
});
});
});
});