test/testautomation_platform.c
author Philipp Wiesemann <philipp.wiesemann@arcor.de>
Wed, 17 Aug 2016 21:04:50 +0200
changeset 10275 ba7dc3ebb81e
parent 9260 039714172dc3
permissions -rw-r--r--
Emscripten: Fixed opening previously closed joystick.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     1
/**
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     2
 * Original code: automated SDL platform test written by Edgar Simo "bobbens"
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     3
 * Extended and updated by aschiffler at ferzkopp dot net
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     4
 */
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     5
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     6
#include <stdio.h>
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     7
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     8
#include "SDL.h"
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     9
#include "SDL_test.h"
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    10
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    11
/* ================= Test Case Implementation ================== */
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    12
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    13
/* Helper functions */
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    14
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    15
/**
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    16
 * @brief Compare sizes of types.
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    17
 *
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    18
 * @note Watcom C flags these as Warning 201: "Unreachable code" if you just
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    19
 *  compare them directly, so we push it through a function to keep the
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    20
 *  compiler quiet.  --ryan.
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    21
 */
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    22
static int _compareSizeOfType( size_t sizeoftype, size_t hardcodetype )
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    23
{
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    24
    return sizeoftype != hardcodetype;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    25
}
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    26
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    27
/* Test case functions */
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    28
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    29
/**
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    30
 * @brief Tests type sizes.
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    31
 */
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    32
int platform_testTypes(void *arg)
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    33
{
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    34
   int ret;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    35
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    36
   ret = _compareSizeOfType( sizeof(Uint8), 1 );
9254
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8605
diff changeset
    37
   SDLTest_AssertCheck( ret == 0, "sizeof(Uint8) = %lu, expected  1", (unsigned long)sizeof(Uint8) );
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    38
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    39
   ret = _compareSizeOfType( sizeof(Uint16), 2 );
9254
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8605
diff changeset
    40
   SDLTest_AssertCheck( ret == 0, "sizeof(Uint16) = %lu, expected 2", (unsigned long)sizeof(Uint16) );
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    41
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    42
   ret = _compareSizeOfType( sizeof(Uint32), 4 );
9254
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8605
diff changeset
    43
   SDLTest_AssertCheck( ret == 0, "sizeof(Uint32) = %lu, expected 4", (unsigned long)sizeof(Uint32) );
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    44
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    45
   ret = _compareSizeOfType( sizeof(Uint64), 8 );
9254
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8605
diff changeset
    46
   SDLTest_AssertCheck( ret == 0, "sizeof(Uint64) = %lu, expected 8", (unsigned long)sizeof(Uint64) );
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    47
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    48
   return TEST_COMPLETED;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    49
}
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    50
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    51
/**
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    52
 * @brief Tests platform endianness and SDL_SwapXY functions.
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    53
 */
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    54
int platform_testEndianessAndSwap(void *arg)
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    55
{
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    56
    int real_byteorder;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    57
    Uint16 value = 0x1234;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    58
    Uint16 value16 = 0xCDAB;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    59
    Uint16 swapped16 = 0xABCD;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    60
    Uint32 value32 = 0xEFBEADDE;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    61
    Uint32 swapped32 = 0xDEADBEEF;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    62
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    63
    Uint64 value64, swapped64;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    64
    value64 = 0xEFBEADDE;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    65
    value64 <<= 32;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    66
    value64 |= 0xCDAB3412;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    67
    swapped64 = 0x1234ABCD;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    68
    swapped64 <<= 32;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    69
    swapped64 |= 0xDEADBEEF;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    70
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    71
    if ((*((char *) &value) >> 4) == 0x1) {
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    72
        real_byteorder = SDL_BIG_ENDIAN;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    73
    } else {
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    74
        real_byteorder = SDL_LIL_ENDIAN;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    75
    }
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    76
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    77
    /* Test endianness. */
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    78
    SDLTest_AssertCheck( real_byteorder == SDL_BYTEORDER,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    79
             "Machine detected as %s endian, appears to be %s endian.",
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    80
             (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? "little" : "big",
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    81
             (real_byteorder == SDL_LIL_ENDIAN) ? "little" : "big" );
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    82
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    83
    /* Test 16 swap. */
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    84
    SDLTest_AssertCheck( SDL_Swap16(value16) == swapped16,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    85
             "SDL_Swap16(): 16 bit swapped: 0x%X => 0x%X",
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    86
             value16, SDL_Swap16(value16) );
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    87
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    88
    /* Test 32 swap. */
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    89
    SDLTest_AssertCheck( SDL_Swap32(value32) == swapped32,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    90
             "SDL_Swap32(): 32 bit swapped: 0x%X => 0x%X",
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    91
             value32, SDL_Swap32(value32) );
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    92
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    93
    /* Test 64 swap. */
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    94
    SDLTest_AssertCheck( SDL_Swap64(value64) == swapped64,
9260
039714172dc3 switch to use SDL_PRI* macros for long long formatting everywhere.
Edward Rudd <urkle@outoforder.cc>
parents: 9254
diff changeset
    95
             "SDL_Swap64(): 64 bit swapped: 0x%"SDL_PRIX64" => 0x%"SDL_PRIX64,
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    96
             value64, SDL_Swap64(value64) );
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    97
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    98
   return TEST_COMPLETED;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    99
}
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   100
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   101
/* !
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   102
 * \brief Tests SDL_GetXYZ() functions
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   103
 * \sa
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   104
 * http://wiki.libsdl.org/moin.cgi/SDL_GetPlatform
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   105
 * http://wiki.libsdl.org/moin.cgi/SDL_GetCPUCount
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   106
 * http://wiki.libsdl.org/moin.cgi/SDL_GetCPUCacheLineSize
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   107
 * http://wiki.libsdl.org/moin.cgi/SDL_GetRevision
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   108
 * http://wiki.libsdl.org/moin.cgi/SDL_GetRevisionNumber
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   109
 */
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   110
int platform_testGetFunctions (void *arg)
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   111
{
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   112
   char *platform;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   113
   char *revision;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   114
   int ret;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   115
   int len;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   116
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   117
   platform = (char *)SDL_GetPlatform();
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   118
   SDLTest_AssertPass("SDL_GetPlatform()");
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   119
   SDLTest_AssertCheck(platform != NULL, "SDL_GetPlatform() != NULL");
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   120
   if (platform != NULL) {
6778
d57d273d74f9 Add testautomation to VS project; remove automated from VS project; minor update to platform suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   121
     len = SDL_strlen(platform);
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   122
     SDLTest_AssertCheck(len > 0,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   123
             "SDL_GetPlatform(): expected non-empty platform, was platform: '%s', len: %i",
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   124
             platform,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   125
             len);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   126
   }
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   127
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   128
   ret = SDL_GetCPUCount();
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   129
   SDLTest_AssertPass("SDL_GetCPUCount()");
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   130
   SDLTest_AssertCheck(ret > 0,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   131
             "SDL_GetCPUCount(): expected count > 0, was: %i",
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   132
             ret);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   133
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   134
   ret = SDL_GetCPUCacheLineSize();
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   135
   SDLTest_AssertPass("SDL_GetCPUCacheLineSize()");
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   136
   SDLTest_AssertCheck(ret >= 0,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   137
             "SDL_GetCPUCacheLineSize(): expected size >= 0, was: %i",
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   138
             ret);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   139
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   140
   revision = (char *)SDL_GetRevision();
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   141
   SDLTest_AssertPass("SDL_GetRevision()");
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   142
   SDLTest_AssertCheck(revision != NULL, "SDL_GetRevision() != NULL");
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   143
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   144
   ret = SDL_GetRevisionNumber();
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   145
   SDLTest_AssertPass("SDL_GetRevisionNumber()");
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   146
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   147
   return TEST_COMPLETED;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   148
}
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   149
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   150
/* !
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   151
 * \brief Tests SDL_HasXYZ() functions
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   152
 * \sa
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   153
 * http://wiki.libsdl.org/moin.cgi/SDL_Has3DNow
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   154
 * http://wiki.libsdl.org/moin.cgi/SDL_HasAltiVec
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   155
 * http://wiki.libsdl.org/moin.cgi/SDL_HasMMX
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   156
 * http://wiki.libsdl.org/moin.cgi/SDL_HasRDTSC
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   157
 * http://wiki.libsdl.org/moin.cgi/SDL_HasSSE
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   158
 * http://wiki.libsdl.org/moin.cgi/SDL_HasSSE2
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   159
 * http://wiki.libsdl.org/moin.cgi/SDL_HasSSE3
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   160
 * http://wiki.libsdl.org/moin.cgi/SDL_HasSSE41
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   161
 * http://wiki.libsdl.org/moin.cgi/SDL_HasSSE42
8148
56ba41ac64fe Fixed bug 2376 - no SDL_HasAVX
Sam Lantinga <slouken@libsdl.org>
parents: 7678
diff changeset
   162
 * http://wiki.libsdl.org/moin.cgi/SDL_HasAVX
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   163
 */
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   164
int platform_testHasFunctions (void *arg)
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   165
{
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   166
   int ret;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   167
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   168
   /* TODO: independently determine and compare values as well */
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   169
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   170
   ret = SDL_HasRDTSC();
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   171
   SDLTest_AssertPass("SDL_HasRDTSC()");
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   172
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   173
   ret = SDL_HasAltiVec();
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   174
   SDLTest_AssertPass("SDL_HasAltiVec()");
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   175
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   176
   ret = SDL_HasMMX();
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   177
   SDLTest_AssertPass("SDL_HasMMX()");
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   178
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   179
   ret = SDL_Has3DNow();
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   180
   SDLTest_AssertPass("SDL_Has3DNow()");
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   181
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   182
   ret = SDL_HasSSE();
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   183
   SDLTest_AssertPass("SDL_HasSSE()");
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   184
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   185
   ret = SDL_HasSSE2();
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   186
   SDLTest_AssertPass("SDL_HasSSE2()");
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   187
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   188
   ret = SDL_HasSSE3();
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   189
   SDLTest_AssertPass("SDL_HasSSE3()");
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   190
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   191
   ret = SDL_HasSSE41();
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   192
   SDLTest_AssertPass("SDL_HasSSE41()");
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   193
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   194
   ret = SDL_HasSSE42();
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   195
   SDLTest_AssertPass("SDL_HasSSE42()");
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   196
8148
56ba41ac64fe Fixed bug 2376 - no SDL_HasAVX
Sam Lantinga <slouken@libsdl.org>
parents: 7678
diff changeset
   197
   ret = SDL_HasAVX();
56ba41ac64fe Fixed bug 2376 - no SDL_HasAVX
Sam Lantinga <slouken@libsdl.org>
parents: 7678
diff changeset
   198
   SDLTest_AssertPass("SDL_HasAVX()");
56ba41ac64fe Fixed bug 2376 - no SDL_HasAVX
Sam Lantinga <slouken@libsdl.org>
parents: 7678
diff changeset
   199
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   200
   return TEST_COMPLETED;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   201
}
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   202
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   203
/* !
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   204
 * \brief Tests SDL_GetVersion
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   205
 * \sa
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   206
 * http://wiki.libsdl.org/moin.cgi/SDL_GetVersion
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   207
 */
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   208
int platform_testGetVersion(void *arg)
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   209
{
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   210
   SDL_version linked;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   211
   int major = SDL_MAJOR_VERSION;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   212
   int minor = SDL_MINOR_VERSION;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   213
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   214
   SDL_GetVersion(&linked);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   215
   SDLTest_AssertCheck( linked.major >= major,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   216
             "SDL_GetVersion(): returned major %i (>= %i)",
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   217
             linked.major,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   218
             major);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   219
   SDLTest_AssertCheck( linked.minor >= minor,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   220
             "SDL_GetVersion(): returned minor %i (>= %i)",
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   221
             linked.minor,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   222
             minor);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   223
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   224
   return TEST_COMPLETED;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   225
}
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   226
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   227
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   228
/* !
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   229
 * \brief Tests SDL_VERSION macro
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   230
 */
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   231
int platform_testSDLVersion(void *arg)
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   232
{
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   233
   SDL_version compiled;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   234
   int major = SDL_MAJOR_VERSION;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   235
   int minor = SDL_MINOR_VERSION;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   236
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   237
   SDL_VERSION(&compiled);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   238
   SDLTest_AssertCheck( compiled.major >= major,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   239
             "SDL_VERSION() returned major %i (>= %i)",
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   240
             compiled.major,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   241
             major);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   242
   SDLTest_AssertCheck( compiled.minor >= minor,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   243
             "SDL_VERSION() returned minor %i (>= %i)",
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   244
             compiled.minor,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   245
             minor);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   246
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   247
   return TEST_COMPLETED;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   248
}
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   249
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   250
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   251
/* !
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   252
 * \brief Tests default SDL_Init
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   253
 */
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   254
int platform_testDefaultInit(void *arg)
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   255
{
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   256
   int ret;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   257
   int subsystem;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   258
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   259
   subsystem = SDL_WasInit(SDL_INIT_EVERYTHING);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   260
   SDLTest_AssertCheck( subsystem != 0,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   261
             "SDL_WasInit(0): returned %i, expected != 0",
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   262
             subsystem);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   263
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   264
   ret = SDL_Init(SDL_WasInit(SDL_INIT_EVERYTHING));
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   265
   SDLTest_AssertCheck( ret == 0,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   266
             "SDL_Init(0): returned %i, expected 0, error: %s",
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   267
             ret,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   268
             SDL_GetError());
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   269
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   270
   return TEST_COMPLETED;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   271
}
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   272
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   273
/* !
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   274
 * \brief Tests SDL_Get/Set/ClearError
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   275
 * \sa
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   276
 * http://wiki.libsdl.org/moin.cgi/SDL_GetError
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   277
 * http://wiki.libsdl.org/moin.cgi/SDL_SetError
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   278
 * http://wiki.libsdl.org/moin.cgi/SDL_ClearError
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   279
 */
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   280
int platform_testGetSetClearError(void *arg)
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   281
{
8605
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   282
   int result;
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   283
   const char *testError = "Testing";
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   284
   char *lastError;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   285
   int len;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   286
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   287
   SDL_ClearError();
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   288
   SDLTest_AssertPass("SDL_ClearError()");
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   289
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   290
   lastError = (char *)SDL_GetError();
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   291
   SDLTest_AssertPass("SDL_GetError()");
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   292
   SDLTest_AssertCheck(lastError != NULL,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   293
             "SDL_GetError() != NULL");
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   294
   if (lastError != NULL)
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   295
   {
6778
d57d273d74f9 Add testautomation to VS project; remove automated from VS project; minor update to platform suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   296
     len = SDL_strlen(lastError);
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   297
     SDLTest_AssertCheck(len == 0,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   298
             "SDL_GetError(): no message expected, len: %i", len);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   299
   }
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   300
8605
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   301
   result = SDL_SetError("%s", testError);
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   302
   SDLTest_AssertPass("SDL_SetError()");
8605
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   303
   SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result);
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   304
   lastError = (char *)SDL_GetError();
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   305
   SDLTest_AssertCheck(lastError != NULL,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   306
             "SDL_GetError() != NULL");
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   307
   if (lastError != NULL)
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   308
   {
6778
d57d273d74f9 Add testautomation to VS project; remove automated from VS project; minor update to platform suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   309
     len = SDL_strlen(lastError);
d57d273d74f9 Add testautomation to VS project; remove automated from VS project; minor update to platform suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   310
     SDLTest_AssertCheck(len == SDL_strlen(testError),
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   311
             "SDL_GetError(): expected message len %i, was len: %i",
6778
d57d273d74f9 Add testautomation to VS project; remove automated from VS project; minor update to platform suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   312
             SDL_strlen(testError),
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   313
             len);
6778
d57d273d74f9 Add testautomation to VS project; remove automated from VS project; minor update to platform suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   314
     SDLTest_AssertCheck(SDL_strcmp(lastError, testError) == 0,
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   315
             "SDL_GetError(): expected message %s, was message: %s",
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   316
             testError,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   317
             lastError);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   318
   }
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   319
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   320
   /* Clean up */
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   321
   SDL_ClearError();
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   322
   SDLTest_AssertPass("SDL_ClearError()");
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   323
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   324
   return TEST_COMPLETED;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   325
}
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   326
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   327
/* !
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   328
 * \brief Tests SDL_SetError with empty input
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   329
 * \sa
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   330
 * http://wiki.libsdl.org/moin.cgi/SDL_SetError
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   331
 */
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   332
int platform_testSetErrorEmptyInput(void *arg)
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   333
{
8605
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   334
   int result;
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   335
   const char *testError = "";
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   336
   char *lastError;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   337
   int len;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   338
8605
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   339
   result = SDL_SetError("%s", testError);
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   340
   SDLTest_AssertPass("SDL_SetError()");
8605
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   341
   SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result);
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   342
   lastError = (char *)SDL_GetError();
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   343
   SDLTest_AssertCheck(lastError != NULL,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   344
             "SDL_GetError() != NULL");
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   345
   if (lastError != NULL)
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   346
   {
6778
d57d273d74f9 Add testautomation to VS project; remove automated from VS project; minor update to platform suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   347
     len = SDL_strlen(lastError);
d57d273d74f9 Add testautomation to VS project; remove automated from VS project; minor update to platform suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   348
     SDLTest_AssertCheck(len == SDL_strlen(testError),
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   349
             "SDL_GetError(): expected message len %i, was len: %i",
6778
d57d273d74f9 Add testautomation to VS project; remove automated from VS project; minor update to platform suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   350
             SDL_strlen(testError),
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   351
             len);
6778
d57d273d74f9 Add testautomation to VS project; remove automated from VS project; minor update to platform suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   352
     SDLTest_AssertCheck(SDL_strcmp(lastError, testError) == 0,
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   353
             "SDL_GetError(): expected message '%s', was message: '%s'",
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   354
             testError,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   355
             lastError);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   356
   }
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   357
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   358
   /* Clean up */
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   359
   SDL_ClearError();
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   360
   SDLTest_AssertPass("SDL_ClearError()");
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   361
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   362
   return TEST_COMPLETED;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   363
}
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   364
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   365
/* !
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   366
 * \brief Tests SDL_SetError with invalid input
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   367
 * \sa
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   368
 * http://wiki.libsdl.org/moin.cgi/SDL_SetError
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   369
 */
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   370
int platform_testSetErrorInvalidInput(void *arg)
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   371
{
8605
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   372
   int result;
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   373
   const char *invalidError = NULL;
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   374
   const char *probeError = "Testing";
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   375
   char *lastError;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   376
   int len;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   377
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   378
   /* Reset */
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   379
   SDL_ClearError();
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   380
   SDLTest_AssertPass("SDL_ClearError()");
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   381
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   382
   /* Check for no-op */
8605
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   383
   result = SDL_SetError(invalidError);
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   384
   SDLTest_AssertPass("SDL_SetError()");
8605
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   385
   SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result);
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   386
   lastError = (char *)SDL_GetError();
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   387
   SDLTest_AssertCheck(lastError != NULL,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   388
             "SDL_GetError() != NULL");
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   389
   if (lastError != NULL)
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   390
   {
6778
d57d273d74f9 Add testautomation to VS project; remove automated from VS project; minor update to platform suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   391
     len = SDL_strlen(lastError);
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   392
     SDLTest_AssertCheck(len == 0,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   393
             "SDL_GetError(): expected message len 0, was len: %i",
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   394
             len);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   395
   }
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   396
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   397
   /* Set */
