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

Missing test coverage in src/clip/circle.js #213

Open
martinfrances107 opened this issue Aug 17, 2020 · 2 comments
Open

Missing test coverage in src/clip/circle.js #213

martinfrances107 opened this issue Aug 17, 2020 · 2 comments

Comments

@martinfrances107
Copy link
Contributor

I am slowly porting this module to rust...

The process has been made easy by the code qualify of this module.

  1. The tests are extensive.
  2. The design is good the code well laid out, modular and easy to read.

So please understand my next point is minor, and I do respect the overall quality.

When I have a issue I don't understand I insert console.log() statement to inspect variables...yes I use an IDE for complex debugging!!

but console.log() is good at showing which tests are covering the code under inspection.

my point is from the code below, no tests cover the tail of the file src/clip/circle.js... plenty of test cover the NULL that is return if the if statement takes no action but this complex if statement is not covered.

As I port my code .. I intend to push the new test upstream into this module.

But I am posting early just in case someone has a clear idea for a simple fix.

// Check that the first point is between a and b. if (meridian ? polar ? phi0 + phi1 > 0 ^ q[1] < (abs(q[0] - lambda0) < epsilon ? phi0 : phi1) : phi0 <= q[1] && q[1] <= phi1 : delta > pi ^ (lambda0 <= q[0] && q[0] <= lambda1)) { var q1 = cartesianScale(u, (-w + t) / uu); cartesianAddInPlace(q1, A); console.log("############################################### meridian output"); console.log([q, spherical(q1)]); console.log("############################################### meridian output"); debugger; return [q, spherical(q1)]; }

@Fil
Copy link
Member

Fil commented Aug 17, 2020

That part of the code is particularly difficult.

It was copied over from this commit in d3v3 and has since been left mostly untouched (except for variable names and formatting).

The reference issue was d3/d3#1127

This might give us ideas to recreate meaningful tests (and maybe clarify the code).

@martinfrances107
Copy link
Contributor Author

Thank you for adding the context - that was interesting to read.

when you say

(and maybe clarify the code).

Regarding src/clip/circle.js

For the point of view of a more type specific language like typescript of rust

The porting of code that passes uint8 code messages as the thrid/Z component of an otherwise 2D arrays of floats made me struggle yesterday.

So that will be a cleanup task I plan to work into the pull request I eventually generate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants