mercredi 8 avril 2015

UnitTests with c++ doublyLinkedLists

Im working on an assignment where we need to debug for all of the memory errors and then run these UnitTests to make sure that it works. The unit tests were provided by the instructor as well as a large part of the code.


Here is a link to the UnitTests i am running : http://ift.tt/1DKLTp3


Here is a link to the methods that i am questioning : http://ift.tt/1CWoflQ


Why I am confused is that the test for the AddSingleItemFront is passing, while the AddSingleItemBack is not. They are pretty much the same UnitTest except for one calls AddBack while the other calls AddFront, and the methods themselves are almost identical. The error that is being thrown from the test for the AddSingleItemBack test is :


Message: Assert failed. Expected: <1> Actual: <3> - AddSingleItemBack GetNbrOfNodes Incorrect


The only time GetNbrOfNodes is incremented is when you call a node constructor, and its decremented whenever you call the node destructor. So where am i getting those 2 node constructor calls from the code that i have posted.


Aucun commentaire:

Enregistrer un commentaire