title: Where to put main and what to write there?
body: <p>I have the following code in file <code>tested.cpp</code>:</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  class tested {
      private:
          int x;
      public:
          tested(int x_inp) {
              x = x_inp;
          }
  
          int getValue() {
              return x;
          }
  };
  </code></pre>
  
  <p>I also have another file (called <code>testing.cpp</code>):</p>
  
  <pre><code>#include &lt;cppunit/extensions/HelperMacros.h&gt;
  #include "tested.cpp"
  
  class TestTested : public CppUnit::TestFixture
  {
      CPPUNIT_TEST_SUITE(TestTested);
      CPPUNIT_TEST(check_value);
      CPPUNIT_TEST_SUITE_END();
  
      public:
          void check_value();
  };
  
  CPPUNIT_TEST_SUITE_REGISTRATION(TestTested);
  
  void TestTested::check_value() {
      tested t(3);
      int expected_val = t.getValue();
      CPPUNIT_ASSERT_EQUAL(7, expected_val);
  }
  </code></pre>
  
  <p>When I try to compile the <code>testing.cpp</code> file I get: <code>undefined reference to</code>main'`. Well, this is because I do not have main (the entry point for the program). So, the compiler does not know how to start the execution of the code.</p>
  
  <p>But what is not clear to me is how to execute the code in the <code>testing.cpp</code>. I tried to add:</p>
  
  <pre><code>int main() {
          TestTested t();
          return 1;
  }
  </code></pre>
  
  <p>However, it does not print anything (and it is expected to return an error message since 3 is not equal to 7).</p>
  
  <p>Does anybody know what is the correct way to run the unit test?</p>