chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes

#include "CppUnitTest.h"

#include "Isolator5.h"

#include "IntControlButton.h"

#include "Utilility.h"

using namespace Typemock;

using namespace Microsoft::VisualStudio::CppUnitTestFramework;

TEST_CLASS(TestComButton)

{

public:

    Isolator* a = nullptr;

    IntControlButton* btnPtr = nullptr;

    TEST_METHOD_INITIALIZE(SetUp)

    {

        a = new Isolator();

        // Arrange fixture wide fakes...

        char com[] = "sim/cockpit2/radios/actuators/com1_standby_frequency_hz_833";

        btnPtr = new IntControlButton(ButtonBase::com, com, Utilility::IntValToText3n3d, Utilility::TextToIntVal3n3d, 7,

            Utilility::InsDigIntVal3n3d, Utilility::DeleteVal3n3d);

    }

    TEST_METHOD_CLEANUP(TearDown)

    {

        delete a;

        delete btnPtr;

        a = nullptr;

        btnPtr = nullptr;

    }

    TEST_METHOD(constructor)

    {

        Assert::IsFalse(btnPtr->selected);

        if (btnPtr != nullptr)

        {

            char* testText = a->Variable.Get<char*>(A::Member(btnPtr, text));

            //Assert::IsTrue(strcmp(testText, "com") == 0);

            //Assert::IsTrue(ButtonBase::com == btnPtr->btnType);

            //char* dataRefNa = a->Variable.Get<char*>(A::MemberByName(btnPtr, "dataRefName"));

            //Assert::IsTrue(strcmp("sim/cockpit2/radios/actuators/com1_standby_frequency_hz_833", dataRefNa) == 0);

        }

    }

};

The bold line fails to compile due to 'potentially uninitialized local pointer variable 'value' used', however as a far as I can tell all of my variables are initialised. Any idea what's causing this?

Thanks John

asked ago by John Clapson (1.1k points)
I have managed to test this using typemock++ version 4. The new version 5 does not like the optimised code for x plane.

Please log in or register to answer this question.

...