Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
szdytom committed Nov 25, 2024
1 parent dc358fc commit 97398ec
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,15 @@ describe('binary-struct', () => {
describe('serialize and deserialize', () => {
it('type f32', () => {
let val = 2008.0925;
let bin = serializeToBinary(Math.PI, BASIC_TYPES.f32);
let bin = serializeToBinary(val, BASIC_TYPES.f32);
assert.equal(bin.byteLength, 4);
let num = deserializeFromBinary(bin, BASIC_TYPES.f32);
assert.equal(num, val);
assert.ok(Math.abs(num - val) < 0.0001);
});

it('type f64', () => {
let val = 2008.0925;
let bin = serializeToBinary(Math.PI, BASIC_TYPES.f64);
let bin = serializeToBinary(val, BASIC_TYPES.f64);
assert.equal(bin.byteLength, 8);
let num = deserializeFromBinary(bin, BASIC_TYPES.f64);
assert.equal(num, val);
Expand Down

0 comments on commit 97398ec

Please sign in to comment.