title: How do I write a unit test in c++?
body: <p>I've never written a unit test or any test for my c++ Programs. I know just that they are meant to testing if the function/program/unit does exactly what you think it does, But I have no idea how to write one.</p>
  <p>Can anybody help me with a test for my example function? And what is meant with a test framework? Do I write tests for every function of my code and all the branches, or just the ones I think can be tricky?</p>
  <pre><code>doMode(int i) {
  
  int a = fromString&lt;int&gt;(Action[i][1]);
  int b = fromString&lt;int&gt;(Action[i][2]);
  
  std::cout &lt;&lt; &quot;Parameter:\t&quot; &lt;&lt; a &lt;&lt; &quot;\t&quot; &lt;&lt; b &lt;&lt; &quot;\t&quot; &lt;&lt; std::endl;
  Sleep(200);
  
  return;
  }
  </code></pre>
  <p>Edit:
  I'm not asking for a framework. or better: probably that is connected with my question. I just don't know where and how to start. What is the syntax I have to use? is it different depending on which framework I use?</p>