ThrowTheSwitch/Unity — pull request #64 by alejmrm (2014-03-07 03:02:05+00:00)
Title: [Feature] Range Testing TEST_CASE()-like macro

Sometimes I want to sweep a function under test with a range of values that stress it. Initially, I start by adding a TEST_CASE() macro before the test as described in the documentation and works fine, but overtime I am ending up with several TEST_CASE() macros. What I am proposing is that TEST_CASE-like macro takes a range of values that are passed to the test function.

```C
TEST_RANGE( [ 11, 20, 1 ], [ 0.0, 5.0, 0.5] );
void test_foo(int a, float b)
{
/* your standard test goes here */
};
```

Where the TEST_RANGE() macro will take the following entries per array item:
arg1 => start range
arg2 => stop range
arg3 => the increment unit

So the following example:
```C
TEST_RANGE( [ 1, 3, 1 ], [ 0.0, 2.0, 1.0] );
```
Will create two nested loops, the top loop start with a value equal to 1 and increments by 1 until reach 3, while the inner loop starts with a value of 0.0 and increments by 1.0 until reach 2.0.

The declaration is similar as TEST_CASE(), for example:
```C
#define TEST_RANGE(...)
```

Translated the above example into sudo-ruby, we get:
```Ruby
range_int = 0
while range_int <= 3 do # 1st argument
range_float = 0.0
while range_float <= 2.0 do # 2nd argument
output.puts("RUN_TEST( test_foo, line_number, range_int, range_float );")
range_float += 1.0
end
range_int += 1
end
```

In the runner we will end-up with the following familiar structure:
```C
...
RUN_TEST( test_foo, range_int, , 0, 0.0 )
RUN_TEST( test_foo, range_int, , 0, 1.0 )
RUN_TEST( test_foo, range_int, , 0, 2.0 )
RUN_TEST( test_foo, range_int, , 1, 0.0 )
RUN_TEST( test_foo, range_int, , 1, 1.0 )
RUN_TEST( test_foo, range_int, , 1, 2.0 )
RUN_TEST( test_foo, range_int, , 2, 0.0 )
RUN_TEST( test_foo, range_int, , 2, 1.0 )
RUN_TEST( test_foo, range_int, , 2, 2.0 )
RUN_TEST( test_foo, range_int, , 3, 0.0 )
RUN_TEST( test_foo, range_int, , 3, 1.0 )
RUN_TEST( test_foo, range_int, , 3, 2.0 )
...
```