Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: add additional parsers and tests #1524

Open
wants to merge 4 commits into
base: arthur/parser-combinator
Choose a base branch
from

Conversation

mShan0
Copy link
Contributor

@mShan0 mShan0 commented Feb 22, 2023

Adds the following parsers:

FloatLE
FloatBE
DoubleLE
DoubleBE
UInt24LE

Adds tests for these parsers:

UsVarchar
BVarbyte

@mShan0 mShan0 changed the base branch from master to arthur/parser-combinator February 22, 2023 21:12
@codecov
Copy link

codecov bot commented Feb 22, 2023

Codecov Report

Merging #1524 (37f2f19) into arthur/parser-combinator (b8faa65) will decrease coverage by 1.38%.
The diff coverage is 9.37%.

❗ Current head 37f2f19 differs from pull request most recent head c85dd3e. Consider uploading reports for the commit c85dd3e to get more accurate results

@@                     Coverage Diff                      @@
##           arthur/parser-combinator    #1524      +/-   ##
============================================================
- Coverage                     76.54%   75.16%   -1.38%     
============================================================
  Files                            92       92              
  Lines                          4950     5014      +64     
  Branches                        922      936      +14     
============================================================
- Hits                           3789     3769      -20     
- Misses                          858      947      +89     
+ Partials                        303      298       -5     
Impacted Files Coverage Δ
src/parser/index.ts 20.05% <9.37%> (-2.40%) ⬇️

... and 3 files with indirect coverage changes

Comment on lines +639 to +649
// Temporary buffers to convert numbers.
const float32Array = new Float32Array(1);
const uInt8Float32Array = new Uint8Array(float32Array.buffer);
const float64Array = new Float64Array(1);
const uInt8Float64Array = new Uint8Array(float64Array.buffer);

// Check endianness.
float32Array[0] = -1; // 0xBF800000
// Either it is [0, 0, 128, 191] or [191, 128, 0, 0]. It is not possible to
// check this with `os.endianness()` because that is determined at compile time.
const bigEndian = uInt8Float32Array[3] === 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taken from base Node buffer.js

@mShan0 mShan0 changed the title refactor: add float and double parsers refactor: add additional parsers and tests Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant