title: C++ unit test testing, using template test class
body: <p>I’m doing some C++ test driven development. I have a set of classes the do the same thing e.g. </p>
  
  <p>same input gives same output (or should, that’s what I’m try to test). I’m using Visual Studio 2012’s </p>
  
  <p>CppUnitTestFramework. I wanted to create a templated test class, so I write the tests once, and can template in classes as needed however I cannot find a way to do this. My aim:</p>
  
  <pre><code>/* two classes that do the same thing */
  class Class1
  {
      int method()
      {
          return 1;
      }
  };
  
  class Class2
  {
      int method()
      {
          return 1;
      }
  };
  
  /* one set of tests for all classes */
  template&lt; class T&gt;
  TEST_CLASS(BaseTestClass)
  {
      TEST_METHOD(testMethod)
      {
          T obj;
  
          Assert::AreEqual( 1, obj.method());
      }
  };
  
  /* only have to write small amout to test new class */
  class TestClass1 : BaseTestClass&lt;Class1&gt;
  {
  };
  
  class TestClass2 : BaseTestClass&lt;Class1&gt;
  {
  };
  </code></pre>
  
  <p>Is there a way I can do this using CppUnitTestFramework?</p>
  
  <p>Is there another unit testing framework that would allow me to do this?</p>