We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3319 - Getting the POSIX out of testqsort.c
Summary: Getting the POSIX out of testqsort.c
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: HG 2.0
Hardware: All Windows (All)
: P2 trivial
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-04 19:04 UTC by Simon Hug
Modified: 2016-10-01 19:34 UTC (History)
0 users

See Also:


Attachments
Removes POSIX code out of testqsort.c (1.73 KB, patch)
2016-05-04 19:04 UTC, Simon Hug
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Hug 2016-05-04 19:04:54 UTC
Created attachment 2441 [details]
Removes POSIX code out of testqsort.c

There's a call to the POSIX function random in test/testqsort.c. Naturally, Windows doesn't do that. The attached patch changes the call to the SDLtest framework random functions and adds some seed control.

Looking at SDLTest_RandomInitTime, I just want to say that 'srand((unsigned int)time(NULL)); a=rand(); srand(clock()); b=rand();' is an absolutely terrible way to initialize a seed on Windows because of its terrible LCG.
Comment 1 Sam Lantinga 2016-10-01 19:34:05 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/53980a18cdde

Also, agreed on the srand() comment, but I think it's sufficient for testing purposes.