test/tests/testplatform.c
author Andreas Schiffler <aschiffler@ferzkopp.net>
Fri, 14 Dec 2012 23:05:34 -0800
changeset 6756 398073b195bb
permissions -rw-r--r--
Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
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 );
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    37
   SDLTest_AssertCheck( ret == 0, "sizeof(Uint8) = %lu, expected  1", sizeof(Uint8) );
398073b195bb Refactor/fix 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 );
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    40
   SDLTest_AssertCheck( ret == 0, "sizeof(Uint16) = %lu, expected 2", sizeof(Uint16) );
398073b195bb Refactor/fix 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 );
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    43
   SDLTest_AssertCheck( ret == 0, "sizeof(Uint32) = %lu, expected 4", sizeof(Uint32) );
398073b195bb Refactor/fix 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 );
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    46
   SDLTest_AssertCheck( ret == 0, "sizeof(Uint64) = %lu, expected 8", sizeof(Uint64) );
398073b195bb Refactor/fix 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,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    95
#ifdef _MSC_VER
398073b195bb Refactor/fix 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
             "SDL_Swap64(): 64 bit swapped: 0x%I64X => 0x%I64X",
398073b195bb Refactor/fix 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
#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
    98
             "SDL_Swap64(): 64 bit swapped: 0x%llX => 0x%llX",
398073b195bb Refactor/fix 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
#endif
398073b195bb Refactor/fix 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
             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
   101
398073b195bb Refactor/fix 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
   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
   103
}
398073b195bb Refactor/fix 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
398073b195bb Refactor/fix 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
/*!
398073b195bb Refactor/fix 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
 * \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
   107
 * \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
   108
 * 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
   109
 * 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
   110
 * 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
   111
 * 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
   112
 * 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
   113
 */
