mardi 4 septembre 2018

How to test a separate function with cxxTest?

I've never faced testing, but I decided to try it now. However I don't understand how to test function that I have in a standalone .cpp file. As it mentioned in cxxTest guide I've created nameTest.h file:

class MyTest : public CxxTest::TestSuite {
    public:
        void testMethod( void )
        {
            TS_ASSERT_EQUALS(MyFunction(), 1);
        }
};

My goal is to test MyFunction() realised in name.cpp:

myFunction() {
  return 1;
}

The problem that I don't know how to make myFunction() visible for nameTest.hpp. How can I do it?

Aucun commentaire:

Enregistrer un commentaire