PanPalitta / phase_estimation

This project apply reinforcement learning algorithms based on DE and PSO to optimize adaptive quantum-phase estimation.
http://panpalitta.github.io/phase_estimation/
GNU General Public License v3.0
9 stars 5 forks source link

Implement unit testing framework #15

Closed peterwittek closed 8 years ago

peterwittek commented 9 years ago

Testing is almost absent and it is very easy to make regression with new developments. CppUnit or some other simple framework could help.

PanPalitta commented 9 years ago

I have a UnitTest++ framework setup on my computer ready to go. I chose this framework mainly because it comes as a plugin for Codelite, an IDE for Mingw on Windows that I use to test prototypes of the codes that eventually go on to official version. I will have to look up if there is any unit test framework on WestGrid computers that supports MPI, or if we can install it. For now I can begin testing the snippets that don't involve parallelization.

I'm also reading up how to perform a good unit test because, as evident to you, I've never done this before. If you have some good guidelines, or just how you personally like the test to be conducted, please let me know.

peterwittek commented 9 years ago

I am fine with the technological choice.

Ideally you want to have small, isolated tests for each function to test their typical and atypical behaviour. As a start, it would be good to have just a handful of tests to avoid introducing bugs while we develop the multiobjective classes. Then, when we hunt down a bug, we can create new unit tests from what we learn from debugging.

I think MPI communication is hard to do in unit testing, so we can resort to regression testing. This is basically what we do with the test.cfg configuration and the subsequent check of the results.