1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
/* Tests a bug in for loops where b in plot_point is always 1.
Stripped down from the gbdk filltest.c
*/
#include <testfwk.h>
typedef unsigned char UBYTE;
UBYTE
getpix(UBYTE x, UBYTE y)
{
UNUSED(x);
UNUSED(y);
return 0;
}
void
color(UBYTE a, UBYTE b, UBYTE c)
{
UNUSED(a & b & c);
}
void
line(UBYTE a, UBYTE b, UBYTE c, UBYTE d)
{
UNUSED(a & b & c & d);
}
void
plot_point(UBYTE a, UBYTE b)
{
static UBYTE ea, eb;
ASSERT(b == eb);
ASSERT(a == ea);
ea++;
if (ea > 12) {
ea = 0;
eb++;
}
LOG(("(a, b) -> (%u, %u)\n", (unsigned int)a, (unsigned int)b));
}
void
testForMerge(void)
{
UBYTE a,b;
for (b=0; b<=10U; b++) {
for (a=0; a<=12U; a++) {
color(getpix(a,b+1), 0, 1);
plot_point(a,b);
}
color(0, 0, 1);
}
}
|