8605
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   398
   result = SDL_SetError(probeError);
9254
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8605
diff changeset
   399
   SDLTest_AssertPass("SDL_SetError('%s')", probeError);
8605
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   400
   SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result);
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   401
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   402
   /* Check for no-op */
8605
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   403
   result = SDL_SetError(invalidError);
9254
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8605
diff changeset
   404
   SDLTest_AssertPass("SDL_SetError(NULL)");
8605
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   405
   SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result);
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   406
   lastError = (char *)SDL_GetError();
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   407
   SDLTest_AssertCheck(lastError != NULL,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   408
             "SDL_GetError() != NULL");
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   409
   if (lastError != NULL)
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   410
   {
6778
d57d273d74f9 Add testautomation to VS project; remove automated from VS project; minor update to platform suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   411
     len = SDL_strlen(lastError);
9254
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8605
diff changeset
   412
     SDLTest_AssertCheck(len == 0,
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8605
diff changeset
   413
             "SDL_GetError(): expected message len 0, was len: %i",
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   414
             len);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   415
   }
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   416
8605
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   417
   /* Reset */
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   418
   SDL_ClearError();
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   419
   SDLTest_AssertPass("SDL_ClearError()");
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   420
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   421
   /* Set and check */
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   422
   result = SDL_SetError(probeError);
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   423
   SDLTest_AssertPass("SDL_SetError()");
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   424
   SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result);
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   425
   lastError = (char *)SDL_GetError();
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   426
   SDLTest_AssertCheck(lastError != NULL,
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   427
             "SDL_GetError() != NULL");
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   428
   if (lastError != NULL)
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   429
   {
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   430
     len = SDL_strlen(lastError);
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   431
     SDLTest_AssertCheck(len == SDL_strlen(probeError),
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   432
             "SDL_GetError(): expected message len %i, was len: %i",
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   433
             SDL_strlen(probeError),
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   434
             len);
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   435
     SDLTest_AssertCheck(SDL_strcmp(lastError, probeError) == 0,
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   436
             "SDL_GetError(): expected message '%s', was message: '%s'",
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   437
             probeError,
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   438
             lastError);
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   439
   }
57faccca4fab Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 8148
diff changeset
   440
   
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   441
   /* Clean up */
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   442
   SDL_ClearError();
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   443
   SDLTest_AssertPass("SDL_ClearError()");
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   444
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   445
   return TEST_COMPLETED;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   446
}
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   447
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7663
diff changeset
   448
/* !
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   449
 * \brief Tests SDL_GetPowerInfo
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   450
 * \sa
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   451
 * http://wiki.libsdl.org/moin.cgi/SDL_GetPowerInfo
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   452
 */
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   453
int platform_testGetPowerInfo(void *arg)
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   454
{
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   455
   SDL_PowerState state;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   456
   SDL_PowerState stateAgain;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   457
   int secs;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   458
   int secsAgain;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   459
   int pct;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   460
   int pctAgain;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   461
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   462
   state = SDL_GetPowerInfo(&secs, &pct);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   463
   SDLTest_AssertPass("SDL_GetPowerInfo()");
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   464
   SDLTest_AssertCheck(
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   465
       state==SDL_POWERSTATE_UNKNOWN ||
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   466
       state==SDL_POWERSTATE_ON_BATTERY ||
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   467
       state==SDL_POWERSTATE_NO_BATTERY ||
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   468
       state==SDL_POWERSTATE_CHARGING ||
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   469
       state==SDL_POWERSTATE_CHARGED,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   470
       "SDL_GetPowerInfo(): state %i is one of the expected values",
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   471
       (int)state);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   472
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   473
   if (state==SDL_POWERSTATE_ON_BATTERY)
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   474
   {
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   475
      SDLTest_AssertCheck(
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   476
         secs >= 0,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   477
         "SDL_GetPowerInfo(): on battery, secs >= 0, was: %i",
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   478
         secs);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   479
      SDLTest_AssertCheck(
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   480
         (pct >= 0) && (pct <= 100),
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   481
         "SDL_GetPowerInfo(): on battery, pct=[0,100], was: %i",
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   482
         pct);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   483
   }
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   484
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   485
   if (state==SDL_POWERSTATE_UNKNOWN ||
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   486
       state==SDL_POWERSTATE_NO_BATTERY)
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   487
   {
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   488
      SDLTest_AssertCheck(
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   489
         secs == -1,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   490
         "SDL_GetPowerInfo(): no battery, secs == -1, was: %i",
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   491
         secs);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   492
      SDLTest_AssertCheck(
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   493
         pct == -1,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   494
         "SDL_GetPowerInfo(): no battery, pct == -1, was: %i",
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   495
         pct);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   496
   }
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   497
7663
53fe1b64eb2d More non C89 compliant comments
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7191
diff changeset
   498
   /* Partial return value variations */
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   499
   stateAgain = SDL_GetPowerInfo(&secsAgain, NULL);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   500
   SDLTest_AssertCheck(
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   501
        state==stateAgain,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   502
        "State %i returned when only 'secs' requested",
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   503
        stateAgain);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   504
   SDLTest_AssertCheck(
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   505
        secs==secsAgain,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   506
        "Value %i matches when only 'secs' requested",
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   507
        secsAgain);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   508
   stateAgain = SDL_GetPowerInfo(NULL, &pctAgain);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   509
   SDLTest_AssertCheck(
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   510
        state==stateAgain,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   511
        "State %i returned when only 'pct' requested",
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   512
        stateAgain);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   513
   SDLTest_AssertCheck(
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   514
        pct==pctAgain,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   515
        "Value %i matches when only 'pct' requested",
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   516
        pctAgain);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   517
   stateAgain = SDL_GetPowerInfo(NULL, NULL);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   518
   SDLTest_AssertCheck(
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   519
        state==stateAgain,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   520
        "State %i returned when no value requested",
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   521
        stateAgain);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   522
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   523
   return TEST_COMPLETED;
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   524
}
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   525
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   526
/* ================= Test References ================== */
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   527
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   528
/* Platform test cases */
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   529
static const SDLTest_TestCaseReference platformTest1 =
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6778
diff changeset
   530
        { (SDLTest_TestCaseFp)platform_testTypes, "platform_testTypes", "Tests predefined types", TEST_ENABLED};
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   531
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   532
static const SDLTest_TestCaseReference platformTest2 =
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6778
diff changeset
   533
        { (SDLTest_TestCaseFp)platform_testEndianessAndSwap, "platform_testEndianessAndSwap", "Tests endianess and swap functions", TEST_ENABLED};
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   534
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   535
static const SDLTest_TestCaseReference platformTest3 =
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6778
diff changeset
   536
        { (SDLTest_TestCaseFp)platform_testGetFunctions, "platform_testGetFunctions", "Tests various SDL_GetXYZ functions", TEST_ENABLED};
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   537
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   538
static const SDLTest_TestCaseReference platformTest4 =
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6778
diff changeset
   539
        { (SDLTest_TestCaseFp)platform_testHasFunctions, "platform_testHasFunctions", "Tests various SDL_HasXYZ functions", TEST_ENABLED};
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   540
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   541
static const SDLTest_TestCaseReference platformTest5 =
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6778
diff changeset
   542
        { (SDLTest_TestCaseFp)platform_testGetVersion, "platform_testGetVersion", "Tests SDL_GetVersion function", TEST_ENABLED};
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   543
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   544
static const SDLTest_TestCaseReference platformTest6 =
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6778
diff changeset
   545
        { (SDLTest_TestCaseFp)platform_testSDLVersion, "platform_testSDLVersion", "Tests SDL_VERSION macro", TEST_ENABLED};
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   546
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   547
static const SDLTest_TestCaseReference platformTest7 =
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6778
diff changeset
   548
        { (SDLTest_TestCaseFp)platform_testDefaultInit, "platform_testDefaultInit", "Tests default SDL_Init", TEST_ENABLED};
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   549
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   550
static const SDLTest_TestCaseReference platformTest8 =
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6778
diff changeset
   551
        { (SDLTest_TestCaseFp)platform_testGetSetClearError, "platform_testGetSetClearError", "Tests SDL_Get/Set/ClearError", TEST_ENABLED};
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   552
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   553
static const SDLTest_TestCaseReference platformTest9 =
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6778
diff changeset
   554
        { (SDLTest_TestCaseFp)platform_testSetErrorEmptyInput, "platform_testSetErrorEmptyInput", "Tests SDL_SetError with empty input", TEST_ENABLED};
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   555
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   556
static const SDLTest_TestCaseReference platformTest10 =
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6778
diff changeset
   557
        { (SDLTest_TestCaseFp)platform_testSetErrorInvalidInput, "platform_testSetErrorInvalidInput", "Tests SDL_SetError with invalid input", TEST_ENABLED};
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   558
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   559
static const SDLTest_TestCaseReference platformTest11 =
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6778
diff changeset
   560
        { (SDLTest_TestCaseFp)platform_testGetPowerInfo, "platform_testGetPowerInfo", "Tests SDL_GetPowerInfo function", TEST_ENABLED };
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   561
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   562
/* Sequence of Platform test cases */
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   563
static const SDLTest_TestCaseReference *platformTests[] =  {
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6778
diff changeset
   564
    &platformTest1,
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6778
diff changeset
   565
    &platformTest2,
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6778
diff changeset
   566
    &platformTest3,
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6778
diff changeset
   567
    &platformTest4,
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6778
diff changeset
   568
    &platformTest5,
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6778
diff changeset
   569
    &platformTest6,
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6778
diff changeset
   570
    &platformTest7,
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6778
diff changeset
   571
    &platformTest8,
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6778
diff changeset
   572
    &platformTest9,
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6778
diff changeset
   573
    &platformTest10,
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6778
diff changeset
   574
    &platformTest11,
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6778
diff changeset
   575
    NULL
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   576
};
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   577
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   578
/* Platform test suite (global) */
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   579
SDLTest_TestSuiteReference platformTestSuite = {
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6778
diff changeset
   580
    "Platform",
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6778
diff changeset
   581
    NULL,
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6778
diff changeset
   582
    platformTests,
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6778
diff changeset
   583
    NULL
6756
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   584
};