A predicate that checks the name of a TestCase 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. TestCaseNameIs is copyable.
| 5370 | // |
| 5371 | // TestCaseNameIs is copyable. |
| 5372 | class TestCaseNameIs { |
| 5373 | public: |
| 5374 | // Constructor. |
| 5375 | explicit TestCaseNameIs(const String& name) |
| 5376 | : name_(name) {} |
| 5377 | |
| 5378 | // Returns true iff the name of test_case matches name_. |
| 5379 | bool operator()(const TestCase* test_case) const { |
| 5380 | return test_case != NULL && strcmp(test_case->name(), name_.c_str()) == 0; |
| 5381 | } |
| 5382 | |
| 5383 | private: |
| 5384 | String name_; |
| 5385 | }; |
| 5386 | |
| 5387 | // Finds and returns a TestCase with the given name. If one doesn't |
| 5388 | // exist, creates one and returns it. It's the CALLER'S |