Skip to content

Commit

Permalink
add edge case geomean test
Browse files Browse the repository at this point in the history
  • Loading branch information
acxz committed Jun 13, 2022
1 parent 20c2b0f commit ac3ddc3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/jasmine/tests/lib_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,24 @@ describe('Test lib.js:', function() {
});
});

describe('geomean() should', function() {
it('toss out non-numerics (strings)', function() {
var input = [1, 2, 'apple', 'orange'];
var res = Lib.mean(input);
expect(res).toBeCloseTo(1.414, 3);
});
it('toss out non-numerics (NaN)', function() {
var input = [1, 2, NaN];
var res = Lib.mean(input);
expect(res).toBeCloseTo(1.414, 3);
});
it('evaluate numbers which are passed around as text strings:', function() {
var input = ['1', '2'];
var res = Lib.geomean(input);
expect(res).toBeCloseTo(1.414, 3);
});
});

describe('midRange() should', function() {
it('should calculate the arithmetic mean of the maximum and minimum value of a given array', function() {
var input = [1, 5.5, 6, 15, 10, 13];
Expand Down

0 comments on commit ac3ddc3

Please sign in to comment.