tddec-code icon indicating copy to clipboard operation
tddec-code copied to clipboard

IGNORE_TEST counting using unity.framework doesn't work

Open mmz-zmm opened this issue 7 years ago • 0 comments

I am follwing the book Test-Driven Development for Embedded C to learn about TDD. Recently I come across the usage of IGNORE_TEST, which is based on unity.framework, the test case is quite simple, just the same as the code shown in the end of Section 4.1(I am using the Chinese version).

#include "unity_fixture.h"
TEST_GROUP_RUNNER(LedDriver)
{
	RUN_TEST_CASE(LedDriver, LedsOffAfterCreate);
	RUN_TEST_CASE(LedDriver, TurnOnLedOne);
	RUN_TEST_CASE(LedDriver, TurnOffLedOne);
	RUN_TEST_CASE(LedDriver, TurnOnMultipleLeds);
	RUN_TEST_CASE(LedDriver, AllOn);
	RUN_TEST_CASE(LedDriver, TurnOffAnyLed);
	RUN_TEST_CASE(LedDriver, LedMemoryIsNotReadable);
	RUN_TEST_CASE(LedDriver, UpperAndLowerBounds);
	RUN_TEST_CASE(LedDriver, OutOfBoundsTurnOnDoesNoHarm);
	RUN_TEST_CASE(LedDriver, OutOfBoundsTurnOffDoesNoHarm);
	RUN_TEST_CASE(LedDriver, OutOfBoundsProducesRuntimeError);
	RUN_TEST_CASE(LedDriver, OutOfBoundsToDo);
}

here is the output of the original code: 1516717473 1 you can see that the ignore test case was marked but not counted.

I have search the net to figure out the reason, and I check the source code of unity atThrowTheSwitch/Unity, at line 120, the code is different from code here, after I change it:

    //Unity.CurrentTestIgnored = 1;
	Unity.TestIgnores ++;

It worked and I get the right ignored test count number. So I think may be there is something wrong.

mmz-zmm avatar Jan 23 '18 14:01 mmz-zmm