TheCherno / Hazel

Hazel Engine
Apache License 2.0
11.67k stars 1.5k forks source link

Unit Tests #99

Open Puddlestomper opened 5 years ago

Puddlestomper commented 5 years ago

It looks like Hazel will expand to become quite a large and complicated code base (as is common for game engines). Because of this Cherno is making many temporary compromises in order to get things working so long. For example the hard-coded magnification settings in the Textures video. This will eventually lead to us refactoring a lot of code as a proper material system, asset manager, etc. gets added.

I think it is probably a good idea to have a unit test system so that if this refactoring (or anything else) breaks something unexpectedly, then we will be able to find where the issue is and hopefully fix it quickly without too much debugging.

I am not experienced enough to know how to actually go about doing this, but it seems like something that should be done at some point.

d-tatianin commented 5 years ago

Yeah this is definitely a thing that should be done at some point. There are a lot of good unit test c++ libraries out there, the one I recommend is doctest.

SweeneyPro commented 4 years ago

I'd definately like to see some unit testing framework implemented, I've played around with a few (non-game related projects) but not sure if I'm using them in the correct way for in game-engine context so some info on that would be great.

JonanOribe commented 3 years ago

This is a great idea to avoid breaking one thing when trying to fix another. I never really worked with C ++ testing, but this https://github.com/catchorg/Catch2íritu looks great

pmann84 commented 3 years ago

There is also the googletest framework (https://github.com/google/googletest), which has both testing and mocking facilities.

Lecrapouille commented 3 years ago

Just if someone knows how to create OpenGL context in CI (Travis-CI ie) I would like to know how to do that. I already tried but you cannot create OpenGL even with Docker.