test/testautomation_rect.c
author Andreas Schiffler <aschiffler@ferzkopp.net>
Mon, 24 Dec 2012 14:43:57 -0800
changeset 6772 5229a117ef97
parent 6769 b49778d885cd
child 7074 0545811b3543
permissions -rw-r--r--
Added audio test suite; minor code cleanups in test lib
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6757
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     1
/**
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     2
 * Original code: automated SDL rect test written by Edgar Simo "bobbens"
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     3
 * New/updated tests: aschiffler at ferzkopp dot net
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     4
 */
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     5
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     6
#include <stdio.h>
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     7
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     8
#include "SDL.h"
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     9
#include "SDL_test.h"
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    10
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    11
/* ================= Test Case Implementation ================== */
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    12
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    13
/* Helper functions */
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    14
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    15
/*!
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    16
 * \brief Private helper to check SDL_IntersectRectAndLine results
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    17
 */
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    18
void _validateIntersectRectAndLineResults(
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    19
    SDL_bool intersection, SDL_bool expectedIntersection,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    20
    SDL_Rect *rect, SDL_Rect * refRect,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    21
    int x1, int y1, int x2, int y2,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    22
    int x1Ref, int y1Ref, int x2Ref, int y2Ref)
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    23
{
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    24
    SDLTest_AssertCheck(intersection == expectedIntersection, 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    25
        "Check for correct intersection result: expected %s, got %s intersecting rect (%d,%d,%d,%d) with line (%d,%d - %d,%d)",
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    26
        (expectedIntersection == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    27
        (intersection == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    28
        refRect->x, refRect->y, refRect->w, refRect->h,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    29
        x1Ref, y1Ref, x2Ref, y2Ref);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    30
    SDLTest_AssertCheck(rect->x == refRect->x && rect->y == refRect->y && rect->w == refRect->w && rect->h == refRect->h,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    31
        "Check that source rectangle was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    32
        rect->x, rect->y, rect->w, rect->h,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    33
        refRect->x, refRect->y, refRect->w, refRect->h);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    34
    SDLTest_AssertCheck(x1 == x1Ref && y1 == y1Ref && x2 == x2Ref && y2 == y2Ref,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    35
        "Check if line was incorrectly clipped or modified: got (%d,%d - %d,%d) expected (%d,%d - %d,%d)",
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    36
        x1, y1, x2, y2,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    37
        x1Ref, y1Ref, x2Ref, y2Ref);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    38
}
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    39
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    40
/* Test case functions */
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    41
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    42
/*!
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    43
 * \brief Tests SDL_IntersectRectAndLine() clipping cases
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    44
 *
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    45
 * \sa
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    46
 * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRectAndLine
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    47
 */
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    48
int 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    49
rect_testIntersectRectAndLine (void *arg)
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    50
{
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    51
    SDL_Rect refRect = { 0, 0, 32, 32 };
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    52
    SDL_Rect rect;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    53
    int x1, y1;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    54
    int x2, y2;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    55
    SDL_bool intersected;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    56
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    57
    int xLeft = -SDLTest_RandomIntegerInRange(1, refRect.w);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    58
    int xRight = refRect.w + SDLTest_RandomIntegerInRange(1, refRect.w);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    59
    int yTop = -SDLTest_RandomIntegerInRange(1, refRect.h);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    60
    int yBottom = refRect.h + SDLTest_RandomIntegerInRange(1, refRect.h);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    61
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    62
    x1 = xLeft;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    63
    y1 = 15;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    64
    x2 = xRight;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    65
    y2 = 15;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    66
    rect = refRect;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    67
    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    68
    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 0, 15, 31, 15);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    69
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    70
    x1 = 15;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    71
    y1 = yTop;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    72
    x2 = 15;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    73
    y2 = yBottom;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    74
    rect = refRect;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    75
    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    76
    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 15, 0, 15, 31);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    77
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    78
    x1 = -refRect.w;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    79
    y1 = -refRect.h;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    80
    x2 = 2*refRect.w;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    81
    y2 = 2*refRect.h;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    82
    rect = refRect;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    83
    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    84
     _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 0, 0, 31, 31);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    85
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    86
    x1 = 2*refRect.w;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    87
    y1 = 2*refRect.h;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    88
    x2 = -refRect.w;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    89
    y2 = -refRect.h;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    90
    rect = refRect;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    91
    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    92
    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 31, 31, 0, 0);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    93
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    94
    x1 = -1;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    95
    y1 = 32;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    96
    x2 = 32;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    97
    y2 = -1;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    98
    rect = refRect;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    99
    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   100
    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 0, 31, 31, 0);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   101
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   102
    x1 = 32;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   103
    y1 = -1;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   104
    x2 = -1;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   105
    y2 = 32;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   106
    rect = refRect;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   107
    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   108
    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 31, 0, 0, 31);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   109
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   110
	return TEST_COMPLETED;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   111
}
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   112
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   113
/*!
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   114
 * \brief Tests SDL_IntersectRectAndLine() non-clipping case line inside
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   115
 *
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   116
 * \sa
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   117
 * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRectAndLine
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   118
 */
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   119
int 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   120
rect_testIntersectRectAndLineInside (void *arg)
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   121
{
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   122
    SDL_Rect refRect = { 0, 0, 32, 32 };
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   123
    SDL_Rect rect;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   124
    int x1, y1;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   125
    int x2, y2;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   126
    SDL_bool intersected;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   127
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   128
    int xmin = refRect.x;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   129
    int xmax = refRect.x + refRect.w - 1;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   130
    int ymin = refRect.y;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   131
    int ymax = refRect.y + refRect.h - 1;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   132
    int x1Ref = SDLTest_RandomIntegerInRange(xmin + 1, xmax - 1);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   133
    int y1Ref = SDLTest_RandomIntegerInRange(ymin + 1, ymax - 1);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   134
    int x2Ref = SDLTest_RandomIntegerInRange(xmin + 1, xmax - 1);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   135
    int y2Ref = SDLTest_RandomIntegerInRange(ymin + 1, ymax - 1);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   136
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   137
    x1 = x1Ref;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   138
    y1 = y1Ref;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   139
    x2 = x2Ref;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   140
    y2 = y2Ref;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   141
    rect = refRect;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   142
    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   143
    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, x1Ref, y1Ref, x2Ref, y2Ref);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   144
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   145
    x1 = x1Ref;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   146
    y1 = y1Ref;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   147
    x2 = xmax;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   148
    y2 = ymax;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   149
    rect = refRect;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   150
    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   151
    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, x1Ref, y1Ref, xmax, ymax);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   152
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   153
    x1 = xmin;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   154
    y1 = ymin;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   155
    x2 = x2Ref;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   156
    y2 = y2Ref;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   157
    rect = refRect;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   158
    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   159
    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, xmin, ymin, x2Ref, y2Ref);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   160
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   161
    x1 = xmin;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   162
    y1 = ymin;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   163
    x2 = xmax;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   164
    y2 = ymax;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   165
    rect = refRect;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   166
    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   167
    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, xmin, ymin, xmax, ymax);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   168
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   169
    x1 = xmin;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   170
    y1 = ymax;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   171
    x2 = xmax;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   172
    y2 = ymin;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   173
    rect = refRect;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   174
    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   175
    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, xmin, ymax, xmax, ymin);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   176
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   177
	return TEST_COMPLETED;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   178
}
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   179
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   180
/*!
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   181
 * \brief Tests SDL_IntersectRectAndLine() non-clipping cases outside
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   182
 *
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   183
 * \sa
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   184
 * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRectAndLine
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   185
 */
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   186
int 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   187
rect_testIntersectRectAndLineOutside (void *arg)
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   188
{
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   189
    SDL_Rect refRect = { 0, 0, 32, 32 };
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   190
    SDL_Rect rect;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   191
    int x1, y1;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   192
    int x2, y2;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   193
    SDL_bool intersected;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   194
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   195
    int xLeft = -SDLTest_RandomIntegerInRange(1, refRect.w);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   196
    int xRight = refRect.w + SDLTest_RandomIntegerInRange(1, refRect.w);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   197
    int yTop = -SDLTest_RandomIntegerInRange(1, refRect.h);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   198
    int yBottom = refRect.h + SDLTest_RandomIntegerInRange(1, refRect.h);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   199
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   200
    x1 = xLeft;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   201
    y1 = 0;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   202
    x2 = xLeft;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   203
    y2 = 31;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   204
    rect = refRect;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   205
    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   206
    _validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, xLeft, 0, xLeft, 31);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   207
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   208
    x1 = xRight;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   209
    y1 = 0;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   210
    x2 = xRight;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   211
    y2 = 31;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   212
    rect = refRect;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   213
    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   214
    _validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, xRight, 0, xRight, 31);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   215
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   216
    x1 = 0;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   217
    y1 = yTop;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   218
    x2 = 31;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   219
    y2 = yTop;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   220
    rect = refRect;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   221
    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   222
    _validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, 0, yTop, 31, yTop);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   223
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   224
    x1 = 0;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   225
    y1 = yBottom;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   226
    x2 = 31;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   227
    y2 = yBottom;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   228
    rect = refRect;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   229
    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   230
    _validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, 0, yBottom, 31, yBottom);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   231
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   232
	return TEST_COMPLETED;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   233
}
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   234
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   235
/*!
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   236
 * \brief Tests SDL_IntersectRectAndLine() with empty rectangle
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   237
 *
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   238
 * \sa
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   239
 * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRectAndLine
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   240
 */
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   241
int 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   242
rect_testIntersectRectAndLineEmpty (void *arg)
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   243
{
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   244
    SDL_Rect refRect;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   245
    SDL_Rect rect;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   246
    int x1, y1, x1Ref, y1Ref;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   247
    int x2, y2, x2Ref, y2Ref;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   248
    SDL_bool intersected;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   249
        
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   250
    refRect.x = SDLTest_RandomIntegerInRange(1, 1024);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   251
    refRect.y = SDLTest_RandomIntegerInRange(1, 1024);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   252
    refRect.w = 0;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   253
    refRect.h = 0;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   254
    x1Ref = refRect.x;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   255
    y1Ref = refRect.y;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   256
    x2Ref = SDLTest_RandomIntegerInRange(1, 1024);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   257
    y2Ref = SDLTest_RandomIntegerInRange(1, 1024);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   258
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   259
    x1 = x1Ref;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   260
    y1 = y1Ref;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   261
    x2 = x2Ref;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   262
    y2 = y2Ref;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   263
    rect = refRect;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   264
    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   265
    _validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, x1Ref, y1Ref, x2Ref, y2Ref);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   266
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   267
	return TEST_COMPLETED;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   268
}
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   269
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   270
/*!
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   271
 * \brief Negative tests against SDL_IntersectRectAndLine() with invalid parameters
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   272
 *
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   273
 * \sa
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   274
 * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRectAndLine
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   275
 */
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   276
int 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   277
rect_testIntersectRectAndLineParam (void *arg)
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   278
{
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   279
    SDL_Rect rect = { 0, 0, 32, 32 };
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   280
    int x1 = rect.w / 2;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   281
    int y1 = rect.h / 2;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   282
    int x2 = x1;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   283
    int y2 = 2 * rect.h;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   284
    SDL_bool intersected;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   285
    
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   286
    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   287
    SDLTest_AssertCheck(intersected == SDL_TRUE, "Check that intersection result was SDL_TRUE");
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   288
    
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   289
    intersected = SDL_IntersectRectAndLine((SDL_Rect *)NULL, &x1, &y1, &x2, &y2);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   290
    SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL");
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   291
    intersected = SDL_IntersectRectAndLine(&rect, (int *)NULL, &y1, &x2, &y2);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   292
    SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 2nd parameter is NULL");
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   293
    intersected = SDL_IntersectRectAndLine(&rect, &x1, (int *)NULL, &x2, &y2);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   294
    SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 3rd parameter is NULL");
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   295
    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, (int *)NULL, &y2);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   296
    SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 4th parameter is NULL");
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   297
    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, (int *)NULL);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   298
    SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 5th parameter is NULL");
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   299
    intersected = SDL_IntersectRectAndLine((SDL_Rect *)NULL, (int *)NULL, (int *)NULL, (int *)NULL, (int *)NULL);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   300
    SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when all parameters are NULL");
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   301
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   302
	return TEST_COMPLETED;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   303
}
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   304
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   305
/*!
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   306
 * \brief Private helper to check SDL_HasIntersection results
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   307
 */
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   308
void _validateHasIntersectionResults(
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   309
    SDL_bool intersection, SDL_bool expectedIntersection, 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   310
    SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB)
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   311
{
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   312
    SDLTest_AssertCheck(intersection == expectedIntersection, 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   313
        "Check intersection result: expected %s, got %s intersecting A (%d,%d,%d,%d) with B (%d,%d,%d,%d)",
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   314
        (expectedIntersection == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   315
        (intersection == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   316
        rectA->x, rectA->y, rectA->w, rectA->h, 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   317
        rectB->x, rectB->y, rectB->w, rectB->h);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   318
    SDLTest_AssertCheck(rectA->x == refRectA->x && rectA->y == refRectA->y && rectA->w == refRectA->w && rectA->h == refRectA->h,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   319
        "Check that source rectangle A was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   320
        rectA->x, rectA->y, rectA->w, rectA->h,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   321
        refRectA->x, refRectA->y, refRectA->w, refRectA->h);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   322
    SDLTest_AssertCheck(rectB->x == refRectB->x && rectB->y == refRectB->y && rectB->w == refRectB->w && rectB->h == refRectB->h,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   323
        "Check that source rectangle B was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   324
        rectB->x, rectB->y, rectB->w, rectB->h,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   325
        refRectB->x, refRectB->y, refRectB->w, refRectB->h);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   326
}
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   327
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   328
/*!
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   329
 * \brief Private helper to check SDL_IntersectRect results
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   330
 */
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   331
void _validateIntersectRectResults(
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   332
    SDL_bool intersection, SDL_bool expectedIntersection, 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   333
    SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB, 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   334
    SDL_Rect *result, SDL_Rect *expectedResult)
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   335
{
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   336
    _validateHasIntersectionResults(intersection, expectedIntersection, rectA, rectB, refRectA, refRectB);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   337
    if (result && expectedResult) {
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   338
        SDLTest_AssertCheck(result->x == expectedResult->x && result->y == expectedResult->y && result->w == expectedResult->w && result->h == expectedResult->h,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   339
            "Check that intersection of rectangles A (%d,%d,%d,%d) and B (%d,%d,%d,%d) was correctly calculated, got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   340
            rectA->x, rectA->y, rectA->w, rectA->h, 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   341
            rectB->x, rectB->y, rectB->w, rectB->h,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   342
            result->x, result->y, result->w, result->h,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   343
            expectedResult->x, expectedResult->y, expectedResult->w, expectedResult->h);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   344
    }
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   345
}
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   346
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   347
/*!
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   348
 * \brief Private helper to check SDL_UnionRect results
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   349
 */
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   350
void _validateUnionRectResults(
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   351
    SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB, 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   352
    SDL_Rect *result, SDL_Rect *expectedResult)
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   353
{
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   354
    SDLTest_AssertCheck(rectA->x == refRectA->x && rectA->y == refRectA->y && rectA->w == refRectA->w && rectA->h == refRectA->h,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   355
        "Check that source rectangle A was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   356
        rectA->x, rectA->y, rectA->w, rectA->h,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   357
        refRectA->x, refRectA->y, refRectA->w, refRectA->h);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   358
    SDLTest_AssertCheck(rectB->x == refRectB->x && rectB->y == refRectB->y && rectB->w == refRectB->w && rectB->h == refRectB->h,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   359
        "Check that source rectangle B was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   360
        rectB->x, rectB->y, rectB->w, rectB->h,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   361
        refRectB->x, refRectB->y, refRectB->w, refRectB->h);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   362
    SDLTest_AssertCheck(result->x == expectedResult->x && result->y == expectedResult->y && result->w == expectedResult->w && result->h == expectedResult->h,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   363
        "Check that union of rectangles A (%d,%d,%d,%d) and B (%d,%d,%d,%d) was correctly calculated, got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   364
        rectA->x, rectA->y, rectA->w, rectA->h, 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   365
        rectB->x, rectB->y, rectB->w, rectB->h,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   366
        result->x, result->y, result->w, result->h,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   367
        expectedResult->x, expectedResult->y, expectedResult->w, expectedResult->h);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   368
}
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   369
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   370
/*!
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   371
 * \brief Private helper to check SDL_RectEmpty results
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   372
 */
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   373
void _validateRectEmptyResults(
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   374
    SDL_bool empty, SDL_bool expectedEmpty, 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   375
    SDL_Rect *rect, SDL_Rect *refRect)
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   376
{
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   377
    SDLTest_AssertCheck(empty == expectedEmpty, 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   378
        "Check for correct empty result: expected %s, got %s testing (%d,%d,%d,%d)",
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   379
        (expectedEmpty == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   380
        (empty == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   381
        rect->x, rect->y, rect->w, rect->h);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   382
    SDLTest_AssertCheck(rect->x == refRect->x && rect->y == refRect->y && rect->w == refRect->w && rect->h == refRect->h,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   383
        "Check that source rectangle was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   384
        rect->x, rect->y, rect->w, rect->h,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   385
        refRect->x, refRect->y, refRect->w, refRect->h);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   386
}
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   387
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   388
/*!
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   389
 * \brief Private helper to check SDL_RectEquals results
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   390
 */
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   391
void _validateRectEqualsResults(
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   392
    SDL_bool equals, SDL_bool expectedEquals, 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   393
    SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB)
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   394
{
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   395
    SDLTest_AssertCheck(equals == expectedEquals, 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   396
        "Check for correct equals result: expected %s, got %s testing (%d,%d,%d,%d) and (%d,%d,%d,%d)",
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   397
        (expectedEquals == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   398
        (equals == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   399
        rectA->x, rectA->y, rectA->w, rectA->h,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   400
        rectB->x, rectB->y, rectB->w, rectB->h);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   401
    SDLTest_AssertCheck(rectA->x == refRectA->x && rectA->y == refRectA->y && rectA->w == refRectA->w && rectA->h == refRectA->h,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   402
        "Check that source rectangle A was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   403
        rectA->x, rectA->y, rectA->w, rectA->h,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   404
        refRectA->x, refRectA->y, refRectA->w, refRectA->h);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   405
    SDLTest_AssertCheck(rectB->x == refRectB->x && rectB->y == refRectB->y && rectB->w == refRectB->w && rectB->h == refRectB->h,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   406
        "Check that source rectangle B was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   407
        rectB->x, rectB->y, rectB->w, rectB->h,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   408
        refRectB->x, refRectB->y, refRectB->w, refRectB->h);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   409
}
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   410
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   411
/*!
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   412
 * \brief Tests SDL_IntersectRect() with B fully inside A
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   413
 *
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   414
 * \sa
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   415
 * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   416
 */
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   417
int rect_testIntersectRectInside (void *arg)
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   418
{
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   419
    SDL_Rect refRectA = { 0, 0, 32, 32 };
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   420
    SDL_Rect refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   421
    SDL_Rect rectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   422
    SDL_Rect rectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   423
    SDL_Rect result;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   424
    SDL_bool intersection;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   425
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   426
    // rectB fully contained in rectA
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   427
    refRectB.x = 0;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   428
    refRectB.y = 0;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   429
    refRectB.w = SDLTest_RandomIntegerInRange(refRectA.x + 1, refRectA.x + refRectA.w - 1);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   430
    refRectB.h = SDLTest_RandomIntegerInRange(refRectA.y + 1, refRectA.y + refRectA.h - 1);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   431
    rectA = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   432
    rectB = refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   433
    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   434
    _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &refRectB);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   435
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   436
	return TEST_COMPLETED;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   437
}
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   438
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   439
/*!
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   440
 * \brief Tests SDL_IntersectRect() with B fully outside A
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   441
 *
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   442
 * \sa
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   443
 * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   444
 */
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   445
int rect_testIntersectRectOutside (void *arg)
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   446
{
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   447
    SDL_Rect refRectA = { 0, 0, 32, 32 };
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   448
    SDL_Rect refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   449
    SDL_Rect rectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   450
    SDL_Rect rectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   451
    SDL_Rect result;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   452
    SDL_bool intersection;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   453
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   454
    // rectB fully outside of rectA
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   455
    refRectB.x = refRectA.x + refRectA.w + SDLTest_RandomIntegerInRange(1, 10);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   456
    refRectB.y = refRectA.y + refRectA.h + SDLTest_RandomIntegerInRange(1, 10);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   457
    refRectB.w = refRectA.w;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   458
    refRectB.h = refRectA.h;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   459
    rectA = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   460
    rectB = refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   461
    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   462
    _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);    
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   463
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   464
	return TEST_COMPLETED;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   465
}
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   466
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   467
/*!
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   468
 * \brief Tests SDL_IntersectRect() with B partially intersecting A
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   469
 *
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   470
 * \sa
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   471
 * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   472
 */
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   473
int rect_testIntersectRectPartial (void *arg)
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   474
{
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   475
    SDL_Rect refRectA = { 0, 0, 32, 32 };
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   476
    SDL_Rect refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   477
    SDL_Rect rectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   478
    SDL_Rect rectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   479
    SDL_Rect result;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   480
    SDL_Rect expectedResult;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   481
    SDL_bool intersection;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   482
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   483
    // rectB partially contained in rectA
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   484
    refRectB.x = SDLTest_RandomIntegerInRange(refRectA.x + 1, refRectA.x + refRectA.w - 1);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   485
    refRectB.y = SDLTest_RandomIntegerInRange(refRectA.y + 1, refRectA.y + refRectA.h - 1);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   486
    refRectB.w = refRectA.w;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   487
    refRectB.h = refRectA.h;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   488
    rectA = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   489
    rectB = refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   490
    expectedResult.x = refRectB.x;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   491
    expectedResult.y = refRectB.y;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   492
    expectedResult.w = refRectA.w - refRectB.x;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   493
    expectedResult.h = refRectA.h - refRectB.y;    
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   494
    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   495
    _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   496
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   497
    // rectB right edge
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   498
    refRectB.x = rectA.w - 1;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   499
    refRectB.y = rectA.y;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   500
    refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   501
    refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   502
    rectA = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   503
    rectB = refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   504
    expectedResult.x = refRectB.x;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   505
    expectedResult.y = refRectB.y;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   506
    expectedResult.w = 1;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   507
    expectedResult.h = refRectB.h;    
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   508
    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   509
    _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   510
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   511
    // rectB left edge
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   512
    refRectB.x = 1 - rectA.w;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   513
    refRectB.y = rectA.y;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   514
    refRectB.w = refRectA.w;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   515
    refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   516
    rectA = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   517
    rectB = refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   518
    expectedResult.x = 0;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   519
    expectedResult.y = refRectB.y;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   520
    expectedResult.w = 1;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   521
    expectedResult.h = refRectB.h;    
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   522
    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   523
    _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   524
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   525
    // rectB bottom edge
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   526
    refRectB.x = rectA.x;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   527
    refRectB.y = rectA.h - 1;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   528
    refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   529
    refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   530
    rectA = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   531
    rectB = refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   532
    expectedResult.x = refRectB.x;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   533
    expectedResult.y = refRectB.y;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   534
    expectedResult.w = refRectB.w;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   535
    expectedResult.h = 1;    
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   536
    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   537
    _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   538
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   539
    // rectB top edge
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   540
    refRectB.x = rectA.x;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   541
    refRectB.y = 1 - rectA.h;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   542
    refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   543
    refRectB.h = rectA.h;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   544
    rectA = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   545
    rectB = refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   546
    expectedResult.x = refRectB.x;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   547
    expectedResult.y = 0;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   548
    expectedResult.w = refRectB.w;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   549
    expectedResult.h = 1;    
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   550
    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   551
    _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   552
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   553
	return TEST_COMPLETED;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   554
}
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   555
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   556
/*!
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   557
 * \brief Tests SDL_IntersectRect() with 1x1 pixel sized rectangles
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   558
 *
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   559
 * \sa
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   560
 * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   561
 */
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   562
int rect_testIntersectRectPoint (void *arg)
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   563
{
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   564
    SDL_Rect refRectA = { 0, 0, 1, 1 };
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   565
    SDL_Rect refRectB = { 0, 0, 1, 1 };
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   566
    SDL_Rect rectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   567
    SDL_Rect rectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   568
    SDL_Rect result;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   569
    SDL_bool intersection;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   570
    int offsetX, offsetY;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   571
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   572
    // intersecting pixels
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   573
    refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   574
    refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   575
    refRectB.x = refRectA.x;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   576
    refRectB.y = refRectA.y;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   577
    rectA = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   578
    rectB = refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   579
    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   580
    _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &refRectA);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   581
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   582
    // non-intersecting pixels cases
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   583
    for (offsetX = -1; offsetX <= 1; offsetX++) {
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   584
        for (offsetY = -1; offsetY <= 1; offsetY++) {
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   585
            if (offsetX != 0 || offsetY != 0) {
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   586
                refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   587
                refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   588
                refRectB.x = refRectA.x;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   589
                refRectB.y = refRectA.y;    
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   590
                refRectB.x += offsetX;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   591
                refRectB.y += offsetY;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   592
                rectA = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   593
                rectB = refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   594
                intersection = SDL_IntersectRect(&rectA, &rectB, &result);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   595
                _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   596
            }
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   597
        }
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   598
    }
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   599
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   600
	return TEST_COMPLETED;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   601
}
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   602
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   603
/*!
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   604
 * \brief Tests SDL_IntersectRect() with empty rectangles
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   605
 *
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   606
 * \sa
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   607
 * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   608
 */
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   609
int rect_testIntersectRectEmpty (void *arg)
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   610
{
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   611
    SDL_Rect refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   612
    SDL_Rect refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   613
    SDL_Rect rectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   614
    SDL_Rect rectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   615
    SDL_Rect result;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   616
    SDL_bool intersection;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   617
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   618
    // Rect A empty
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   619
    refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   620
    refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   621
    refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   622
    refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   623
    refRectB = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   624
    refRectA.w = 0;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   625
    refRectA.h = 0;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   626
    rectA = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   627
    rectB = refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   628
    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   629
    _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   630
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   631
    // Rect B empty
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   632
    refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   633
    refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   634
    refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   635
    refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   636
    refRectB = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   637
    refRectB.w = 0;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   638
    refRectB.h = 0;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   639
    rectA = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   640
    rectB = refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   641
    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   642
    _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   643
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   644
    // Rect A and B empty
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   645
    refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   646
    refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   647
    refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   648
    refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   649
    refRectB = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   650
    refRectA.w = 0;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   651
    refRectA.h = 0;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   652
    refRectB.w = 0;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   653
    refRectB.h = 0;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   654
    rectA = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   655
    rectB = refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   656
    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   657
    _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   658
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   659
	return TEST_COMPLETED;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   660
}
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   661
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   662
/*!
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   663
 * \brief Negative tests against SDL_IntersectRect() with invalid parameters
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   664
 *
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   665
 * \sa
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   666
 * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   667
 */
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   668
int rect_testIntersectRectParam(void *arg)
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   669
{
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   670
    SDL_Rect rectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   671
    SDL_Rect rectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   672
    SDL_Rect result;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   673
    SDL_bool intersection;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   674
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   675
    // invalid parameter combinations
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   676
    intersection = SDL_IntersectRect((SDL_Rect *)NULL, &rectB, &result);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   677
    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL"); 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   678
    intersection = SDL_IntersectRect(&rectA, (SDL_Rect *)NULL, &result);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   679
    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 2st parameter is NULL"); 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   680
    intersection = SDL_IntersectRect(&rectA, &rectB, (SDL_Rect *)NULL);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   681
    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 3st parameter is NULL"); 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   682
    intersection = SDL_IntersectRect((SDL_Rect *)NULL, (SDL_Rect *)NULL, &result);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   683
    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st and 2nd parameters are NULL"); 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   684
    intersection = SDL_IntersectRect((SDL_Rect *)NULL, &rectB, (SDL_Rect *)NULL);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   685
    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st and 3rd parameters are NULL "); 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   686
    intersection = SDL_IntersectRect((SDL_Rect *)NULL, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   687
    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when all parameters are NULL");     
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   688
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   689
	return TEST_COMPLETED;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   690
}
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   691
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   692
/*!
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   693
 * \brief Tests SDL_HasIntersection() with B fully inside A
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   694
 *
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   695
 * \sa
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   696
 * http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   697
 */
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   698
int rect_testHasIntersectionInside (void *arg)
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   699
{
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   700
    SDL_Rect refRectA = { 0, 0, 32, 32 };
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   701
    SDL_Rect refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   702
    SDL_Rect rectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   703
    SDL_Rect rectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   704
    SDL_bool intersection;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   705
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   706
    // rectB fully contained in rectA
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   707
    refRectB.x = 0;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   708
    refRectB.y = 0;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   709
    refRectB.w = SDLTest_RandomIntegerInRange(refRectA.x + 1, refRectA.x + refRectA.w - 1);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   710
    refRectB.h = SDLTest_RandomIntegerInRange(refRectA.y + 1, refRectA.y + refRectA.h - 1);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   711
    rectA = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   712
    rectB = refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   713
    intersection = SDL_HasIntersection(&rectA, &rectB);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   714
    _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   715
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   716
	return TEST_COMPLETED;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   717
}
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   718
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   719
/*!
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   720
 * \brief Tests SDL_HasIntersection() with B fully outside A
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   721
 *
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   722
 * \sa
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   723
 * http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   724
 */
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   725
int rect_testHasIntersectionOutside (void *arg)
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   726
{
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   727
    SDL_Rect refRectA = { 0, 0, 32, 32 };
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   728
    SDL_Rect refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   729
    SDL_Rect rectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   730
    SDL_Rect rectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   731
    SDL_bool intersection;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   732
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   733
    // rectB fully outside of rectA
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   734
    refRectB.x = refRectA.x + refRectA.w + SDLTest_RandomIntegerInRange(1, 10);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   735
    refRectB.y = refRectA.y + refRectA.h + SDLTest_RandomIntegerInRange(1, 10);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   736
    refRectB.w = refRectA.w;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   737
    refRectB.h = refRectA.h;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   738
    rectA = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   739
    rectB = refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   740
    intersection = SDL_HasIntersection(&rectA, &rectB);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   741
    _validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   742
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   743
	return TEST_COMPLETED;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   744
}
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   745
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   746
/*!
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   747
 * \brief Tests SDL_HasIntersection() with B partially intersecting A
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   748
 *
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   749
 * \sa
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   750
 * http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   751
 */
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   752
int rect_testHasIntersectionPartial (void *arg)
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   753
{
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   754
    SDL_Rect refRectA = { 0, 0, 32, 32 };
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   755
    SDL_Rect refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   756
    SDL_Rect rectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   757
    SDL_Rect rectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   758
    SDL_bool intersection;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   759
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   760
    // rectB partially contained in rectA
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   761
    refRectB.x = SDLTest_RandomIntegerInRange(refRectA.x + 1, refRectA.x + refRectA.w - 1);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   762
    refRectB.y = SDLTest_RandomIntegerInRange(refRectA.y + 1, refRectA.y + refRectA.h - 1);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   763
    refRectB.w = refRectA.w;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   764
    refRectB.h = refRectA.h;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   765
    rectA = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   766
    rectB = refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   767
    intersection = SDL_HasIntersection(&rectA, &rectB);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   768
    _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   769
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   770
    // rectB right edge
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   771
    refRectB.x = rectA.w - 1;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   772
    refRectB.y = rectA.y;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   773
    refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   774
    refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   775
    rectA = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   776
    rectB = refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   777
    intersection = SDL_HasIntersection(&rectA, &rectB);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   778
    _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   779
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   780
    // rectB left edge
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   781
    refRectB.x = 1 - rectA.w;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   782
    refRectB.y = rectA.y;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   783
    refRectB.w = refRectA.w;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   784
    refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   785
    rectA = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   786
    rectB = refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   787
    intersection = SDL_HasIntersection(&rectA, &rectB);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   788
    _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   789
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   790
    // rectB bottom edge
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   791
    refRectB.x = rectA.x;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   792
    refRectB.y = rectA.h - 1;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   793
    refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   794
    refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   795
    rectA = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   796
    rectB = refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   797
    intersection = SDL_HasIntersection(&rectA, &rectB);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   798
    _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   799
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   800
    // rectB top edge
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   801
    refRectB.x = rectA.x;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   802
    refRectB.y = 1 - rectA.h;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   803
    refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   804
    refRectB.h = rectA.h;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   805
    rectA = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   806
    rectB = refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   807
    intersection = SDL_HasIntersection(&rectA, &rectB);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   808
    _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   809
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   810
	return TEST_COMPLETED;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   811
}
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   812
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   813
/*!
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   814
 * \brief Tests SDL_HasIntersection() with 1x1 pixel sized rectangles
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   815
 *
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   816
 * \sa
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   817
 * http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   818
 */
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   819
int rect_testHasIntersectionPoint (void *arg)
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   820
{
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   821
    SDL_Rect refRectA = { 0, 0, 1, 1 };
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   822
    SDL_Rect refRectB = { 0, 0, 1, 1 };
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   823
    SDL_Rect rectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   824
    SDL_Rect rectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   825
    SDL_bool intersection;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   826
    int offsetX, offsetY;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   827
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   828
    // intersecting pixels
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   829
    refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   830
    refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   831
    refRectB.x = refRectA.x;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   832
    refRectB.y = refRectA.y;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   833
    rectA = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   834
    rectB = refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   835
    intersection = SDL_HasIntersection(&rectA, &rectB);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   836
    _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   837
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   838
    // non-intersecting pixels cases
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   839
    for (offsetX = -1; offsetX <= 1; offsetX++) {
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   840
        for (offsetY = -1; offsetY <= 1; offsetY++) {
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   841
            if (offsetX != 0 || offsetY != 0) {
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   842
                refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   843
                refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   844
                refRectB.x = refRectA.x;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   845
                refRectB.y = refRectA.y;    
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   846
                refRectB.x += offsetX;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   847
                refRectB.y += offsetY;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   848
                rectA = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   849
                rectB = refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   850
                intersection = SDL_HasIntersection(&rectA, &rectB);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   851
                _validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   852
            }
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   853
        }
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   854
    }
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   855
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   856
	return TEST_COMPLETED;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   857
}
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   858
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   859
/*!
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   860
 * \brief Tests SDL_HasIntersection() with empty rectangles
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   861
 *
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   862
 * \sa
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   863
 * http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   864
 */
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   865
int rect_testHasIntersectionEmpty (void *arg)
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   866
{
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   867
    SDL_Rect refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   868
    SDL_Rect refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   869
    SDL_Rect rectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   870
    SDL_Rect rectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   871
    SDL_bool intersection;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   872
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   873
    // Rect A empty
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   874
    refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   875
    refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   876
    refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   877
    refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   878
    refRectB = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   879
    refRectA.w = 0;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   880
    refRectA.h = 0;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   881
    rectA = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   882
    rectB = refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   883
    intersection = SDL_HasIntersection(&rectA, &rectB);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   884
    _validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   885
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   886
    // Rect B empty
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   887
    refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   888
    refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   889
    refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   890
    refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   891
    refRectB = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   892
    refRectB.w = 0;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   893
    refRectB.h = 0;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   894
    rectA = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   895
    rectB = refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   896
    intersection = SDL_HasIntersection(&rectA, &rectB);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   897
    _validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   898
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   899
    // Rect A and B empty
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   900
    refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   901
    refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   902
    refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   903
    refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   904
    refRectB = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   905
    refRectA.w = 0;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   906
    refRectA.h = 0;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   907
    refRectB.w = 0;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   908
    refRectB.h = 0;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   909
    rectA = refRectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   910
    rectB = refRectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   911
    intersection = SDL_HasIntersection(&rectA, &rectB);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   912
    _validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   913
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   914
	return TEST_COMPLETED;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   915
}
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   916
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   917
/*!
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   918
 * \brief Negative tests against SDL_HasIntersection() with invalid parameters
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   919
 *
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   920
 * \sa
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   921
 * http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   922
 */
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   923
int rect_testHasIntersectionParam(void *arg)
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   924
{
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   925
    SDL_Rect rectA;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   926
    SDL_Rect rectB;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   927
    SDL_bool intersection;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   928
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   929
    // invalid parameter combinations
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   930
    intersection = SDL_HasIntersection((SDL_Rect *)NULL, &rectB);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   931
    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL"); 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   932
    intersection = SDL_HasIntersection(&rectA, (SDL_Rect *)NULL);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   933
    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 2st parameter is NULL"); 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   934
    intersection = SDL_HasIntersection((SDL_Rect *)NULL, (SDL_Rect *)NULL);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   935
    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when all parameters are NULL");     
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   936
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   937
	return TEST_COMPLETED;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   938
}
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   939
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   940
/*!
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   941
 * \brief Test SDL_EnclosePoints() without clipping
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   942
 *
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   943
 * \sa
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   944
 * http://wiki.libsdl.org/moin.cgi/SDL_EnclosePoints
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   945
 */
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   946
int rect_testEnclosePoints(void *arg)
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   947
{
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   948
    const int numPoints = 16;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   949
    SDL_Point refPoints[16];
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   950
    SDL_Point points[16];
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   951
    SDL_Rect result;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   952
    SDL_bool anyEnclosed;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   953
    SDL_bool anyEnclosedNoResult;
6772
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   954
    SDL_bool expectedEnclosed = SDL_TRUE;
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   955
    int newx, newy;
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   956
    int minx = 0, maxx = 0, miny = 0, maxy = 0;
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   957
    int i;
6757
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   958
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   959
    // Create input data, tracking result
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   960
    for (i=0; i<numPoints; i++) {
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   961
        newx = SDLTest_RandomIntegerInRange(-1024, 1024);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   962
        newy = SDLTest_RandomIntegerInRange(-1024, 1024);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   963
        refPoints[i].x = newx;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   964
        refPoints[i].y = newy;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   965
        points[i].x = newx;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   966
        points[i].y = newy;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   967
        if (i==0) {
6772
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   968
            minx = newx;
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   969
            maxx = newx;
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   970
            miny = newy;
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   971
            maxy = newy;
6757
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   972
        } else {
6772
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   973
            if (newx < minx) minx = newx;
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   974
            if (newx > maxx) maxx = newx;
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   975
            if (newy < miny) miny = newy;
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   976
            if (newy > maxy) maxy = newy;
6757
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   977
        }
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   978
    }
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   979
    
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   980
    // Call function and validate - special case: no result requested
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   981
    anyEnclosedNoResult = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, (SDL_Rect *)NULL);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   982
    SDLTest_AssertCheck(expectedEnclosed==anyEnclosedNoResult, 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   983
        "Check expected return value %s, got %s", 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   984
        (expectedEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE", 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   985
		(anyEnclosedNoResult==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   986
    for (i=0; i<numPoints; i++) {
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   987
        SDLTest_AssertCheck(refPoints[i].x==points[i].x && refPoints[i].y==points[i].y,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   988
            "Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)", 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   989
            i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   990
    }
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   991
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   992
    // Call function and validate
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   993
    anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, &result);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   994
    SDLTest_AssertCheck(expectedEnclosed==anyEnclosed, 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   995
        "Check return value %s, got %s", 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   996
        (expectedEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE", 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   997
		(anyEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   998
    for (i=0; i<numPoints; i++) {
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   999
        SDLTest_AssertCheck(refPoints[i].x==points[i].x && refPoints[i].y==points[i].y,
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1000
            "Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)", 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1001
            i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1002
    }
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1003
    SDLTest_AssertCheck(result.x==minx && result.y==miny && result.w==(maxx - minx + 1) && result.h==(maxy - miny + 1),
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1004
        "Resulting enclosing rectangle incorrect: expected (%i,%i - %i,%i), actual (%i,%i - %i,%i)",
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1005
        minx, miny, maxx, maxy, result.x, result.y, result.x + result.w - 1, result.y + result.h - 1);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1006
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1007
	return TEST_COMPLETED;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1008
}
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1009
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1010
/*!
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1011
 * \brief Test SDL_EnclosePoints() with repeated input points
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1012
 *
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1013
 * \sa
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1014
 * http://wiki.libsdl.org/moin.cgi/SDL_EnclosePoints
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1015
 */
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1016
int rect_testEnclosePointsRepeatedInput(void *arg)
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1017
{
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1018
    const int numPoints = 8;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1019
    const int halfPoints = 4;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1020
    SDL_Point refPoints[8];
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1021
    SDL_Point points[8];
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1022
    SDL_Rect result;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1023
    SDL_bool anyEnclosed;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1024
    SDL_bool anyEnclosedNoResult;
6772
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
  1025
    SDL_bool expectedEnclosed = SDL_TRUE;
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
  1026
    int newx, newy;
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
  1027
    int minx = 0, maxx = 0, miny = 0, maxy = 0;
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
  1028
    int i;
6757
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1029
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1030
    // Create input data, tracking result
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1031
    for (i=0; i<numPoints; i++) {
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1032
        if (i < halfPoints) {
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1033
            newx = SDLTest_RandomIntegerInRange(-1024, 1024);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1034
            newy = SDLTest_RandomIntegerInRange(-1024, 1024);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1035
        } else {
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1036
            newx = refPoints[i-halfPoints].x;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1037
            newy = refPoints[i-halfPoints].y;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1038
        }
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1039
        refPoints[i].x = newx;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1040
        refPoints[i].y = newy;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1041
        points[i].x = newx;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1042
        points[i].y = newy;
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1043
        if (i==0) {
6772
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
  1044
            minx = newx;
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
  1045
            maxx = newx;
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
  1046
            miny = newy;
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
  1047
            maxy = newy;
6757
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1048
        } else {
6772
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
  1049
            if (newx < minx) minx = newx;
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
  1050
            if (newx > maxx) maxx = newx;
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
  1051
            if (newy < miny) miny = newy;
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
  1052
            if (newy > maxy) maxy = newy;
6757
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1053
        }
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1054
    }
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1055
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1056
    // Call function and validate - special case: no result requested
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1057
    anyEnclosedNoResult = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, (SDL_Rect *)NULL);
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1058
    SDLTest_AssertCheck(expectedEnclosed==anyEnclosedNoResult, 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1059
        "Check return value %s, got %s", 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1060
        (expectedEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE", 
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1061
		(anyEnclosedNoResult==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1062
    for (i=0; i<numPoints; i++) {
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1063
        SDLTest_AssertCheck(refPoints[i].x==points[i].x && refPoints[i].y==points[i].y,
9935f71c8c81 Fixes in h