4#include <string_format.h>
16 std::string _fullDescription;
18 std::vector<ISpecGroup*> _childGroups;
19 std::vector<ISpec*> _specs;
20 std::vector<ISpecSetup*> _setups;
21 std::vector<ISpecTeardown*> _teardowns;
22 std::vector<ISpecSetup*> _oneTimeSetups;
23 std::vector<ISpecTeardown*> _oneTimeTeardowns;
25 std::unique_ptr<SpecVariableCollection> _variables;
34 FunctionPointer<void(
ISpecGroup*)> _merge_child_groups_fn =
35 function_pointer(
this, &SpecGroup::merge_child_groups);
36 FunctionPointer<void(
ISpec*)> _merge_tests_fn =
37 function_pointer(
this, &SpecGroup::merge_tests);
38 FunctionPointer<void(
ISpecSetup*)> _merge_setups_fn =
39 function_pointer(
this, &SpecGroup::merge_setups);
41 function_pointer(
this, &SpecGroup::merge_teardowns);
42 FunctionPointer<void(
ISpecSetup*)> _merge_one_time_setups_fn =
43 function_pointer(
this, &SpecGroup::merge_one_time_setups);
44 FunctionPointer<void(
ISpecTeardown*)> _merge_one_time_teardowns_fn =
45 function_pointer(
this, &SpecGroup::merge_one_time_teardowns);
52 if (parent ==
nullptr || strlen(parent->full_description()) == 0)
56 string_format(
"{} > {}", parent->full_description(),
description);
62 for (
auto*
group : _childGroups) callback->invoke(
group);
66 for (
auto* spec : _specs) callback->invoke(spec);
70 for (
auto* setup : _setups) callback->invoke(setup);
74 for (
auto* teardown : _teardowns) callback->invoke(teardown);
78 for (
auto* setup : _oneTimeSetups) callback->invoke(setup);
82 for (
auto* teardown : _oneTimeTeardowns) callback->invoke(teardown);
91 _oneTimeTeardowns.push_back(teardown);
ISpecGroup * group() const override
const char * description() const override
void add_teardown(ISpecTeardown *teardown) override
void merge(ISpecGroup *other) override
void foreach_test(ForEachSpecFn *callback) const override
void foreach_group(ForEachGroupFn *callback) const override
void add_group(ISpecGroup *group) override
SpecGroup(ISpecGroup *parent=nullptr, std::string_view description="")
ISpecVariableCollection * variables() const override
void foreach_one_time_teardown(ForEachTeardownFn *callback) const override
const char * full_description() const override
void add_setup(ISpecSetup *setup) override
void foreach_teardown(ForEachTeardownFn *callback) const override
void add_test(ISpec *spec) override
void add_one_time_teardown(ISpecTeardown *teardown) override
void foreach_setup(ForEachSetupFn *callback) const override
void add_one_time_setup(ISpecSetup *setup) override
SpecGroup(std::string_view description)
void foreach_one_time_setup(ForEachSetupFn *callback) const override
IFunctionPointer< void(ISpecSetup *)> ForEachSetupFn
virtual void foreach_one_time_teardown(ForEachTeardownFn *) const =0
IFunctionPointer< void(ISpecGroup *)> ForEachGroupFn
virtual void foreach_group(ForEachGroupFn *) const =0
virtual void foreach_one_time_setup(ForEachSetupFn *) const =0
virtual void foreach_teardown(ForEachTeardownFn *) const =0
IFunctionPointer< void(ISpecTeardown *)> ForEachTeardownFn
virtual void foreach_setup(ForEachSetupFn *) const =0
IFunctionPointer< void(ISpec *)> ForEachSpecFn
virtual void foreach_test(ForEachSpecFn *) const =0
virtual IVoidPointer * get(const char *name) const =0