C++ Unit Tests

Help wanted! This section needs some work. Would you like to help us keep it relevant?


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!

I can help you.
I use c+±17, gtest etc. But How?

1 Like

See the unfinished issues here:


I can try to help you, but I don’t have much C++ experience.

Many thanks.
So should I start somewhere?

Well I’m not sure how to help you out, maybe @utensil can if he is around. Choose an unfinished issue, and if you have any questions about it, start a discussion on the ticket.

Yeah, I’m still around, checking Github notifications regularly. The issue is a little bit obsolete since I haven’t been working on the nupic.core code base for a while.