DRY principle wouldn’t let me use this. There are same code snippets used in both tests, in which game objects prepares. Practically it is setup step for the test. So I want to have prepared game object before I even enter test function, and possibly same object for both of test functions. So I declare a test fixture:
Now I want to use it in test. Sure, it could be passed as a variable like ‘fixture’, but in this case ‘fixture.’ prefix would be needed for addressing each field. Which is in turn a violation of DRY principle. Yet, I could left my test as they are (without any prefixes), if each test function were fixture class’ function. I inherit new class, Fixture_GameWithDummy, define run() method, and in Test::run() function I just create fixture object and call its run() method, and all testing will be contained in fixture::run().
This step requires all tests to be converted from simple void(*)() function to a class, which really isn’t complicate anything:
Now test runner just need to treat each test object as a class instance, not function, and call it’s run() method instead of impl().