Beispiel #1
0
 it('toss out non-numerics (NaN):', function() {
     var input = [1, 2, NaN],
         res = Lib.variance(input);
     expect(res).toEqual(0.25);
 });
Beispiel #2
0
 it('return 2/3 on input [-1, 0, 1]:', function() {
     var input = [-1, 0, 1],
         res = Lib.variance(input);
     expect(res).toEqual(2 / 3);
 });
Beispiel #3
0
 it('toss out non-numerics (strings):', function() {
     var input = [1, 2, 'apple', 'orange'],
         res = Lib.variance(input);
     expect(res).toEqual(0.25);
 });
Beispiel #4
0
 it('return 0 on input [2, 2, 2, 2, 2]:', function() {
     var input = [2, 2, 2, 2],
         res = Lib.variance(input);
     expect(res).toEqual(0);
 });