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
ff1e17dc
Commit
ff1e17dc
authored
May 26, 2011
by
Markus Kauppila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added TestCaseReference structure.
parent
d6d8dec0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
11 deletions
+38
-11
runner.c
test/test-automation/runner.c
+14
-7
SDL_test.c
test/test-automation/tests/SDL_test.c
+2
-1
SDL_test.h
test/test-automation/tests/SDL_test.h
+7
-0
test.c
test/test-automation/tests/test.c
+15
-3
No files found.
test/test-automation/runner.c
View file @
ff1e17dc
...
...
@@ -43,18 +43,18 @@ void *LoadLibrary() {
return
library
;
}
char
**
QueryTestCases
(
void
*
library
)
{
char
**
(
*
suite
)(
void
);
TestCaseReference
**
QueryTestCases
(
void
*
library
)
{
TestCaseReference
**
(
*
suite
)(
void
);
suite
=
(
char
**
(
*
)(
void
))
SDL_LoadFunction
(
library
,
"queryTestNam
es"
);
suite
=
(
TestCaseReference
**
(
*
)(
void
))
SDL_LoadFunction
(
library
,
"QueryTestCaseReferenc
es"
);
if
(
suite
==
NULL
)
{
printf
(
"
Quering test names failed, suite == NULL
\n
"
);
printf
(
"
Loading QueryTestCaseReferences() failed.
\n
"
);
printf
(
"%s
\n
"
,
SDL_GetError
());
}
char
**
tests
=
suite
();
TestCaseReference
**
tests
=
suite
();
if
(
tests
==
NULL
)
{
printf
(
"Failed to load test
cases. tests == NULL
\n
"
);
printf
(
"Failed to load test
references.
\n
"
);
printf
(
"%s
\n
"
,
SDL_GetError
());
}
...
...
@@ -99,7 +99,14 @@ int main(int argc, char *argv[]) {
const
Uint32
startTicks
=
SDL_GetTicks
();
void
*
library
=
LoadLibrary
();
char
**
tests
=
QueryTestCases
(
library
);
TestCaseReference
**
tests
=
QueryTestCases
(
library
);
if
(
tests
==
NULL
)
{
printf
(
"It's null
\n
"
);
}
else
{
printf
(
"It's NOT null
\n
"
);
}
printf
(
"%s name
\n
"
,
tests
[
1
]
->
name
);
for
(
testname
=
tests
[
counter
];
testname
;
testname
=
tests
[
++
counter
])
{
printf
(
"Running %s (in %s):
\n
"
,
testname
,
libName
);
...
...
test/test-automation/tests/SDL_test.c
View file @
ff1e17dc
...
...
@@ -43,7 +43,7 @@ void
AssertEquals
(
char
*
message
,
Uint32
expected
,
Uint32
actual
)
{
if
(
expected
!=
actual
)
{
printf
(
"
\n
===============================
\n
"
);
printf
(
"===============================
\n
"
);
printf
(
"Assert failed: %s
\n
"
,
message
);
printf
(
"Expected %d, got %d
\n
"
,
expected
,
actual
);
printf
(
"===============================
\n
"
);
...
...
@@ -51,4 +51,5 @@ AssertEquals(char *message, Uint32 expected, Uint32 actual)
}
}
#endif
test/test-automation/tests/SDL_test.h
View file @
ff1e17dc
...
...
@@ -23,6 +23,13 @@
#include <SDL/SDL.h>
typedef
struct
TestCaseReference
{
int
enabled
;
/* Set to TEST_ENABLED or TEST_DISABLED */
long
requirements
;
/* Set to TEST_REQUIRES_OPENGL, TEST_REQUIRES_AUDIO, ... */
char
*
name
;
/* "Func2Stress" */
char
*
description
;
/* "This test beats the crap out of func2()" */
}
TestCaseReference
;
void
TestInit
();
void
TestQuit
();
...
...
test/test-automation/tests/test.c
View file @
ff1e17dc
...
...
@@ -27,10 +27,22 @@
#include "SDL_test.h"
char
*
names
[]
=
{
"hello"
,
"hello2"
,
"hello3"
,
NULL
};
/*
TestCaseReference references[] = {
{.name = "hello", .description = "desc", .enabled = 1, .requirements = 0 }
};
*/
TestCaseReference
*
references
[]
=
{
{
"hello"
,
"description"
,
1
,
0
},
{
"hello2"
,
"description"
,
1
,
0
},
NULL
};
char
**
queryTestNam
es
()
{
return
nam
es
;
TestCaseReference
**
QueryTestCaseReferenc
es
()
{
return
referenc
es
;
}
void
hello
(
void
*
arg
){
...
...
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