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 test cases #18

Open
tbrosman opened this issue Aug 16, 2014 · 3 comments
Open

Refactor test cases #18

tbrosman opened this issue Aug 16, 2014 · 3 comments

Comments

@tbrosman
Copy link
Owner

Test cases have gotten messy. Need more consistent naming/organization and actual/expected parameters should be specified in the correct places (they're switched in most).

@player-03
Copy link
Contributor

As long as there's talk of refactoring, is it ok if I rewrite the tests for utest? nanotest is ok but has a number of small flaws, such as not working with DCE.

Since both libraries are based on the same thing, their APIs are quite similar, and I expect most of the process to be find-and-replace.

@tbrosman
Copy link
Owner Author

I'm fine with it, though I'll probably be a little slow to review. I'm not particularly opinionated about the unit test library (I don't plan on adding to hxmath myself much anytime soon). Seems like utest has more features and nanotest hasn't been updated in 4 years.

@player-03
Copy link
Contributor

Ok, I've switched to utest and put the actual/expected arguments in order. That leaves naming/organization, which is harder to pin down.

After one pass through the files, here are problems I'd like to address:

  • Categories like 2D, 3D, converters, and geometry make sense at a glance, but if you're looking through the file names, how are you supposed to tell the difference between "data structures" and "structures"?
  • There's a single test in TestIntMath.hx, and this test could just as easily go under converters.
  • There's a whole separate file for frames, despite the fact that other more important types lack their own dedicated file.
  • Almost, but not quite, all of TestGeom.hx has to do with rectangles. I assume that's because hxmath.geom contains only two classes and Rect is the important one.

As for my approach? I'd like to group the tests by related classes. For instance, Vector2, Vector3, and Vector4 should go together, because their tests will be so similar. Probably IntVector2 and ShortVector2 as well. And of course, all the matrices belong in one place.

OTOH, some of these files might get really long, so I might have to break them into subcategories. But unless you can think of something better, I'm going to start with this.

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

No branches or pull requests

2 participants