title: Google Test and static local variable
body: <p>I have a method that contains a <code>static unsigned int</code>, so it can return consecutive directory names. Something like:</p>
  
  <pre><code>string MyClass::createDirectory() const
  {
      static unsigned int i = 0;
      stringstream ss;
      string directory;
      do
      {
          ++i;
          ss.str("");
          ss &lt;&lt; "/" &lt;&lt; setfill('0') &lt;&lt; setw(6) &lt;&lt; i;
          directory = m_rootDirectory + ss.str();
  
      } while(!m_filesystem-&gt;createDirectory((directory)));
  
      return directory;
  }
  </code></pre>
  
  <p>I know this is pretty naive solution, but it is good enough for now.</p>
  
  <p>But I have encountered problem while writing unit tests - the static variable is incremented between test cases.</p>
  
  <p>Is there a way to reset such variable? Or is changing static method variable to non-static class member my only option?</p>
  
  <p>I'm using Google Test framework.</p>