[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] cmocka: Allow to pass initial data to test cases


Hello

On 06/11/2015 01:46 PM, Jakub Hrozek wrote:
On 09.06.2015 10:59, Pawel Szewczyk wrote:
Just a ping to let you know about pending path.


Andreas is away on vacation for some time..

But in the meantime, this thread might be similar to what you propose..
https://cmocka.org/archive/cmocka/2014-06/0000000.html


Thanks, i did not see this thread before.
I think the problem Nick was trying to resolve is the same as mine, but I don't see solution in what Andreas proposed - testing multiple data sets in single unit test, ie.

void my_test(void **state) {
	int array[] = { 1, 2, 17 };
	int i;

	for (i = 0; i < ARRAY_SIZE(array); i++) {
		my_prime_test(array[i]);
	}
}

For me it's far from ideal. When test fails I cannot tell exactly which data sets caused the failure and which not. With legacy unit tests there was no simple solution for that (except writing a lot of ugly setup functions), but since we define unit test as a structure, adding additional field in it is not a big deal.

Regards
Paweł


References:
Re: [PATCH] cmocka: Allow to pass initial data to test casesPawel Szewczyk <p.szewczyk@xxxxxxxxxxx>
Re: [PATCH] cmocka: Allow to pass initial data to test casesJakub Hrozek <jakub.hrozek@xxxxxxxxx>