P
Peithon
Hi,
I'm initialising unit test structures using a macro as follows:
#define UTMACRO(x) UT##x
typedef struct
{
char * key;
char * arr[5];
}unit_test;
unit_test UT1 = { "three", { "five", "four", "one", "three",
"two" } };
unit_test UT2 = { "two", { "five", "four", "one", "three",
"two" } };
int main()
{
int i;
unit_test unitTest[2];
for(i = 0; i < TEST_NUM; i++)
{
unitTest = UTMACRO(i + 1);
}
}
but the compiler is resolving UTMACRO(i + 1) as UT rather than UT1 and
then UT2.
Why? Can this be fixed or does anyone have a better way of performing
this task.
I'm initialising unit test structures using a macro as follows:
#define UTMACRO(x) UT##x
typedef struct
{
char * key;
char * arr[5];
}unit_test;
unit_test UT1 = { "three", { "five", "four", "one", "three",
"two" } };
unit_test UT2 = { "two", { "five", "four", "one", "three",
"two" } };
int main()
{
int i;
unit_test unitTest[2];
for(i = 0; i < TEST_NUM; i++)
{
unitTest = UTMACRO(i + 1);
}
}
but the compiler is resolving UTMACRO(i + 1) as UT rather than UT1 and
then UT2.
Why? Can this be fixed or does anyone have a better way of performing
this task.