<commit_before>var assert = chai.assert;

var audioContext = new webkitAudioContext();

describe("Load some sounds: synth.wav and sound.wav", function() {
  var self = this;

  var myAudioBuffers = [{ //synth.wav
    duration: 1.7874829931972789,
    gain: 1,
    length: 78828,
    numberOfChannels: 1,
    sampleRate: 44100
  }, { //sound.wav
    duration: 3.633605442176871, 
    gain: 1,
    length: 160242,
    numberOfChannels: 2,
    sampleRate: 44100
  }];

  var myTimeout = 200000;

  it('My sound was loaded with "load"', function(done) {
    this.timeout(myTimeout);
    bufferLoader.load('../node_modules/snd-dep/sound.wav', function(audioBuffer) {
        console.log(audioBuffer);
      assert.isObject(audioBuffer, 'audioBuffer is not an object');
      done();
    }, audioContext);
  });
  
  it('My sound was loaded with "loadBuffer"', function(done) {
    this.timeout(myTimeout);
    bufferLoader.loadBuffer('../node_modules/snd-dep/sound.wav', function(audioBuffer) {
      assert.isObject(audioBuffer, 'audioBuffer is not an object');
      done();

    }, audioContext);
  });
 
  /*
  If an order notion will be developped
  it('My sounds were loaded with "loadEach"', function(done) {
    this.timeout(myTimeout);
    var count = 0;
    bufferLoader.loadEach(['./synth.wav', '../node_modules/snd-dep/sound.wav'], function(audioBuffer) {
      assert.equal(myAudioBuffers[count].length, audioBuffer.length, 'buffer' + count + ' is not ok');
      count++;
      if(count == 2)
        done();
    }, audioContext);
  });
  
  it('My sounds were loaded with "loadEach" in reverse order', function(done) {
    this.timeout(myTimeout);
    var count = 1;
    bufferLoader.loadEach(['../node_modules/snd-dep/sound.wav', './synth.wav'], function(audioBuffer) {
      assert.equal(myAudioBuffers[count].length, audioBuffer.length, 'buffer' + count + ' is not ok');
      count--;
      if(count == -1)
        done();
    }, audioContext);
  });*/
  
  it('My sounds were loaded with "loadEach" in reverse order', function(done) {
    this.timeout(myTimeout);
    var count = 0;
    bufferLoader.loadEach(['../node_modules/snd-dep/sound.wav', './synth.wav'], function(audioBuffer) {
      assert.isObject(audioBuffer, 'audioBuffer is not an object');
      count++;
      if(count == 2)
        done();
    }, audioContext);
  });
  
  it('My sounds were loaded with "loadAll"', function(done) {
    this.timeout(myTimeout);
    bufferLoader.loadAll(['./synth.wav', '../node_modules/snd-dep/sound.wav'], function(audioBuffers) {
      assert.equal(myAudioBuffers[0].length, audioBuffers[0].length, 'buffer1 is not ok');
      assert.equal(myAudioBuffers[1].length, audioBuffers[1].length, 'buffer2 is not ok');
      done();
    }, audioContext);
  });
  
  it('My sounds were loaded with "loadAll" in reverse order', function(done) {
    this.timeout(myTimeout);
    bufferLoader.loadAll(['../node_modules/snd-dep/sound.wav', './synth.wav'], function(audioBuffers) {
      assert.equal(myAudioBuffers[0].length, audioBuffers[1].length, 'buffer1 is not ok');
      assert.equal(myAudioBuffers[1].length, audioBuffers[0].length, 'buffer2 is not ok');
      done();
    }, audioContext);
  });
  
  it('My sounds were loaded with "load"', function(done) {
    this.timeout(myTimeout);
    bufferLoader.load(['./synth.wav', '../node_modules/snd-dep/sound.wav'], function(audioBuffers) {
      assert.equal(myAudioBuffers[0].length, audioBuffers[0].length, 'buffer1 is not ok');
      assert.equal(myAudioBuffers[1].length, audioBuffers[1].length, 'buffer2 is not ok');
      done();
    }, audioContext);
  });
  
  it('My sounds were loaded with "load" in reverse order', function(done) {
    this.timeout(myTimeout);
    bufferLoader.load(['../node_modules/snd-dep/sound.wav', './synth.wav'], function(audioBuffers) {
      assert.equal(myAudioBuffers[0].length, audioBuffers[1].length, 'buffer1 is not ok');
      assert.equal(myAudioBuffers[1].length, audioBuffers[0].length, 'buffer2 is not ok');
      done();
    }, audioContext);
  });
  
  it('My sound is not correct, error was detected', function(done) {
    this.timeout(myTimeout);
    try {
      bufferLoader.load('./nothing.txt', function(audioBuffer) {
      console.log(audioBuffer);
      }, audioContext);
    } catch(e) {
      done();
    }
  });

});<commit_msg>add tests explain to the readme, small update on tests<commit_after>var assert = chai.assert;

var audioContext = new webkitAudioContext() || new AudioContext();

