Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
66677c0a
Commit
66677c0a
authored
Jul 14, 2011
by
Markus Kauppila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed AssertEquals.
parent
7de8abe0
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
30 additions
and
35 deletions
+30
-35
Makefile.am
test/test-automation/Makefile.am
+1
-1
SDL_test.c
test/test-automation/SDL_test.c
+1
-1
SDL_test.h
test/test-automation/SDL_test.h
+1
-1
logger.c
test/test-automation/logger.c
+0
-13
logger.h
test/test-automation/logger.h
+1
-1
plain_logger.c
test/test-automation/plain_logger.c
+17
-10
runner.c
test/test-automation/runner.c
+5
-3
testdummy.c
test/test-automation/testdummy/testdummy.c
+1
-2
xml_logger.c
test/test-automation/xml_logger.c
+3
-3
No files found.
test/test-automation/Makefile.am
View file @
66677c0a
...
@@ -3,7 +3,7 @@ ACLOCAL_AMFLAGS = -I acinclude -I build-scripts
...
@@ -3,7 +3,7 @@ ACLOCAL_AMFLAGS = -I acinclude -I build-scripts
SUBDIRS
=
testdummy testrect testplatform testaudio testsurface
SUBDIRS
=
testdummy testrect testplatform testaudio testsurface
bin_PROGRAMS
=
runner
bin_PROGRAMS
=
runner
runner_SOURCES
=
runner.c SDL_test.c
logger.c
xml_logger.c plain_logger.c xml.c logger_helpers.c
runner_SOURCES
=
runner.c SDL_test.c xml_logger.c plain_logger.c xml.c logger_helpers.c
runner_CLAGS
=
-W
-Wall
-Wextra
-g
`
sdl-config
--cflags
`
-DSDL_NO_COMPAT
runner_CLAGS
=
-W
-Wall
-Wextra
-g
`
sdl-config
--cflags
`
-DSDL_NO_COMPAT
runner_LDFLAGS
=
`
sdl-config
--libs
`
runner_LDFLAGS
=
`
sdl-config
--libs
`
...
...
test/test-automation/SDL_test.c
View file @
66677c0a
...
@@ -72,7 +72,7 @@ AssertEquals(int expected, int actual, char *message, ...)
...
@@ -72,7 +72,7 @@ AssertEquals(int expected, int actual, char *message, ...)
SDL_vsnprintf
(
buf
,
sizeof
(
buf
),
message
,
args
);
SDL_vsnprintf
(
buf
,
sizeof
(
buf
),
message
,
args
);
va_end
(
args
);
va_end
(
args
);
if
(
expected
!=
expected
)
{
if
(
expected
!=
actual
)
{
AssertWithValues
(
"AssertEquals"
,
0
,
buf
,
actual
,
expected
,
time
(
0
));
AssertWithValues
(
"AssertEquals"
,
0
,
buf
,
actual
,
expected
,
time
(
0
));
_testReturnValue
=
TEST_RESULT_FAILURE
;
_testReturnValue
=
TEST_RESULT_FAILURE
;
...
...
test/test-automation/SDL_test.h
View file @
66677c0a
...
@@ -90,7 +90,7 @@ int _CountFailedAsserts();
...
@@ -90,7 +90,7 @@ int _CountFailedAsserts();
* \param actual The actual value of tested variable
* \param actual The actual value of tested variable
* \param message Message that will be printed
* \param message Message that will be printed
*/
*/
void
AssertEquals
(
const
int
expected
,
const
int
actual
,
char
*
message
,
...);
void
AssertEquals
(
int
expected
,
int
actual
,
char
*
message
,
...);
/*!
/*!
* Assert function. Tests if the given condition is true. True in
* Assert function. Tests if the given condition is true. True in
...
...
test/test-automation/logger.c
deleted
100644 → 0
View file @
7de8abe0
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <SDL/SDL.h>
#include "logger.h"
#include "xml_logger.h"
#include "plain_logger.h"
test/test-automation/logger.h
View file @
66677c0a
...
@@ -45,7 +45,7 @@ typedef void (*AssertFp)(const char *assertName, int assertResult,
...
@@ -45,7 +45,7 @@ typedef void (*AssertFp)(const char *assertName, int assertResult,
const
char
*
assertMessage
,
time_t
eventTime
);
const
char
*
assertMessage
,
time_t
eventTime
);
typedef
void
(
*
AssertWithValuesFp
)(
const
char
*
assertName
,
int
assertResult
,
typedef
void
(
*
AssertWithValuesFp
)(
const
char
*
assertName
,
int
assertResult
,
const
char
*
assertMessage
,
int
actualValue
,
int
ex
c
pected
,
const
char
*
assertMessage
,
int
actualValue
,
int
expected
,
time_t
eventTime
);
time_t
eventTime
);
typedef
void
(
*
AssertSummaryFp
)(
int
numAsserts
,
int
numAssertsFailed
,
typedef
void
(
*
AssertSummaryFp
)(
int
numAsserts
,
int
numAssertsFailed
,
...
...
test/test-automation/plain_logger.c
View file @
66677c0a
...
@@ -15,22 +15,29 @@ static int indentLevel;
...
@@ -15,22 +15,29 @@ static int indentLevel;
/*!
/*!
* Prints out the output of the logger
* Prints out the output of the logger
*
*
* \param currentIdentLevel The currently used indentation level
* \param currentI
n
dentLevel The currently used indentation level
* \param message The message to be printed out
* \param message The message to be printed out
*/
*/
int
int
Output
(
const
int
currentIdentLevel
,
const
char
*
message
,
...)
Output
(
const
int
currentI
n
dentLevel
,
const
char
*
message
,
...)
{
{
va_list
list
;
va_start
(
list
,
message
);
int
ident
=
0
;
int
ident
=
0
;
for
(
;
ident
<
currentIdentLevel
;
++
ident
)
{
for
(
;
ident
<
currentI
n
dentLevel
;
++
ident
)
{
fprintf
(
stdout
,
" "
);
// \todo make configurable?
fprintf
(
stdout
,
" "
);
// \todo make configurable?
}
}
char
buffer
[
1024
];
SDL_vsnprintf
(
buffer
,
sizeof
(
buffer
),
message
,
list
);
char
buffer
[
1024
];
memset
(
buffer
,
0
,
1024
);
va_list
list
;
va_start
(
list
,
message
);
SDL_vsnprintf
(
buffer
,
1024
,
message
,
list
);
va_end
(
list
);
fprintf
(
stdout
,
"%s
\n
"
,
buffer
);
fprintf
(
stdout
,
"%s
\n
"
,
buffer
);
fflush
(
stdout
);
fflush
(
stdout
);
...
@@ -121,11 +128,11 @@ PlainAssert(const char *assertName, int assertResult, const char *assertMessage,
...
@@ -121,11 +128,11 @@ PlainAssert(const char *assertName, int assertResult, const char *assertMessage,
void
void
PlainAssertWithValues
(
const
char
*
assertName
,
int
assertResult
,
const
char
*
assertMessage
,
PlainAssertWithValues
(
const
char
*
assertName
,
int
assertResult
,
const
char
*
assertMessage
,
int
actualValue
,
int
expected
,
time_t
eventTime
)
int
actualValue
,
int
expected
Value
,
time_t
eventTime
)
{
{
const
char
*
result
=
(
assertResult
)
?
"passed"
:
"failed"
;
const
char
*
result
=
(
assertResult
)
?
"passed"
:
"failed"
;
Output
(
indentLevel
,
"%s: %s (expected %d, actualValue
&
d) - %s"
,
Output
(
indentLevel
,
"%s: %s (expected %d, actualValue
%
d) - %s"
,
assertName
,
result
,
expected
,
actualValue
,
assertMessage
);
assertName
,
result
,
expected
Value
,
actualValue
,
assertMessage
);
}
}
void
void
...
...
test/test-automation/runner.c
View file @
66677c0a
...
@@ -586,9 +586,11 @@ LoadCountFailedAssertsFunction(void *suite) {
...
@@ -586,9 +586,11 @@ LoadCountFailedAssertsFunction(void *suite) {
/*
/*
* Execute the test
* Execute a test. Loads the test, executes it and
* returns the tests return value to the caller.
*
*
* \param testItem Test to be executed
* \param testItem Test to be executed
* \param test result
*/
*/
int
int
RunTest
(
TestCase
*
testItem
)
{
RunTest
(
TestCase
*
testItem
)
{
...
@@ -629,8 +631,8 @@ void KillHungTest(int signum) {
...
@@ -629,8 +631,8 @@ void KillHungTest(int signum) {
}
}
/*!
/*!
*
Executes a test case. Loads the test, executes it and
*
Sets up a test case. Decideds wheter the test will
*
returns the tests return value to the caller
.
*
be executed in-proc or out-of-proc
.
*
*
* \param testItem The test case that will be executed
* \param testItem The test case that will be executed
* \return The return value of the test. Zero means success, non-zero failure.
* \return The return value of the test. Zero means success, non-zero failure.
...
...
test/test-automation/testdummy/testdummy.c
View file @
66677c0a
...
@@ -88,8 +88,7 @@ TearDown(void *arg)
...
@@ -88,8 +88,7 @@ TearDown(void *arg)
void
void
dummycase1
(
void
*
arg
)
dummycase1
(
void
*
arg
)
{
{
//AssertEquals(5, 5, "Assert message");
AssertEquals
(
5
,
5
,
"Assert message"
);
while
(
1
);
}
}
void
void
...
...
test/test-automation/xml_logger.c
View file @
66677c0a
...
@@ -76,18 +76,18 @@ static int prevEOL = YES;
...
@@ -76,18 +76,18 @@ static int prevEOL = YES;
*
*
* \todo Make the destination of the output changeable (defaults to stdout)
* \todo Make the destination of the output changeable (defaults to stdout)
*
*
* \param
i
dentLevel the indent level of the message
* \param
currentIn
dentLevel the indent level of the message
* \param EOL will it print end of line character or not
* \param EOL will it print end of line character or not
* \param the XML element itself
* \param the XML element itself
*
*
*/
*/
void
void
XMLOutputter
(
const
int
currentIdentLevel
,
XMLOutputter
(
const
int
currentI
n
dentLevel
,
int
EOL
,
const
char
*
message
)
int
EOL
,
const
char
*
message
)
{
{
if
(
ValidateString
(
message
))
{
if
(
ValidateString
(
message
))
{
int
ident
=
0
;
int
ident
=
0
;
for
(
;
ident
<
currentIdentLevel
&&
prevEOL
;
++
ident
)
{
for
(
;
ident
<
currentI
n
dentLevel
&&
prevEOL
;
++
ident
)
{
fprintf
(
stdout
,
" "
);
// \todo make configurable?
fprintf
(
stdout
,
" "
);
// \todo make configurable?
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment