CPP Unit Tests

utensil edited this page Oct 15, 2014 · 12 revisions
Clone this wiki locally
Help wanted! This section needs some work. Would you like to help us keep it relevant?

Summary

The C++ unit tests are in 2 sub-directories of the directory src/test of nupic.core, namely:

  • htmtest
    • Primarily used to construct and manipulate a Network for many iterations to detect memory leaks.
    • Except the memory leak detection, most of the unit tests in it have correspondence in unit.
    • It's written with 2 simple assertion macros NTA_CHECK(from src/main/utils/Log.hpp) and SHOULDFAIL.
  • unit
    • The primary unit tests for nupic.core, it's not covering all classes and methods, but most of the essential parts.
    • It's the desired location for all unit tests to go, and possibly will have sibling directories like integration and functional to consists other levels of tests.
    • Old tests were written by a home grown testing framework and went through transition to Google Test framework, see https://github.com/numenta/nupic.core/issues/10 , but still wrapped in an interface similar to the old framework(see src/main/test/Tester.hpp).
    • New test should be written in Google Test native macros and added to src/test/unit/UnitTestMain.cpp manually.

See the latest updates at https://github.com/numenta/nupic.core/issues/183 , and please help us to improve the unit testing!