Class GroupLocation

Class Documentation

class GroupLocation
[source]

Source-location record for a test group.

Constructed by the TEST_GROUP() macro; self-registers into the process-wide singly-linked list during static initialisation.

Public Functions

GroupLocation(const char *group_name, const char *file_name, int_least32_t line_number) noexcept

Record and register a group’s source location.

Parameters:
  • group_name – Name of the test group.

  • file_name – Source file where TEST_GROUP() appears.

  • line_number – Line number of the TEST_GROUP() invocation.

GroupLocation(const GroupLocation&) = delete
GroupLocation &operator=(const GroupLocation&) = delete
const char *get_group() const
Returns:

The group name.

const char *get_file() const
Returns:

The source file path.

int_least32_t get_line_number() const
Returns:

The source line number.

GroupLocation *get_next() const
Returns:

The next entry in the registration list, or nullptr.

Public Static Functions

static GroupLocation *get_head()
[source]
Returns:

The head of the global group-location list.

static void set_head(GroupLocation *head)

Replace the head of the global group-location list.

Intended for test infrastructure: save the current head before a test and restore it afterwards to isolate the test from global registrations.

Parameters:

head – New head (may be nullptr to clear the list).