Skip to content

Commit

Permalink
use Math.fround
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Hulette committed Jan 19, 2018
1 parent 0126dc4 commit 0620cfd
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions js/test/unit/table-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ describe(`Table`, () => {
// Wrap floating point values in a Float32Array and take them back out to
// make sure that equality checks will pass
const values = [
[new Float32Array([-0.3])[0], -1, 'a'],
[new Float32Array([-0.2])[0], 1, 'b'],
[new Float32Array([-0.1])[0], -1, 'c'],
[new Float32Array([ 0 ])[0], 1, 'a'],
[new Float32Array([ 0.1])[0], -1, 'b'],
[new Float32Array([ 0.2])[0], 1, 'c'],
[new Float32Array([ 0.3])[0], -1, 'a']
[Math.fround(-0.3), -1, 'a'],
[Math.fround(-0.2), 1, 'b'],
[Math.fround(-0.1), -1, 'c'],
[Math.fround( 0 ), 1, 'a'],
[Math.fround( 0.1), -1, 'b'],
[Math.fround( 0.2), 1, 'c'],
[Math.fround( 0.3), -1, 'a']
];
test(`has the correct length`, () => {
expect(table.length).toEqual(values.length);
Expand Down Expand Up @@ -321,15 +321,15 @@ describe(`Table`, () => {
// Wrap floating point values in a Float32Array and take them back out to
// make sure that equality checks will pass
const values = [
[new Float32Array([-0.3])[0], -1, 'a'],
[new Float32Array([-0.2])[0], 1, 'b'],
[new Float32Array([-0.1])[0], -1, 'c'],
[new Float32Array([ 0 ])[0], 1, 'a'],
[new Float32Array([ 0.1])[0], -1, 'b'],
[new Float32Array([ 0.2])[0], 1, 'c'],
[new Float32Array([ 0.3])[0], -1, 'a'],
[new Float32Array([ 0.2])[0], 1, 'b'],
[new Float32Array([ 0.1])[0], -1, 'c'],
[Math.fround(-0.3), -1, 'a'],
[Math.fround(-0.2), 1, 'b'],
[Math.fround(-0.1), -1, 'c'],
[Math.fround( 0 ), 1, 'a'],
[Math.fround( 0.1), -1, 'b'],
[Math.fround( 0.2), 1, 'c'],
[Math.fround( 0.3), -1, 'a'],
[Math.fround( 0.2), 1, 'b'],
[Math.fround( 0.1), -1, 'c'],
];
test(`has the correct length`, () => {
expect(table.length).toEqual(values.length);
Expand Down

0 comments on commit 0620cfd

Please sign in to comment.