Fixup floating point equality using epsilon
This commit is contained in:
parent
c72c681314
commit
440d934f19
|
@ -1,4 +1,4 @@
|
||||||
import { mochaRun } from '../../../util.js';
|
import { EPSILON, mochaRun } from '../../../util.js';
|
||||||
import { ForumTest } from './forum.test-util.js';
|
import { ForumTest } from './forum.test-util.js';
|
||||||
|
|
||||||
describe('Forum', function tests() {
|
describe('Forum', function tests() {
|
||||||
|
@ -48,7 +48,7 @@ describe('Forum', function tests() {
|
||||||
{ postId: posts[2], weight: 0.05 },
|
{ postId: posts[2], weight: 0.05 },
|
||||||
]);
|
]);
|
||||||
forum.getPost(posts[0]).value.should.equal(3.6);
|
forum.getPost(posts[0]).value.should.equal(3.6);
|
||||||
forum.getPost(posts[1]).value.should.equal(0.40);
|
forum.getPost(posts[1]).value.should.be.within(0.40 - EPSILON, 0.40 + EPSILON);
|
||||||
forum.getPost(posts[2]).value.should.equal(1);
|
forum.getPost(posts[2]).value.should.equal(1);
|
||||||
forum.getPost(posts[3]).value.should.equal(95);
|
forum.getPost(posts[3]).value.should.equal(95);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue