test/testautomation_rect.c
author Ryan C. Gordon <icculus@icculus.org>
Fri, 12 Aug 2016 19:59:00 -0400
changeset 10266 c09f06c4e8c8
parent 7678 286c42d7c5ed
permissions -rw-r--r--
emscripten: send fake mouse events for touches, like other targets do. (This really should be handled at the higher level and not in the individual targets, but this fixes the immediate bug.)
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
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
    15
/* !
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
    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
{
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
    24
    SDLTest_AssertCheck(intersection == expectedIntersection,
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
    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
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
    42
/* !
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
    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
 */
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
    48
int
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
    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
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   110
    return TEST_COMPLETED;
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
   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
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   113
/* !
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
   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
 */
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   119
int
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
   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
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   177
    return TEST_COMPLETED;
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
   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
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   180
/* !
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
   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
 */
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   186
int
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
   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
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   232
    return TEST_COMPLETED;
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
   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
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   235
/* !
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
   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
 */
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   241
int
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
   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;
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   249
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
   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
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   267
    return TEST_COMPLETED;
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
   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
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   270
/* !
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
   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
 */
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   276
int
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
   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;
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   285
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
   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");
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   288
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
   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
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   302
    return TEST_COMPLETED;
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
   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
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   305
/* !
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
   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(
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   309
    SDL_bool intersection, SDL_bool expectedIntersection,
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
   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
{
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   312
    SDLTest_AssertCheck(intersection == expectedIntersection,
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
   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",
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   316
        rectA->x, rectA->y, rectA->w, rectA->h,
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
   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
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   328
/* !
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
   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(
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   332
    SDL_bool intersection, SDL_bool expectedIntersection,
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   333
    SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB,
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
   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)",
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   340
            rectA->x, rectA->y, rectA->w, rectA->h,
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
   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
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   347
/* !
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
   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(
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   351
    SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB,
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
   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)",
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   364
        rectA->x, rectA->y, rectA->w, rectA->h,
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
   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
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   370
/* !
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
   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(
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   374
    SDL_bool empty, SDL_bool expectedEmpty,
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
   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
{
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   377
    SDLTest_AssertCheck(empty == expectedEmpty,
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
   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
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   388
/* !
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
   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(
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   392
    SDL_bool equals, SDL_bool expectedEquals,
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
   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
{
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   395
    SDLTest_AssertCheck(equals == expectedEquals,
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
   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
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   411
/* !
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
   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
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   426
    /* rectB fully contained in rectA */
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
   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
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   436
    return TEST_COMPLETED;
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
   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
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   439
/* !
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
   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
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   454
    /* rectB fully outside of rectA */
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
   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);
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   462
    _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
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
   463
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   464
    return TEST_COMPLETED;
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
   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
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   467
/* !
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
   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
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   483
    /* rectB partially contained in rectA */
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
   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;
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   493
    expectedResult.h = refRectA.h - refRectB.y;
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
   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
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   497
    /* rectB right edge */
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
   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;
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   507
    expectedResult.h = refRectB.h;
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
   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
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   511
    /* rectB left edge */
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
   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;
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   521
    expectedResult.h = refRectB.h;
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
   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
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   525
    /* rectB bottom edge */
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
   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;
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   535
    expectedResult.h = 1;
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
   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
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   539
    /* rectB top edge */
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
   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;
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   549
    expectedResult.h = 1;
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
   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
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   553
    return TEST_COMPLETED;
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
   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
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   556
/* !
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
   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
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   572
    /* intersecting pixels */
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
   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
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   582
    /* non-intersecting pixels cases */
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
   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;
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   589
                refRectB.y = refRectA.y;
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
   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
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   600
    return TEST_COMPLETED;
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
   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
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   603
/* !
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
   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;
7074
0545811b3543 Fix bug 1789: SDL_IntersectRect intersection with empty rect does not set result to empty; add test coverage to Rect suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   617
    SDL_bool empty;
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
   618
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   619
    /* Rect A empty */
7074
0545811b3543 Fix bug 1789: SDL_IntersectRect intersection with empty rect does not set result to empty; add test coverage to Rect suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   620
    result.w = SDLTest_RandomIntegerInRange(1, 100);
0545811b3543 Fix bug 1789: SDL_IntersectRect intersection with empty rect does not set result to empty; add test coverage to Rect suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   621
    result.h = SDLTest_RandomIntegerInRange(1, 100);
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
   622
    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
   623
    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
   624
    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
   625
    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
   626
    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
   627
    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
   628
    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
   629
    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
   630
    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
   631
    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
   632
    _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
7074
0545811b3543 Fix bug 1789: SDL_IntersectRect intersection with empty rect does not set result to empty; add test coverage to Rect suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   633
    empty = (SDL_bool)SDL_RectEmpty(&result);
0545811b3543 Fix bug 1789: SDL_IntersectRect intersection with empty rect does not set result to empty; add test coverage to Rect suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   634
    SDLTest_AssertCheck(empty == SDL_TRUE, "Validate result is empty Rect; got: %s", (empty == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   635
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   636
    /* Rect B empty */
7074
0545811b3543 Fix bug 1789: SDL_IntersectRect intersection with empty rect does not set result to empty; add test coverage to Rect suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   637
    result.w = SDLTest_RandomIntegerInRange(1, 100);
0545811b3543 Fix bug 1789: SDL_IntersectRect intersection with empty rect does not set result to empty; add test coverage to Rect suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   638
    result.h = SDLTest_RandomIntegerInRange(1, 100);
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
   639
    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
   640
    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
   641
    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
   642
    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
   643
    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
   644
    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
   645
    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
   646
    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
   647
    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
   648
    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
   649
    _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
7074
0545811b3543 Fix bug 1789: SDL_IntersectRect intersection with empty rect does not set result to empty; add test coverage to Rect suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   650
    empty = (SDL_bool)SDL_RectEmpty(&result);
0545811b3543 Fix bug 1789: SDL_IntersectRect intersection with empty rect does not set result to empty; add test coverage to Rect suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   651
    SDLTest_AssertCheck(empty == SDL_TRUE, "Validate result is empty Rect; got: %s", (empty == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
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
   652
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   653
    /* Rect A and B empty */
7074
0545811b3543 Fix bug 1789: SDL_IntersectRect intersection with empty rect does not set result to empty; add test coverage to Rect suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   654
    result.w = SDLTest_RandomIntegerInRange(1, 100);
0545811b3543 Fix bug 1789: SDL_IntersectRect intersection with empty rect does not set result to empty; add test coverage to Rect suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   655
    result.h = SDLTest_RandomIntegerInRange(1, 100);
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
   656
    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
   657
    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
   658
    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
   659
    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
   660
    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
   661
    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
   662
    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
   663
    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
   664
    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
   665
    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
   666
    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
   667
    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
   668
    _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
7074
0545811b3543 Fix bug 1789: SDL_IntersectRect intersection with empty rect does not set result to empty; add test coverage to Rect suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   669
    empty = (SDL_bool)SDL_RectEmpty(&result);
0545811b3543 Fix bug 1789: SDL_IntersectRect intersection with empty rect does not set result to empty; add test coverage to Rect suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   670
    SDLTest_AssertCheck(empty == SDL_TRUE, "Validate result is empty Rect; got: %s", (empty == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
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
   671
7074
0545811b3543 Fix bug 1789: SDL_IntersectRect intersection with empty rect does not set result to empty; add test coverage to Rect suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   672
    return TEST_COMPLETED;
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
   673
}
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
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   675
/* !
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
   676
 * \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
   677
 *
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
 * \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
   679
 * 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
   680
 */
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
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
   682
{
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
    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
   684
    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
   685
    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
   686
    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
   687
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   688
    /* invalid parameter combinations */
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
   689
    intersection = SDL_IntersectRect((SDL_Rect *)NULL, &rectB, &result);
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   690
    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL");
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
   691
    intersection = SDL_IntersectRect(&rectA, (SDL_Rect *)NULL, &result);
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   692
    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 2st parameter is NULL");
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
   693
    intersection = SDL_IntersectRect(&rectA, &rectB, (SDL_Rect *)NULL);
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   694
    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 3st parameter is NULL");
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
   695
    intersection = SDL_IntersectRect((SDL_Rect *)NULL, (SDL_Rect *)NULL, &result);
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   696
    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st and 2nd parameters are NULL");
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
   697
    intersection = SDL_IntersectRect((SDL_Rect *)NULL, &rectB, (SDL_Rect *)NULL);
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   698
    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st and 3rd parameters are NULL ");
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
   699
    intersection = SDL_IntersectRect((SDL_Rect *)NULL, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   700
    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when all parameters are NULL");
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
   701
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   702
    return TEST_COMPLETED;
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
   703
}
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
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   705
/* !
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
   706
 * \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
   707
 *
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
 * \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
   709
 * 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
   710
 */
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
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
   712
{
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
    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
   714
    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
   715
    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
   716
    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
   717
    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
   718
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   719
    /* rectB fully contained in rectA */
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
   720
    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
   721
    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
   722
    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
   723
    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
   724
    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
   725
    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
   726
    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
   727
    _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
   728
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   729
    return TEST_COMPLETED;
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
   730
}
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
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   732
/* !
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
   733
 * \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
   734
 *
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
 * \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
   736
 * 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
   737
 */
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
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
   739
{
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
    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
   741
    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
   742
    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
   743
    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
   744
    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
   745
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   746
    /* rectB fully outside of rectA */
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
   747
    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
   748
    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
   749
    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
   750
    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
   751
    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
   752
    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
   753
    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
   754
    _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
   755
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   756
    return TEST_COMPLETED;
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
   757
}
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
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   759
/* !
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
   760
 * \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
   761
 *
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
 * \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
   763
 * 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
   764
 */
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
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
   766
{
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
    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
   768
    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
   769
    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
   770
    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
   771
    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
   772
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   773
    /* rectB partially contained in rectA */
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
   774
    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
   775
    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
   776
    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
   777
    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
   778
    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
   779
    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
   780
    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
   781
    _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
   782
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   783
    /* rectB right edge */
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
   784
    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
   785
    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
   786
    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
   787
    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
   788
    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
   789
    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
   790
    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
   791
    _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
   792
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   793
    /* rectB left edge */
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
   794
    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
   795
    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
   796
    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
   797
    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
   798
    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
   799
    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
   800
    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
   801
    _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
   802
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   803
    /* rectB bottom edge */
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
   804
    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
   805
    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
   806
    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
   807
    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
   808
    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
   809
    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
   810
    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
   811
    _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
   812
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   813
    /* rectB top edge */
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
   814
    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
   815
    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
   816
    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
   817
    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
   818
    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
   819
    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
   820
    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
   821
    _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
   822
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   823
    return TEST_COMPLETED;
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
   824
}
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
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   826
/* !
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
   827
 * \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
   828
 *
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
 * \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
   830
 * 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
   831
 */
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
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
   833
{
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
    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
   835
    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
   836
    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
   837
    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
   838
    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
   839
    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
   840
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   841
    /* intersecting pixels */
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
   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
    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
   847
    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
   848
    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
   849
    _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
   850
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   851
    /* non-intersecting pixels cases */
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
   852
    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
   853
        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
   854
            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
   855
                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
   856
                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
   857
                refRectB.x = refRectA.x;
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   858
                refRectB.y = refRectA.y;
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
   859
                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
   860
                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
   861
                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
   862
                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
   863
                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
   864
                _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
   865
            }
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
    }
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
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   869
    return TEST_COMPLETED;
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
   870
}
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
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   872
/* !
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
   873
 * \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
   874
 *
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
 * \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
   876
 * 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
   877
 */
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
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
   879
{
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
    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
   881
    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
   882
    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
   883
    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
   884
    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
   885
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   886
    /* Rect A empty */
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
   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
    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
   893
    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
   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
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   899
    /* Rect B empty */
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
   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
    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
   906
    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
   907
    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
   908
    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
   909
    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
   910
    _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
   911
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   912
    /* Rect A and B empty */
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
   913
    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
   914
    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
   915
    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
   916
    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
   917
    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
   918
    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
   919
    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
   920
    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
   921
    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
   922
    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
   923
    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
   924
    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
   925
    _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
   926
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   927
    return TEST_COMPLETED;
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
   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
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   930
/* !
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
   931
 * \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
   932
 *
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
 * \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
   934
 * 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
   935
 */
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
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
   937
{
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
    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
   939
    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
   940
    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
   941
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   942
    /* invalid parameter combinations */
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
   943
    intersection = SDL_HasIntersection((SDL_Rect *)NULL, &rectB);
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   944
    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL");
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
   945
    intersection = SDL_HasIntersection(&rectA, (SDL_Rect *)NULL);
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   946
    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 2st parameter is NULL");
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
   947
    intersection = SDL_HasIntersection((SDL_Rect *)NULL, (SDL_Rect *)NULL);
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   948
    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when all parameters are NULL");
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
   949
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   950
    return TEST_COMPLETED;
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
   951
}
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
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   953
/* !
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
   954
 * \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
   955
 *
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   956
 * \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
   957
 * 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
   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
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
   960
{
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
    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
   962
    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
   963
    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
   964
    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
   965
    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
   966
    SDL_bool anyEnclosedNoResult;
6772
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   967
    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
   968
    int newx, newy;
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   969
    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
   970
    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
   971
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   972
    /* Create input data, tracking result */
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
   973
    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
   974
        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
   975
        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
   976
        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
   977
        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
   978
        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
   979
        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
   980
        if (i==0) {
6772
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   981
            minx = newx;
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   982
            maxx = newx;
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   983
            miny = newy;
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   984
            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
   985
        } else {
6772
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   986
            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
   987
            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
   988
            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
   989
            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
   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
    }
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   992
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   993
    /* Call function and validate - special case: no result requested */
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
   994
    anyEnclosedNoResult = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, (SDL_Rect *)NULL);
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   995
    SDLTest_AssertCheck(expectedEnclosed==anyEnclosedNoResult,
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   996
        "Check expected return value %s, got %s",
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   997
        (expectedEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
   998
        (anyEnclosedNoResult==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
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
   999
    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
  1000
        SDLTest_AssertCheck(refPoints[i].x==points[i].x && refPoints[i].y==points[i].y,
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
  1001
            "Check that source point %i was not modified: expected (%i,%i) actual (%i,%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
  1002
            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
  1003
    }
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
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
  1005
    /* Call function and validate */
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
  1006
    anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, &result);
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
  1007
    SDLTest_AssertCheck(expectedEnclosed==anyEnclosed,
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
  1008
        "Check return value %s, got %s",
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
  1009
        (expectedEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
  1010
        (anyEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
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
  1011
    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
  1012
        SDLTest_AssertCheck(refPoints[i].x==points[i].x && refPoints[i].y==points[i].y,
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
  1013
            "Check that source point %i was not modified: expected (%i,%i) actual (%i,%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
  1014
            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
  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
    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
  1017
        "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
  1018
        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
  1019
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7074
diff changeset
  1020
    return TEST_COMPLETED;
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
  1021
}
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
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
  1023
/* !
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
  1024
 * \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
  1025
 *
9935f71c8c81 Fixes in harness and fuzzer test lib components; improve harness driver; add rect test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1026
 * \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
  1027
 * 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
  1028
 */
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
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
  1030
{
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
    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
  1032
    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
  1033
    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
  1034
    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
  1035
    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
  1036
    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
  1037
    SDL_bool anyEnclosedNoResult;
6772
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
  1038
    SDL_bool expectedEnclosed = SDL_TRUE;
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769