Page MenuHomePhabricator

Suites
Updated 775 Days AgoPublic

This is for Goldilocks 2.0. If you're using Goldilocks 1.0 (part of PawLIB), see the official documentation at https://docs.mousepawmedia.com/pawlib

A Suite organizes multiple Tests and other suites into a single unit.

For example, you may have a pawlib suite, which contains several other suites like flexarray and onestring. In this way, tests can be organized arbitrarily by project and sector.

Every Goldilocks suite is derived from the Suite abstract class, which has a few functions that must be overloaded:

Constructor

REQUIRED. The Constructor must call the Suite constructor and pass the suite's name and docstring, as follows:

SomeSuite()
: Suite("Some Suite Name", "Some suite documentation string here.")
{}

void load()

REQUIRED. Registers one or more Tests in the suite, using the Suite::register_test():

void load() override
{
    register(1, new FirstTest());
    register(2, new SecondTest(), true, new SecondTestComparative());
    register(3, new HeavyTest(), false);
}

Using Suite::register()

The Suite::register() function is responsible for registering an instance of a test in the suite. It has four parameters, two of which are optional:

  • The id number of the test within the suite.
  • The instance of the test to register, usually allocated in place with new.
  • Whether the test should run automatically when the suite is run (true, the default), or not (false).
  • The comparative test used in benchmarking. If none is specified, the test will not be benchmarkable.
Last Author
jcmcdonald
Last Edited
Jun 30 2020, 8:31 PM