test/test-automation/testdummy/testdummy.c
author Markus Kauppila <markus.kauppila@gmail.com>
Mon, 06 Jun 2011 18:15:19 +0300
changeset 5686 a7d699502230
child 5688 bbc19d6aaddb
permissions -rw-r--r--
Converted libtest to a more proper dummy test suite (libtestdummy).
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5686
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
     1
/*
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
     2
  Copyright (C) 2011 Markus Kauppila <markus.kauppila@gmail.com>
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
     3
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
     4
  This software is provided 'as-is', without any express or implied
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
     5
  warranty.  In no event will the authors be held liable for any damages
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
     6
  arising from the use of this software.
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
     7
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
     8
  Permission is granted to anyone to use this software for any purpose,
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
     9
  including commercial applications, and to alter it and redistribute it
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    10
  freely, subject to the following restrictions:
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    11
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    12
  1. The origin of this software must not be misrepresented; you must not
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    13
     claim that you wrote the original software. If you use this software
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    14
     in a product, an acknowledgment in the product documentation would be
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    15
     appreciated but is not required.
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    16
  2. Altered source versions must be plainly marked as such, and must not be
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    17
     misrepresented as being the original software.
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    18
  3. This notice may not be removed or altered from any source distribution.
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    19
*/
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    20
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    21
/*! \file
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    22
 * Dummy test suite for test runner. This can be used as a base for
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    23
 * writing new tests. Dummy suite also works as reference to using
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    24
 * various asserts and (possible) other utilities.
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    25
 */
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    26
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    27
#ifndef _TEST_C
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    28
#define _TEST_C
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    29
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    30
#include <stdio.h>
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    31
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    32
#include <SDL/SDL.h>
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    33
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    34
#include "../SDL_test.h"
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    35
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    36
/* Test cases */
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    37
static const TestCaseReference test1 =
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    38
		(TestCaseReference){ "dummycase1", "description", TEST_ENABLED, 0 };
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    39
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    40
static const TestCaseReference test2 =
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    41
		(TestCaseReference){ "dummycase2", "description", TEST_ENABLED, 0 };
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    42
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    43
static const TestCaseReference test3 =
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    44
		(TestCaseReference){ "dummycase3", "description", TEST_ENABLED, 0 };
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    45
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    46
/* Test suite */
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    47
extern const TestCaseReference *testSuite[] =  {
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    48
	&test1, &test2, &test3, NULL
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    49
};
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    50
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    51
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    52
TestCaseReference **QueryTestSuite() {
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    53
	return (TestCaseReference **)testSuite;
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    54
}
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    55
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    56
/* Test case functions */
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    57
void dummycase1(void *arg)
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    58
{
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    59
	const char *revision = SDL_GetRevision();
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    60
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    61
	printf("Revision is %s\n", revision);
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    62
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    63
	AssertEquals(3, 5, "fails");
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    64
}
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    65
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    66
void dummycase2(void *arg)
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    67
{
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    68
	char *msg = "eello";
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    69
	//msg[0] = 'H';
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    70
	AssertTrue(0, "fails");
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    71
}
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    72
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    73
void dummycase3(void *arg)
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    74
{
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    75
	AssertTrue(1, "passes");
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    76
}
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    77
a7d699502230 Converted libtest to a more proper dummy test suite (libtestdummy).
Markus Kauppila <markus.kauppila@gmail.com>
parents:
diff changeset
    78
#endif