2

I'm just starting to learn the CppUnitTest framework and I'm having the weirdest problem. When I'm running my code (see bellow) it just stuck forever, however - if I'm adding a breakpoint and running it as "step-by-step" the test finish successfully (although it doesn't free the DLL of the test)

namespace CalibrationUnitTest
{
    static SCreateDirectoriesParams* createDirectoriesParams;

    TEST_CLASS(CreateDirectoryTest)
    {
    public:

        TEST_CLASS_INITIALIZE(ClassInitialize)
        {
            createDirectoriesParams = new SCreateDirectoriesParams;
        }

        TEST_METHOD(CreateDirectoriesRegressionTest)
        {
            strcpy_s(createDirectoriesParams->rootPath, MAX_PATH_SIZE, "c:\\tmp");

            Assert::AreEqual(CreateDirectories(*createDirectoriesParams), SUCCESS);
        }

        TEST_CLASS_CLEANUP(ClassCleanUp)
        {
           delete(createDirectoriesParams);
        }
    };
}

I tried to search for this problem for the last 2 days without any success, and I'll be glad for any help!

EDIT: it seems that the test stuck when I try to call any of my API functions, and when I put it in comment the test pass also in regular run.

Yonatan Karp-Rudin
  • 1,056
  • 8
  • 24
  • @BoPersson createDirectoriesParams is just a struct that contains the variable rootPath which is char*. the initialization of this pointer happens in the first line of my test so as far as I understand it seems that all of my variables are initialized. As for my class, it only contains alot of BOOST function calling to create directories under the given root. As I mention, the wired thing is that the test work perfectly when im running it step-by-step, but fail on every API call when I'm running it in the regular way. – Yonatan Karp-Rudin Sep 24 '15 at 09:24

0 Answers0