398073b195bb Refactor/fix 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 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
   115
{
398073b195bb Refactor/fix 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
   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
   117
   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
   118
   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
   119
   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
   120
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   121
   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
   122
   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
   123
   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
   124
   if (platform != 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
   125
     len = strlen(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
   126
     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
   127
             "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
   128
             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
   129
             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
   130
   }
398073b195bb Refactor/fix 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
398073b195bb Refactor/fix 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 = 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
   133
   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
   134
   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
   135
             "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
   136
             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
   137
398073b195bb Refactor/fix 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 = 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
   139
   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
   140
   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
   141
             "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
   142
             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
   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
   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
   145
   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
   146
   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
   147
398073b195bb Refactor/fix 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
   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
   149
   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
   150
398073b195bb Refactor/fix 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
   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
   152
}
398073b195bb Refactor/fix 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
398073b195bb Refactor/fix 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
/*!
398073b195bb Refactor/fix 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
 * \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
   156
 * \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
   157
 * 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
   158
 * 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
   159
 * 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
   160
 * 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
   161
 * 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
   162
 * 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
   163
 * 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
   164
 * 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
   165
 * http://wiki.libsdl.org/moin.cgi/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
   166
 */
398073b195bb Refactor/fix 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
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
   168
{
398073b195bb Refactor/fix 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
   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
   170
398073b195bb Refactor/fix 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
   // TODO: independently determine and compare values as well
398073b195bb Refactor/fix 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_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
   174
   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
   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_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
   177
   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
   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_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
   180
   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
   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_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
   183
   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
   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_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
   186
   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
   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_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
   189
   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
   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_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
   192
   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
   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_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
   195
   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
   196
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   197
   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
   198
   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
   199
398073b195bb Refactor/fix 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
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   203
/*!
398073b195bb Refactor/fix 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
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   228
/*!
398073b195bb Refactor/fix 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
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   251
/*!
398073b195bb Refactor/fix 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
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   273
/*!
398073b195bb Refactor/fix 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
{
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   282
   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
   283
   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
   284
   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
   285
398073b195bb Refactor/fix 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
   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
   287
   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
   288
398073b195bb Refactor/fix 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
   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
   290
   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
   291
   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
   292
             "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
   293
   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
   294
   {
398073b195bb Refactor/fix 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
     len = strlen(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
   296
     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
   297
             "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
   298
   }
398073b195bb Refactor/fix 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
   SDL_SetError("%s", 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
   301
   SDLTest_AssertPass("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
   302
   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
   303
   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
   304
             "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
   305
   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
   306
   {
398073b195bb Refactor/fix 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
     len = strlen(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
   308
     SDLTest_AssertCheck(len == strlen(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
   309
             "SDL_GetError(): expected message len %i, 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
   310
             strlen(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
   311
             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
   312
     SDLTest_AssertCheck(strcmp(lastError, testError) == 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
   313
             "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
   314
             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
   315
             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
   316
   }
398073b195bb Refactor/fix 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
398073b195bb Refactor/fix 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
   // Clean up
398073b195bb Refactor/fix 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
   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
   320
   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
   321
398073b195bb Refactor/fix 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
   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
   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
398073b195bb Refactor/fix 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
 * \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
   327
 * \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
   328
 * 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
   329
 */
398073b195bb Refactor/fix 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
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
   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
   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
   333
   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
   334
   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
   335
398073b195bb Refactor/fix 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
   SDL_SetError("%s", 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
   337
   SDLTest_AssertPass("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
   338
   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
   339
   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
   340
             "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
   341
   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
   342
   {
398073b195bb Refactor/fix 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
     len = strlen(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
   344
     SDLTest_AssertCheck(len == strlen(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
   345
             "SDL_GetError(): expected message len %i, 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
   346
             strlen(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
   347
             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
   348
     SDLTest_AssertCheck(strcmp(lastError, testError) == 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
   349
             "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
   350
             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
   351
             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
   352
   }
398073b195bb Refactor/fix 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
398073b195bb Refactor/fix 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
   // Clean up
398073b195bb Refactor/fix 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
   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
   356
   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
   357
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   358
   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
   359
}
398073b195bb Refactor/fix 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
398073b195bb Refactor/fix 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
 * \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
   363
 * \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
   364
 * 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
   365
 */
398073b195bb Refactor/fix 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
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
   367
{
398073b195bb Refactor/fix 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
   const char *testError = 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
   369
   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
   370
   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
   371
   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
   372
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   373
   // Reset
398073b195bb Refactor/fix 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
   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
   375
   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
   376
398073b195bb Refactor/fix 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
   // Check for no-op
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   378
   SDL_SetError(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
   379
   SDLTest_AssertPass("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
   380
   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
   381
   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
   382
             "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
   383
   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
   384
   {
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   385
     len = strlen(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
   386
     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
   387
             "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
   388
             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
   389
             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
   390
     SDLTest_AssertCheck(strcmp(lastError, "") == 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
   391
             "SDL_GetError(): expected message '', 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
   392
             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
   393
   }
398073b195bb Refactor/fix 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
398073b195bb Refactor/fix 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
   // Set
398073b195bb Refactor/fix 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
   SDL_SetError(probeError);
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   397
   SDLTest_AssertPass("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
   398
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   399
   // Check for no-op
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   400
   SDL_SetError(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
   401
   SDLTest_AssertPass("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
   402
   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
   403
   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
   404
             "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
   405
   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
   406
   {
398073b195bb Refactor/fix 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
     len = strlen(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
   408
     SDLTest_AssertCheck(len == strlen(probeError),
398073b195bb Refactor/fix 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
             "SDL_GetError(): expected message len %i, 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
   410
             strlen(probeError),
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   411
             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
   412
     SDLTest_AssertCheck(strcmp(lastError, probeError) == 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
   413
             "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
   414
             probeError,
398073b195bb Refactor/fix 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
             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
   416
   }
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   417
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   418
   // Clean up
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   419
   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
   420
   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
   421
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   422
   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
   423
}
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   424
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   425
/*!
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   426
 * \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
   427
 * \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
   428
 * 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
   429
 */
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   430
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
   431
{
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   432
   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
   433
   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
   434
   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
   435
   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
   436
   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
   437
   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
   438
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   439
   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
   440
   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
   441
   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
   442
       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
   443
       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
   444
       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
   445
       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
   446
       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
   447
       "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
   448
       (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
   449
398073b195bb Refactor/fix 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
   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
   451
   {
398073b195bb Refactor/fix 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
      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
   453
         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
   454
         "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
   455
         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
   456
      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
   457
         (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
   458
         "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
   459
         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
   }
398073b195bb Refactor/fix 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
   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
   463
       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
   464
   {
398073b195bb Refactor/fix 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
      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
   466
         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
   467
         "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
   468
         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
   469
      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
   470
         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
   471
         "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
   472
         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
   473
   }
398073b195bb Refactor/fix 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
   // Partial return value variations
398073b195bb Refactor/fix 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
   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
   477
   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
   478
        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
   479
        "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
   480
        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
   481
   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
   482
        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
   483
        "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
   484
        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
   485
   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
   486
   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
   487
        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
   488
        "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
   489
        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
   490
   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
   491
        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
   492
        "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
   493
        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
   494
   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
   495
   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
   496
        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
   497
        "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
   498
        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
   499
398073b195bb Refactor/fix 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
   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
   501
}
398073b195bb Refactor/fix 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
398073b195bb Refactor/fix 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
/* ================= 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
   504
398073b195bb Refactor/fix 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
/* 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
   506
static const SDLTest_TestCaseReference platformTest1 =
398073b195bb Refactor/fix 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
		{ (SDLTest_TestCaseFp)platform_testTypes, "platform_testTypes", "Tests predefined types", TEST_ENABLED};
398073b195bb Refactor/fix 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
398073b195bb Refactor/fix 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
static const SDLTest_TestCaseReference platformTest2 =
398073b195bb Refactor/fix 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
		{ (SDLTest_TestCaseFp)platform_testEndianessAndSwap, "platform_testEndianessAndSwap", "Tests endianess and swap functions", TEST_ENABLED};
398073b195bb Refactor/fix 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
398073b195bb Refactor/fix 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
static const SDLTest_TestCaseReference platformTest3 =
398073b195bb Refactor/fix 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_TestCaseFp)platform_testGetFunctions, "platform_testGetFunctions", "Tests various SDL_GetXYZ functions", TEST_ENABLED};
398073b195bb Refactor/fix 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
398073b195bb Refactor/fix 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
static const SDLTest_TestCaseReference platformTest4 =
398073b195bb Refactor/fix 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
		{ (SDLTest_TestCaseFp)platform_testHasFunctions, "platform_testHasFunctions", "Tests various SDL_HasXYZ functions", TEST_ENABLED};
398073b195bb Refactor/fix 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
398073b195bb Refactor/fix 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
static const SDLTest_TestCaseReference platformTest5 =
398073b195bb Refactor/fix 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
		{ (SDLTest_TestCaseFp)platform_testGetVersion, "platform_testGetVersion", "Tests SDL_GetVersion function", TEST_ENABLED};
398073b195bb Refactor/fix 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
398073b195bb Refactor/fix 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
static const SDLTest_TestCaseReference platformTest6 =
398073b195bb Refactor/fix 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
		{ (SDLTest_TestCaseFp)platform_testSDLVersion, "platform_testSDLVersion", "Tests SDL_VERSION macro", TEST_ENABLED};
398073b195bb Refactor/fix 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
398073b195bb Refactor/fix 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
static const SDLTest_TestCaseReference platformTest7 =
398073b195bb Refactor/fix 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
		{ (SDLTest_TestCaseFp)platform_testDefaultInit, "platform_testDefaultInit", "Tests default SDL_Init", TEST_ENABLED};
398073b195bb Refactor/fix 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
398073b195bb Refactor/fix 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
static const SDLTest_TestCaseReference platformTest8 =
398073b195bb Refactor/fix 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
		{ (SDLTest_TestCaseFp)platform_testGetSetClearError, "platform_testGetSetClearError", "Tests SDL_Get/Set/ClearError", TEST_ENABLED};
398073b195bb Refactor/fix 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
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   530
static const SDLTest_TestCaseReference platformTest9 =
398073b195bb Refactor/fix 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
		{ (SDLTest_TestCaseFp)platform_testSetErrorEmptyInput, "platform_testSetErrorEmptyInput", "Tests SDL_SetError with empty input", TEST_ENABLED};
398073b195bb Refactor/fix 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
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   533
static const SDLTest_TestCaseReference platformTest10 =
398073b195bb Refactor/fix 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
		{ (SDLTest_TestCaseFp)platform_testSetErrorInvalidInput, "platform_testSetErrorInvalidInput", "Tests SDL_SetError with invalid input", TEST_ENABLED};
398073b195bb Refactor/fix 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
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   536
static const SDLTest_TestCaseReference platformTest11 =
398073b195bb Refactor/fix 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
		{ (SDLTest_TestCaseFp)platform_testGetPowerInfo, "platform_testGetPowerInfo", "Tests SDL_GetPowerInfo function", TEST_ENABLED };
398073b195bb Refactor/fix 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
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   539
/* 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
   540
static const SDLTest_TestCaseReference *platformTests[] =  {
398073b195bb Refactor/fix 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
	&platformTest1,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   542
	&platformTest2,
398073b195bb Refactor/fix 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
	&platformTest3,
398073b195bb Refactor/fix 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
	&platformTest4,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   545
	&platformTest5,
398073b195bb Refactor/fix 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
	&platformTest6,
398073b195bb Refactor/fix 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
	&platformTest7,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   548
	&platformTest8,
398073b195bb Refactor/fix 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
	&platformTest9,
398073b195bb Refactor/fix 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
	&platformTest10,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   551
	&platformTest11,
398073b195bb Refactor/fix 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
	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
   553
};
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   554
398073b195bb Refactor/fix 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
/* 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
   556
SDLTest_TestSuiteReference platformTestSuite = {
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   557
	"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
   558
	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
   559
	platformTests,
398073b195bb Refactor/fix test lib harness, assert and log component; add harness driver; port platform suite from GSOC code
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   560
	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
   561
};