title: How to test c++ template class with multiple template parameters using gtest?
body: <p>I want to test a template class with gtest. I read about <a href="https://code.google.com/p/googletest/wiki/V1_7_AdvancedGuide#Typed_Tests" rel="noreferrer"><code>TYPED_TEST</code></a>s in gtest manual and looked at the official example (<a href="https://code.google.com/p/googletest/source/browse/trunk/samples/sample6_unittest.cc" rel="noreferrer">samples\sample6_unittest.cc</a>) they reference. This template from the example has only one template parameter.
  But, my code has two template parameters, how can I test it?</p>
  
  <p>I have the following code:</p>
  
  <pre><code>// two element type
  template &lt;typename E, typename F&gt;
  class QueueNew
  {
  public:
      QueueNew() {}
      void Enqueue(const E&amp; element) {}
      E* Dequeue() {}
      F size() const 
      {
          return (F)123;
      }
  };
  </code></pre>
  
  <p>for which I wrote the test code below:</p>
  
  <pre><code>template &lt;class E, class F&gt;
  QueueNew&lt;E, F&gt;* CreateQueue();
  
  template &lt;&gt;
  QueueNew&lt;int, int&gt;* CreateQueue&lt;int, int&gt;()
  {
      return new QueueNew &lt; int, int &gt; ;
  }
  template &lt;&gt;
  QueueNew&lt;char, char&gt;* CreateQueue&lt;char, char&gt;()
  {
      return new QueueNew &lt; char, char &gt; ;
  }
  
  template &lt;class E, class F&gt;
  class QueueTestNew;
  
  template &lt;class E&gt;
  class QueueTestNew&lt;E, int&gt; : public testing::Test
  {
  protected:
      QueueTestNew() : queue(CreateQueue&lt;E, int&gt;()){}
      virtual ~QueueTestNew(){ delete queue; }
      QueueNew&lt;E, int&gt;* const queue;
  };
  
  template &lt;class E&gt;
  class QueueTestNew&lt;char, E&gt; : public testing::Test
  {
  protected:
      QueueTestNew() : queue(CreateQueue&lt;char, E&gt;()){}
      virtual ~QueueTestNew(){ delete queue; }
      QueueNew&lt;char, E&gt;* const queue;
  };
  
  // The list of types we want to test.
  typedef ::testing::Types &lt;char, int&gt; Implementations;
  
  TYPED_TEST_CASE(QueueTestNew, Implementations);
  
  TYPED_TEST(QueueTestNew, DefaultConstructor)
  {
      EXPECT_EQ(123u, this-&gt;queue-&gt;size());
  }
  </code></pre>
  
  <p>but when building, I get the error:</p>
  
  <pre><code>error C2976: 'QueueTestNew' : too few template arguments
  see declaration of 'QueueTestNew'
  ...
  </code></pre>
  
  <p>I think my test template method with gtest is wrong, so how should I do this?</p>