describe("Load some sounds: synth.wav and sound.wav", function() {
  var self = this;

  var myAudioBuffers = [{ //synth.wav
    duration: 1.7874829931972789,
    gain: 1,
    length: 78828,
    numberOfChannels: 1,
    sampleRate: 44100
  }, { //sound.wav
    duration: 3.633605442176871, 
    gain: 1,
    length: 160242,
    numberOfChannels: 2,
    sampleRate: 44100
  }];

  var myTimeout = 200000;

  it('My sound was loaded with "load"', function(done) {
    this.timeout(myTimeout);
    bufferLoader.load('../node_modules/snd-dep/sound.wav', function(audioBuffer) {
        console.log(audioBuffer);
      assert.isObject(audioBuffer, 'audioBuffer is not an object');
      done();
    }, audioContext);
  });
  
  it('My sound was loaded with "loadBuffer"', function(done) {
    this.timeout(myTimeout);
    bufferLoader.loadBuffer('../node_modules/snd-dep/sound.wav', function(audioBuffer) {
      assert.isObject(audioBuffer, 'audioBuffer is not an object');
      done();

    }, audioContext);
  });
 
  /*
  If an order notion will be developped
  it('My sounds were loaded with "loadEach"', function(done) {
    this.timeout(myTimeout);
    var count = 0;
    bufferLoader.loadEach(['./synth.wav', '../node_modules/snd-dep/sound.wav'], function(audioBuffer) {
      assert.equal(myAudioBuffers[count].length, audioBuffer.length, 'buffer' + count + ' is not ok');
      count++;
      if(count == 2)
        done();
    }, audioContext);
  });
  
  it('My sounds were loaded with "loadEach" in reverse order', function(done) {
    this.timeout(myTimeout);
    var count = 1;
    bufferLoader.loadEach(['../node_modules/snd-dep/sound.wav', './synth.wav'], function(audioBuffer) {
      assert.equal(myAudioBuffers[count].length, audioBuffer.length, 'buffer' + count + ' is not ok');
      count--;
      if(count == -1)
        done();
    }, audioContext);
  });*/
  
  it('My sounds were loaded with "loadEach" in reverse order', function(done) {
    this.timeout(myTimeout);
    var count = 0;
    bufferLoader.loadEach(['../node_modules/snd-dep/sound.wav', './synth.wav'], function(audioBuffer) {
      assert.isObject(audioBuffer, 'audioBuffer is not an object');
      count++;
      if(count == 2)
        done();
    }, audioContext);
  });
  
  it('My sounds were loaded with "loadAll"', function(done) {
    this.timeout(myTimeout);
    bufferLoader.loadAll(['./synth.wav', '../node_modules/snd-dep/sound.wav'], function(audioBuffers) {
      assert.equal(myAudioBuffers[0].length, audioBuffers[0].length, 'buffer1 is not ok');
      assert.equal(myAudioBuffers[1].length, audioBuffers[1].length, 'buffer2 is not ok');
      done();
    }, audioContext);
  });
  
  it('My sounds were loaded with "loadAll" in reverse order', function(done) {
    this.timeout(myTimeout);
    bufferLoader.loadAll(['../node_modules/snd-dep/sound.wav', './synth.wav'], function(audioBuffers) {
      assert.equal(myAudioBuffers[0].length, audioBuffers[1].length, 'buffer1 is not ok');
      assert.equal(myAudioBuffers[1].length, audioBuffers[0].length, 'buffer2 is not ok');
      done();
    }, audioContext);
  });
  
  it('My sounds were loaded with "load"', function(done) {
    this.timeout(myTimeout);
    bufferLoader.load(['./synth.wav', '../node_modules/snd-dep/sound.wav'], function(audioBuffers) {
      assert.equal(myAudioBuffers[0].length, audioBuffers[0].length, 'buffer1 is not ok');
      assert.equal(myAudioBuffers[1].length, audioBuffers[1].length, 'buffer2 is not ok');
      done();
    }, audioContext);
  });
  
  it('My sounds were loaded with "load" in reverse order', function(done) {
    this.timeout(myTimeout);
    bufferLoader.load(['../node_modules/snd-dep/sound.wav', './synth.wav'], function(audioBuffers) {
      assert.equal(myAudioBuffers[0].length, audioBuffers[1].length, 'buffer1 is not ok');
      assert.equal(myAudioBuffers[1].length, audioBuffers[0].length, 'buffer2 is not ok');
      done();
    }, audioContext);
  });
  
  it('My sound is not correct, error "decodeAudioData" was detected', function(done) {
    this.timeout(myTimeout);
    try {
      bufferLoader.load('./nothing.txt', function(audioBuffer) {
      console.log(audioBuffer);
      }, audioContext);
    } catch(e) {
      done();
    }
  });
  
  it('My path is not correct, error "404" was detected', function(done) {
    this.timeout(myTimeout);
    try {
      bufferLoader.load('./nothing', function(audioBuffer) {
      console.log(audioBuffer);
      }, audioContext);
    } catch(e) {
      done();
    }
  });

});
{'fraction_non_alphanumeric': 0.16105530411745225, 'fraction_numerical': 0.021084004857048238, 'mean_word_length': 3.3768115942028984, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5581539', 'n_tokens_mistral': 3024, 'n_tokens_neox': 2906, 'n_words': 618}