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

Needs unit testing #21

Closed
bvisness opened this issue Aug 25, 2016 · 23 comments · Fixed by #25
Closed

Needs unit testing #21

bvisness opened this issue Aug 25, 2016 · 23 comments · Fixed by #25

Comments

@bvisness
Copy link
Member

Just wanted to open up the discussion about how unit testing should be implemented for Handmade Math. We could use a full C++ unit testing framework like Google Test, or maybe just roll our own thing with asserts.

I personally would lean toward a full framework for ease of running multiple tests and nice test output. Plus, it would likely be easier to get up and running with Travis CI or some other automated tool, if we decide to go that route.

@StrangeZak
Copy link
Member

I think for right now just having our own unit thing right now would be fine as i really dont have the money to setup a Travis of Jenkins server for automated build tests. Although i do think Travis or Jenkins would be the way to go for this.

@StrangeZak
Copy link
Member

Wait is Travis CL free now ?

@bvisness
Copy link
Member Author

Travis CI is free for open-source projects, and I'd be happy to set it up once we get tests running locally. I think later today I will take a stab at using Google Test and will let you know how it goes.

@kiljacken
Copy link
Contributor

Travis is free for open source (maybe just github) projects afaik.

On Thu, 25 Aug 2016 at 18:57 Zak Strange notifications@github.com wrote:

Wait is Travis CL free now ?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#21 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAMxqYE_ZBznZukaNwOIr7gq32o9d5yEks5qjclhgaJpZM4JtJ6-
.

@StrangeZak
Copy link
Member

Yeah, im not really the guy to ask to write a unit test. So if any of you guys are good at it i would love if you could try to do it first, once we have that id be more than happy to setup Travis CL, because we really need a unit test, so were sure we dont break peoples code when we upgrade, heh.

@bvisness
Copy link
Member Author

Making some good headway on this! If you are interested you can check out the unit-tests branch of my fork.

@StrangeZak
Copy link
Member

I do all my builds on Windows as a build.bat files so eventually ill just convert the make file to batch script but random question what are we gaining by using the google api thing

@bvisness
Copy link
Member Author

We're gaining easy-to-create tests where individual asserts won't end the program, and very helpful formatting to help track down the source of errors. (Plus, it's a format that Travis should be happy with.)

Example output:

[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from Initialization
[ RUN      ] Initialization.Vectors
../test/hmm_test.cpp:34: Failure
      Expected: v3i.Elements[2]
      Which is: 3
To be equal to: 4.0f
      Which is: 4
[  FAILED  ] Initialization.Vectors (1 ms)
[----------] 1 test from Initialization (1 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (1 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] Initialization.Vectors

@StrangeZak
Copy link
Member

Awesome just didn't wanna bloat the project with a library, we didn't need but this seems fine as it won't even be used in HandmadeMath

@bvisness
Copy link
Member Author

Yeah for sure. Maybe someone can make a handmade test framework for us :)

@StrangeZak
Copy link
Member

Or, that could be a awesome side-project for us to work on when HandmadeMath is stable and faster than GLM

@StrangeZak
Copy link
Member

Whats the status on the unit test ?

@bvisness
Copy link
Member Author

1300 lines later, almost done writing them. Found a couple confirmed bugs and a few other issues (which I will make Github issues for.) Just have to write tests for HMM_Orthographic, HMM_Projection, and HMM_LookAt and we'll be good to go.

@bvisness
Copy link
Member Author

(The tests are a little verbose in spots, but I'm just cranking them out and I can look into removing redundant code once everything works.)

@StrangeZak
Copy link
Member

Awesome were finding bugs this is great :D After some testing of the next major version i thing we can finally call this "stable"

@StrangeZak
Copy link
Member

Cant wait to squash these bugs

@bvisness
Copy link
Member Author

I'll try to finish up the tests tonight.

@StrangeZak
Copy link
Member

Thanks for writing the unit test :)

@bvisness bvisness mentioned this issue Aug 29, 2016
@bvisness
Copy link
Member Author

Tests are up! Sadly it looks like there are some merge conflicts that will need resolving, but they shouldn't be too bad since most of the changes are new code anyway.

I'm going to go through and make issues for the stuff I found along the way. Once those are resolved I can try configuring Travis.

@StrangeZak
Copy link
Member

Awesome, with LOTS of bugs found now and a unit test i think we on to a proper version 1.0

@StrangeZak
Copy link
Member

Ill squash out a few of these bugs this after noon after i get ready, a lot of these seem like easy fixes i can do in an hour or two. So you can focus on just getting the unit tests to merge in.

@bvisness
Copy link
Member Author

I'll merge and re-push so that conflicts will be resolved.

@StrangeZak
Copy link
Member

Im writing a quick opengl visual test bed right now we can run some tests against also

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 a pull request may close this issue.

3 participants