mardi 11 avril 2017

How to perform Unit Testing on complicated functions

I have a class XYZ which has some function whivh I need to test using Catch Unit-testing. I am in a state of confusion what can be the possibility to test the function. Can anyone help on this?

Test code is below:

UaStatus XYZ::encodeVariantAsBinary(UaVariant variant, UaByteString *dst)
    {
        UaStatus status;
        status = m_encoder.create();
    if (status.isGood())
    {
        status = m_encoder.writeVariant("value", variant);
        if (status.isGood())
        {
            status = m_encoder.getBuffer(*dst);
        }
    }

    return status;
}

Br/RG

Aucun commentaire:

Enregistrer un commentaire