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
2253de34
Commit
2253de34
authored
Aug 06, 2011
by
Markus Kauppila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed a bunch of compiler warnings.
parent
a3ce2b97
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
69 deletions
+33
-69
xml.c
test/test-automation/src/libtest/xml.c
+1
-1
logger.h
test/test-automation/src/runner/logger.h
+1
-6
runner.c
test/test-automation/src/runner/runner.c
+9
-6
testaudio.c
test/test-automation/tests/testaudio/testaudio.c
+21
-25
testrect.c
test/test-automation/tests/testrect/testrect.c
+1
-31
No files found.
test/test-automation/src/libtest/xml.c
View file @
2253de34
...
@@ -168,7 +168,7 @@ EscapeString(const char *string)
...
@@ -168,7 +168,7 @@ EscapeString(const char *string)
// escape the string
// escape the string
char
*
curRetBuffer
=
retBuffer
;
char
*
curRetBuffer
=
retBuffer
;
c
har
*
curString
=
string
;
c
onst
char
*
curString
=
string
;
char
character
=
*
curString
;
char
character
=
*
curString
;
while
(
(
character
=
*
curString
++
)
)
{
while
(
(
character
=
*
curString
++
)
)
{
...
...
test/test-automation/src/runner/logger.h
View file @
2253de34
...
@@ -22,7 +22,6 @@
...
@@ -22,7 +22,6 @@
#define _LOGGER_H
#define _LOGGER_H
#include <SDL/SDL_stdinc.h>
#include <SDL/SDL_stdinc.h>
#include <time.h>
#include <time.h>
/* Logging levels */
/* Logging levels */
...
@@ -31,6 +30,7 @@ typedef enum LogLevel {
...
@@ -31,6 +30,7 @@ typedef enum LogLevel {
LOGGER_VERBOSE
LOGGER_VERBOSE
}
Level
;
}
Level
;
//! Default logging level
#define LOGGER_DEFAULT_LEVEL LOGGER_TERSE
#define LOGGER_DEFAULT_LEVEL LOGGER_TERSE
//! Contains information for the logger
//! Contains information for the logger
...
@@ -77,7 +77,6 @@ typedef void (*LogFp)(time_t eventTime, char *fmt, ...);
...
@@ -77,7 +77,6 @@ typedef void (*LogFp)(time_t eventTime, char *fmt, ...);
/*! Function pointers to actual logging function implementations */
/*! Function pointers to actual logging function implementations */
extern
RunStartedFp
RunStarted
;
extern
RunStartedFp
RunStarted
;
extern
RunEndedFp
RunEnded
;
extern
RunEndedFp
RunEnded
;
extern
SuiteStartedFp
SuiteStarted
;
extern
SuiteStartedFp
SuiteStarted
;
...
@@ -89,8 +88,4 @@ extern AssertWithValuesFp AssertWithValues;
...
@@ -89,8 +88,4 @@ extern AssertWithValuesFp AssertWithValues;
extern
AssertSummaryFp
AssertSummary
;
extern
AssertSummaryFp
AssertSummary
;
extern
LogFp
Log
;
extern
LogFp
Log
;
//! Run seed for harness
extern
char
*
runSeed
;
#endif
#endif
test/test-automation/src/runner/runner.c
View file @
2253de34
...
@@ -180,6 +180,8 @@ TestCaseTearDownFp LoadTestTearDownFunction(void *suite);
...
@@ -180,6 +180,8 @@ TestCaseTearDownFp LoadTestTearDownFunction(void *suite);
CountFailedAssertsFp
LoadCountFailedAssertsFunction
(
void
*
suite
);
CountFailedAssertsFp
LoadCountFailedAssertsFunction
(
void
*
suite
);
void
KillHungTestInChildProcess
(
int
signum
);
void
KillHungTestInChildProcess
(
int
signum
);
void
UnloadTestSuites
(
TestSuiteReference
*
suites
);
void
UnloadTestSuites
(
TestSuiteReference
*
suites
);
int
FilterTestCase
(
TestCaseReference
*
testReference
);
int
HandleChildProcessReturnValue
(
int
stat_lock
);
/*! Pointers to selected logger implementation */
/*! Pointers to selected logger implementation */
...
@@ -232,7 +234,7 @@ ScanForTestSuites(char *directoryName, char *extension)
...
@@ -232,7 +234,7 @@ ScanForTestSuites(char *directoryName, char *extension)
exit
(
2
);
exit
(
2
);
}
}
while
(
entry
=
readdir
(
directory
)
)
{
while
(
(
entry
=
readdir
(
directory
))
)
{
// discards . and .. and hidden files starting with dot and directories etc.
// discards . and .. and hidden files starting with dot and directories etc.
if
(
strlen
(
entry
->
d_name
)
>
2
&&
entry
->
d_name
[
0
]
!=
'.'
&&
entry
->
d_type
==
DT_REG
)
{
if
(
strlen
(
entry
->
d_name
)
>
2
&&
entry
->
d_name
[
0
]
!=
'.'
&&
entry
->
d_type
==
DT_REG
)
{
const
char
*
delimiters
=
"."
;
const
char
*
delimiters
=
"."
;
...
@@ -707,8 +709,8 @@ SetTestTimeout(int timeout, void (*callback)(int))
...
@@ -707,8 +709,8 @@ SetTestTimeout(int timeout, void (*callback)(int))
*/
*/
int
timeoutInMilliseconds
=
tm
*
1000
;
int
timeoutInMilliseconds
=
tm
*
1000
;
SDL_TimerID
timerID
=
SDL_AddTimer
(
timeoutInMilliseconds
,
callback
,
0x0
);
SDL_TimerID
timerID
=
SDL_AddTimer
(
timeoutInMilliseconds
,
(
SDL_TimerCallback
)
callback
,
0x0
);
if
(
timerID
==
NULL
)
{
if
(
timerID
==
0
)
{
fprintf
(
stderr
,
"Error: Creation of SDL timer failed.
\n
"
);
fprintf
(
stderr
,
"Error: Creation of SDL timer failed.
\n
"
);
fprintf
(
stderr
,
"Error: %s
\n
"
,
SDL_GetError
());
fprintf
(
stderr
,
"Error: %s
\n
"
,
SDL_GetError
());
}
}
...
@@ -734,6 +736,8 @@ SetTestTimeout(int timeout, void (*callback)(int))
...
@@ -734,6 +736,8 @@ SetTestTimeout(int timeout, void (*callback)(int))
void
void
KillHungTestInChildProcess
(
int
signum
)
KillHungTestInChildProcess
(
int
signum
)
{
{
(
void
)
signum
;
// keeps the compiler silent about unused variable
exit
(
TEST_RESULT_KILLED
);
exit
(
TEST_RESULT_KILLED
);
}
}
...
@@ -829,7 +833,7 @@ ExecuteTest(TestCase *testItem, Uint64 execKey) {
...
@@ -829,7 +833,7 @@ ExecuteTest(TestCase *testItem, Uint64 execKey) {
exit
(
RunTest
(
testItem
,
execKey
));
exit
(
RunTest
(
testItem
,
execKey
));
}
else
{
}
else
{
int
stat_lock
=
-
1
;
int
stat_lock
=
-
1
;
int
child
=
wait
(
&
stat_lock
);
wait
(
&
stat_lock
);
retVal
=
HandleChildProcessReturnValue
(
stat_lock
);
retVal
=
HandleChildProcessReturnValue
(
stat_lock
);
}
}
...
@@ -986,7 +990,7 @@ SetUpLogger(const int log_stdout_enabled, const int xml_enabled, const int xsl_e
...
@@ -986,7 +990,7 @@ SetUpLogger(const int log_stdout_enabled, const int xml_enabled, const int xsl_e
if
(
xml_enabled
)
{
if
(
xml_enabled
)
{
char
*
sheet
=
NULL
;
char
*
sheet
=
NULL
;
if
(
xsl_enabled
)
{
if
(
xsl_enabled
)
{
sheet
=
"style.xsl"
;
// default style s
heet;
sheet
=
(
char
*
)
defaultXslS
heet
;
}
}
if
(
custom_xsl_enabled
)
{
if
(
custom_xsl_enabled
)
{
...
@@ -1285,7 +1289,6 @@ main(int argc, char *argv[])
...
@@ -1285,7 +1289,6 @@ main(int argc, char *argv[])
ParseOptions
(
argc
,
argv
);
ParseOptions
(
argc
,
argv
);
char
*
testSuiteName
=
NULL
;
int
suiteCounter
=
0
;
int
suiteCounter
=
0
;
#if defined(linux) || defined( __linux)
#if defined(linux) || defined( __linux)
...
...
test/test-automation/tests/testaudio/testaudio.c
View file @
2253de34
...
@@ -31,6 +31,23 @@ TestCaseReference **QueryTestSuite() {
...
@@ -31,6 +31,23 @@ TestCaseReference **QueryTestSuite() {
return
(
TestCaseReference
**
)
testSuite
;
return
(
TestCaseReference
**
)
testSuite
;
}
}
// Fixture
void
SetUp
(
void
*
arg
)
{
/* Start SDL. */
int
ret
=
SDL_Init
(
SDL_INIT_AUDIO
);
AssertTrue
(
ret
==
0
,
"SDL_Init(SDL_INIT_AUDIO): %s"
,
SDL_GetError
());
}
void
TearDown
(
void
*
arg
)
{
/* Quit SDL. */
SDL_Quit
();
}
/* Test case functions */
/* Test case functions */
/**
/**
...
@@ -40,11 +57,7 @@ int audio_printOutputDevices()
...
@@ -40,11 +57,7 @@ int audio_printOutputDevices()
{
{
int
ret
;
int
ret
;
int
i
,
n
;
int
i
,
n
;
char
*
name
;
const
char
*
name
;
/* Start SDL. */
ret
=
SDL_Init
(
SDL_INIT_AUDIO
);
AssertTrue
(
ret
==
0
,
"SDL_Init(SDL_INIT_AUDIO): %s"
,
SDL_GetError
());
/* Get number of devices. */
/* Get number of devices. */
n
=
SDL_GetNumAudioDevices
(
0
);
n
=
SDL_GetNumAudioDevices
(
0
);
...
@@ -59,9 +72,6 @@ int audio_printOutputDevices()
...
@@ -59,9 +72,6 @@ int audio_printOutputDevices()
AssertTrue
(
strlen
(
name
)
>
0
,
"name blank"
);
AssertTrue
(
strlen
(
name
)
>
0
,
"name blank"
);
}
}
}
}
/* Quit SDL. */
SDL_Quit
();
}
}
/**
/**
...
@@ -71,11 +81,7 @@ int audio_printInputDevices()
...
@@ -71,11 +81,7 @@ int audio_printInputDevices()
{
{
int
ret
;
int
ret
;
int
i
,
n
;
int
i
,
n
;
char
*
name
;
const
char
*
name
;
/* Start SDL. */
ret
=
SDL_Init
(
SDL_INIT_AUDIO
);
AssertTrue
(
ret
==
0
,
"SDL_Init(SDL_INIT_AUDIO): %s"
,
SDL_GetError
());
/* Get number of devices. */
/* Get number of devices. */
n
=
SDL_GetNumAudioDevices
(
1
);
n
=
SDL_GetNumAudioDevices
(
1
);
...
@@ -90,9 +96,6 @@ int audio_printInputDevices()
...
@@ -90,9 +96,6 @@ int audio_printInputDevices()
AssertTrue
(
strlen
(
name
)
>
0
,
"name empty"
);
AssertTrue
(
strlen
(
name
)
>
0
,
"name empty"
);
}
}
}
}
/* Quit SDL. */
SDL_Quit
();
}
}
/**
/**
...
@@ -101,7 +104,7 @@ int audio_printInputDevices()
...
@@ -101,7 +104,7 @@ int audio_printInputDevices()
int
audio_printAudioDrivers
()
int
audio_printAudioDrivers
()
{
{
int
i
,
n
;
int
i
,
n
;
char
*
name
;
c
onst
c
har
*
name
;
/* Get number of drivers */
/* Get number of drivers */
n
=
SDL_GetNumAudioDrivers
();
n
=
SDL_GetNumAudioDrivers
();
...
@@ -124,17 +127,10 @@ int audio_printAudioDrivers()
...
@@ -124,17 +127,10 @@ int audio_printAudioDrivers()
int
audio_printCurrentAudioDriver
()
int
audio_printCurrentAudioDriver
()
{
{
int
ret
;
int
ret
;
char
*
name
;
const
char
*
name
;
/* Start SDL. */
ret
=
SDL_Init
(
SDL_INIT_AUDIO
);
AssertTrue
(
ret
==
0
,
"SDL_Init(SDL_INIT_AUDIO): %s"
,
SDL_GetError
());
/* Check current audio driver */
/* Check current audio driver */
name
=
SDL_GetCurrentAudioDriver
();
name
=
SDL_GetCurrentAudioDriver
();
AssertTrue
(
name
!=
NULL
,
"name != NULL"
);
AssertTrue
(
name
!=
NULL
,
"name != NULL"
);
AssertTrue
(
strlen
(
name
)
>
0
,
"name empty"
);
AssertTrue
(
strlen
(
name
)
>
0
,
"name empty"
);
/* Quit SDL. */
SDL_Quit
();
}
}
test/test-automation/tests/testrect/testrect.c
View file @
2253de34
...
@@ -12,14 +12,10 @@
...
@@ -12,14 +12,10 @@
static
const
TestCaseReference
test1
=
static
const
TestCaseReference
test1
=
(
TestCaseReference
){
"rect_testIntersectRectAndLine"
,
"description"
,
TEST_ENABLED
,
0
,
0
};
(
TestCaseReference
){
"rect_testIntersectRectAndLine"
,
"description"
,
TEST_ENABLED
,
0
,
0
};
static
const
TestCaseReference
test2
=
(
TestCaseReference
){
"rect_testIntersectRectAndLineFuzzed"
,
"Tests rect to line intersection with fuzzed values"
,
TEST_ENABLED
,
0
,
0
};
/* Test suite */
/* Test suite */
extern
const
TestCaseReference
*
testSuite
[]
=
{
extern
const
TestCaseReference
*
testSuite
[]
=
{
&
test1
,
&
test2
,
NULL
&
test1
,
NULL
};
};
TestCaseReference
**
QueryTestSuite
()
{
TestCaseReference
**
QueryTestSuite
()
{
...
@@ -139,29 +135,3 @@ int rect_testIntersectRectAndLine (void *arg)
...
@@ -139,29 +135,3 @@ int rect_testIntersectRectAndLine (void *arg)
"diagonal line to upper right was incorrectly clipped: %d,%d - %d,%d"
,
"diagonal line to upper right was incorrectly clipped: %d,%d - %d,%d"
,
x1
,
y1
,
x2
,
y2
);
x1
,
y1
,
x2
,
y2
);
}
}
/*!
* \brief Tests SDL_IntersectRectAndLine()
*
* \sa
* http://wiki.libsdl.org/moin.cgi/SDL_IntersectRectAndLine
*/
int
rect_testIntersectRectAndLineFuzzed
(
void
*
arg
)
{
SDL_Rect
rect
=
{
0
,
0
,
RandomInteger
(),
RandomInteger
()
};
int
x1
,
y1
;
int
x2
,
y2
;
SDL_bool
clipped
;
x1
=
-
RandomInteger
();
y1
=
RandomInteger
();
x2
=
-
RandomInteger
();
y2
=
RandomInteger
();
clipped
=
SDL_IntersectRectAndLine
(
&
rect
,
&
x1
,
&
y1
,
&
x2
,
&
y2
);
AssertTrue
(
!
clipped
,
/*&& x1 == -10 && y1 == 0 && x2 == -10 && y2 == 31, */
"line outside to the left was incorrectly clipped: %d,%d - %d,%d"
,
x1
,
y1
,
x2
,
y2
);
}
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