mt4-unittest icon indicating copy to clipboard operation
mt4-unittest copied to clipboard

Unittest summary can ouput negative values

Open femtotrader opened this issue 10 years ago • 0 comments

Hello,

if tests are run every tick like this

void OnTick()
{
    if (paramUnitTesting) {
        runAllTests();
    }
}

and your test have failure, summary can display negative values like

2014.04.21 09:45:19.236 my_test EURUSD,M15:   Total: 1, Success: -2 (-200.00%), Failure: 3 (300.00%)

I suggest to add

class UnitTest
{
public:
   ...    
    void initUnitTest();
}

void UnitTest::initUnitTest(void)
{
    m_successTestCount = 0;
    m_failureTestCount = 0;
}

and do

void OnTick()
{
    if (paramUnitTesting) {
        unittest.initUnitTest();
        runAllTests();
        //unittest.printSummary(); // uncomment this to get summary every tick
    }
}

Regards

femtotrader avatar Apr 21 '14 07:04 femtotrader