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
8632b5f4
Commit
8632b5f4
authored
Aug 17, 2011
by
Markus Kauppila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed unit float and unit double generators.
parent
7d8de2d4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
5 deletions
+12
-5
fuzzer.c
test/test-automation/src/libSDLtest/fuzzer/fuzzer.c
+3
-3
fuzzer.h
test/test-automation/src/libSDLtest/fuzzer/fuzzer.h
+6
-2
testdummy.c
test/test-automation/tests/testdummy/testdummy.c
+3
-0
No files found.
test/test-automation/src/libSDLtest/fuzzer/fuzzer.c
View file @
8632b5f4
...
...
@@ -562,13 +562,13 @@ RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDoma
float
RandomUnitFloat
()
{
return
(
float
)
utl_randomInt
(
&
rndContext
)
/
UINT_MAX
;
return
(
float
)
RandomUint32
(
)
/
UINT_MAX
;
}
double
RandomUnitDouble
()
{
return
(
double
)
RandomUint64
()
/
LLONG_MAX
;
return
(
RandomUint64
()
>>
11
)
*
(
1
.
0
/
9007199254740992
.
0
)
;
}
float
...
...
@@ -599,7 +599,7 @@ RandomAsciiStringWithMaximumLength(int maxSize)
return
NULL
;
}
int
size
=
(
abs
(
RandomSint32
()
)
%
(
maxSize
+
1
))
+
1
;
int
size
=
(
RandomUint32
(
)
%
(
maxSize
+
1
))
+
1
;
char
*
string
=
SDL_malloc
(
size
*
sizeof
(
char
));
int
counter
=
0
;
...
...
test/test-automation/src/libSDLtest/fuzzer/fuzzer.h
View file @
8632b5f4
...
...
@@ -111,17 +111,21 @@ Sint64 RandomSint64();
float
RandomUnitFloat
();
/*!
* Returns random double in range [0.0 - 1.0
] (inclusive
)
* Returns random double in range [0.0 - 1.0
[ (note: zero included, 1 is not!
)
*/
double
RandomUnitDouble
();
/*!
* Returns random float
* Returns random float.
*
* Note: NOT implemented.
*/
float
RandomFloat
();
/*!
* Returns random double
*
* Note: NOT implemented.
*/
double
RandomDouble
();
...
...
test/test-automation/tests/testdummy/testdummy.c
View file @
8632b5f4
...
...
@@ -103,6 +103,9 @@ test_dummy1(void *arg)
//Log(0, "uint8 (same value): %d", RandomUint8BoundaryValue(200, 200, SDL_TRUE));
for
(;
1
;
)
printf
(
"%f
\n
"
,
RandomUnitFloat
());
for
(;
0
;
)
printf
(
"%d
\n
"
,
RandomSint16
());
...
...
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