A predicate that checks the name of a TestSuite against a known value. This is used for implementation of the UnitTest class only. We put it in the anonymous namespace to prevent polluting the outer namespace. TestSuiteNameIs is copyable.
| 6580 | // |
| 6581 | // TestSuiteNameIs is copyable. |
| 6582 | class TestSuiteNameIs { |
| 6583 | public: |
| 6584 | // Constructor. |
| 6585 | explicit TestSuiteNameIs(const std::string& name) : name_(name) {} |
| 6586 | |
| 6587 | // Returns true iff the name of test_suite matches name_. |
| 6588 | bool operator()(const TestSuite* test_suite) const { |
| 6589 | return test_suite != nullptr && |
| 6590 | strcmp(test_suite->name(), name_.c_str()) == 0; |
| 6591 | } |
| 6592 | |
| 6593 | private: |
| 6594 | std::string name_; |
| 6595 | }; |
| 6596 | |
| 6597 | // Finds and returns a TestSuite with the given name. If one doesn't |
| 6598 | // exist, creates one and returns it. It's the CALLER'S |