Build with -Wfloat-conversion + fix all warnings
This commit is contained in:
committed by
GitHub
parent
17c459e384
commit
a919774fe4
@@ -919,7 +919,7 @@ static int convert_audio_chunks(SDL_AudioStream* stream, const void* src, int sr
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (to_get)
|
||||
{
|
||||
ret = get_audio_data_split(stream, (Uint8*)(dst) + total_out, to_get);
|
||||
@@ -1026,7 +1026,7 @@ static int audio_resampleLoss(void *arg)
|
||||
}
|
||||
|
||||
tick_beg = SDL_GetPerformanceCounter();
|
||||
|
||||
|
||||
buf_out = (float *)SDL_malloc(len_target);
|
||||
SDLTest_AssertCheck(buf_out != NULL, "Expected output buffer to be created.");
|
||||
if (buf_out == NULL) {
|
||||
@@ -1059,11 +1059,11 @@ static int audio_resampleLoss(void *arg)
|
||||
}
|
||||
SDL_free(buf_out);
|
||||
signal_to_noise = 10 * SDL_log10(sum_squared_value / sum_squared_error); /* decibel */
|
||||
SDLTest_AssertCheck(isfinite(sum_squared_value), "Sum of squared target should be finite.");
|
||||
SDLTest_AssertCheck(isfinite(sum_squared_error), "Sum of squared error should be finite.");
|
||||
SDLTest_AssertCheck(ISFINITE(sum_squared_value), "Sum of squared target should be finite.");
|
||||
SDLTest_AssertCheck(ISFINITE(sum_squared_error), "Sum of squared error should be finite.");
|
||||
/* Infinity is theoretically possible when there is very little to no noise */
|
||||
SDLTest_AssertCheck(!isnan(signal_to_noise), "Signal-to-noise ratio should not be NaN.");
|
||||
SDLTest_AssertCheck(isfinite(max_error), "Maximum conversion error should be finite.");
|
||||
SDLTest_AssertCheck(!ISNAN(signal_to_noise), "Signal-to-noise ratio should not be NaN.");
|
||||
SDLTest_AssertCheck(ISFINITE(max_error), "Maximum conversion error should be finite.");
|
||||
SDLTest_AssertCheck(signal_to_noise >= spec->signal_to_noise, "Conversion signal-to-noise ratio %f dB should be no less than %f dB.",
|
||||
signal_to_noise, spec->signal_to_noise);
|
||||
SDLTest_AssertCheck(max_error <= spec->max_error, "Maximum conversion error %f should be no more than %f.",
|
||||
@@ -1345,11 +1345,11 @@ static int audio_formatChange(void *arg)
|
||||
}
|
||||
|
||||
signal_to_noise = 10 * SDL_log10(sum_squared_value / sum_squared_error); /* decibel */
|
||||
SDLTest_AssertCheck(isfinite(sum_squared_value), "Sum of squared target should be finite.");
|
||||
SDLTest_AssertCheck(isfinite(sum_squared_error), "Sum of squared error should be finite.");
|
||||
SDLTest_AssertCheck(ISFINITE(sum_squared_value), "Sum of squared target should be finite.");
|
||||
SDLTest_AssertCheck(ISFINITE(sum_squared_error), "Sum of squared error should be finite.");
|
||||
/* Infinity is theoretically possible when there is very little to no noise */
|
||||
SDLTest_AssertCheck(!isnan(signal_to_noise), "Signal-to-noise ratio should not be NaN.");
|
||||
SDLTest_AssertCheck(isfinite(max_error), "Maximum conversion error should be finite.");
|
||||
SDLTest_AssertCheck(!ISNAN(signal_to_noise), "Signal-to-noise ratio should not be NaN.");
|
||||
SDLTest_AssertCheck(ISFINITE(max_error), "Maximum conversion error should be finite.");
|
||||
SDLTest_AssertCheck(signal_to_noise >= target_signal_to_noise, "Conversion signal-to-noise ratio %f dB should be no less than %f dB.",
|
||||
signal_to_noise, target_signal_to_noise);
|
||||
SDLTest_AssertCheck(max_error <= target_max_error, "Maximum conversion error %f should be no more than %f.",
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#define EULER M_E
|
||||
#endif
|
||||
|
||||
#define IS_INFINITY(V) isinf(V)
|
||||
#define IS_INFINITY(V) ISINF(V)
|
||||
|
||||
/* Square root of 3 (used in atan2) */
|
||||
#define SQRT3 1.7320508075688771931766041234368458390235900878906250
|
||||
@@ -207,7 +207,7 @@ helper_range(const char *func_name, d_to_d_func func)
|
||||
for (i = 0; i < RANGE_TEST_ITERATIONS; i++, test_value += RANGE_TEST_STEP) {
|
||||
double result;
|
||||
/* These are tested elsewhere */
|
||||
if (isnan(test_value) || isinf(test_value)) {
|
||||
if (ISNAN(test_value) || ISINF(test_value)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@ static int
|
||||
floor_nanCase(void *args)
|
||||
{
|
||||
const double result = SDL_floor(NAN);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Floor(nan), expected nan, got %f",
|
||||
result);
|
||||
return TEST_COMPLETED;
|
||||
@@ -376,7 +376,7 @@ static int
|
||||
ceil_nanCase(void *args)
|
||||
{
|
||||
const double result = SDL_ceil(NAN);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Ceil(nan), expected nan, got %f",
|
||||
result);
|
||||
return TEST_COMPLETED;
|
||||
@@ -480,7 +480,7 @@ static int
|
||||
trunc_nanCase(void *args)
|
||||
{
|
||||
const double result = SDL_trunc(NAN);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Trunc(nan), expected nan, got %f",
|
||||
result);
|
||||
return TEST_COMPLETED;
|
||||
@@ -584,7 +584,7 @@ static int
|
||||
round_nanCase(void *args)
|
||||
{
|
||||
const double result = SDL_round(NAN);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Round(nan), expected nan, got %f",
|
||||
result);
|
||||
return TEST_COMPLETED;
|
||||
@@ -688,7 +688,7 @@ static int
|
||||
fabs_nanCase(void *args)
|
||||
{
|
||||
const double result = SDL_fabs(NAN);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Fabs(nan), expected nan, got %f",
|
||||
result);
|
||||
return TEST_COMPLETED;
|
||||
@@ -765,12 +765,12 @@ copysign_nanCases(void *args)
|
||||
double result;
|
||||
|
||||
result = SDL_copysign(NAN, 1.0);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Copysign(nan,1.0), expected nan, got %f",
|
||||
result);
|
||||
|
||||
result = SDL_copysign(NAN, -1.0);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Copysign(nan,-1.0), expected nan, got %f",
|
||||
result);
|
||||
return TEST_COMPLETED;
|
||||
@@ -793,7 +793,7 @@ copysign_rangeTest(void *args)
|
||||
for (i = 0; i < RANGE_TEST_ITERATIONS; i++, test_value += RANGE_TEST_STEP) {
|
||||
double result;
|
||||
/* These are tested elsewhere */
|
||||
if (isnan(test_value) || isinf(test_value)) {
|
||||
if (ISNAN(test_value) || ISINF(test_value)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -829,22 +829,22 @@ fmod_divOfInfCases(void *args)
|
||||
double result;
|
||||
|
||||
result = SDL_fmod(INFINITY, -1.0);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Fmod(%f,%.1f), expected %f, got %f",
|
||||
INFINITY, -1.0, NAN, result);
|
||||
|
||||
result = SDL_fmod(INFINITY, 1.0);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Fmod(%f,%.1f), expected %f, got %f",
|
||||
INFINITY, 1.0, NAN, result);
|
||||
|
||||
result = SDL_fmod(-INFINITY, -1.0);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Fmod(%f,%.1f), expected %f, got %f",
|
||||
-INFINITY, -1.0, NAN, result);
|
||||
|
||||
result = SDL_fmod(-INFINITY, 1.0);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Fmod(%f,%.1f), expected %f, got %f",
|
||||
-INFINITY, 1.0, NAN, result);
|
||||
|
||||
@@ -909,22 +909,22 @@ fmod_divByZeroCases(void *args)
|
||||
double result;
|
||||
|
||||
result = SDL_fmod(1.0, 0.0);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Fmod(1.0,0.0), expected nan, got %f",
|
||||
result);
|
||||
|
||||
result = SDL_fmod(-1.0, 0.0);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Fmod(-1.0,0.0), expected nan, got %f",
|
||||
result);
|
||||
|
||||
result = SDL_fmod(1.0, -0.0);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Fmod(1.0,-0.0), expected nan, got %f",
|
||||
result);
|
||||
|
||||
result = SDL_fmod(-1.0, -0.0);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Fmod(-1.0,-0.0), expected nan, got %f",
|
||||
result);
|
||||
|
||||
@@ -941,22 +941,22 @@ fmod_nanCases(void *args)
|
||||
double result;
|
||||
|
||||
result = SDL_fmod(NAN, 1.0);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Fmod(nan,1.0), expected nan, got %f",
|
||||
result);
|
||||
|
||||
result = SDL_fmod(NAN, -1.0);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Fmod(nan,-1.0), expected nan, got %f",
|
||||
result);
|
||||
|
||||
result = SDL_fmod(1.0, NAN);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Fmod(1.0,nan), expected nan, got %f",
|
||||
result);
|
||||
|
||||
result = SDL_fmod(-1.0, NAN);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Fmod(-1.0,nan), expected nan, got %f",
|
||||
result);
|
||||
|
||||
@@ -996,7 +996,7 @@ fmod_rangeTest(void *args)
|
||||
for (i = 0; i < RANGE_TEST_ITERATIONS; i++, test_value += RANGE_TEST_STEP) {
|
||||
double result;
|
||||
/* These are tested elsewhere */
|
||||
if (isnan(test_value) || isinf(test_value)) {
|
||||
if (ISNAN(test_value) || ISINF(test_value)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1065,7 +1065,7 @@ exp_overflowCase(void *args)
|
||||
}
|
||||
|
||||
result = SDL_exp(710.0);
|
||||
SDLTest_AssertCheck(isinf(result),
|
||||
SDLTest_AssertCheck(ISINF(result),
|
||||
"Exp(%f), expected %f, got %f",
|
||||
710.0, INFINITY, result);
|
||||
return TEST_COMPLETED;
|
||||
@@ -1169,12 +1169,12 @@ log_nanCases(void *args)
|
||||
double result;
|
||||
|
||||
result = SDL_log(NAN);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Log(%f), expected %f, got %f",
|
||||
NAN, NAN, result);
|
||||
|
||||
result = SDL_log(-1234.5678);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Log(%f), expected %f, got %f",
|
||||
-1234.5678, NAN, result);
|
||||
|
||||
@@ -1259,12 +1259,12 @@ log10_nanCases(void *args)
|
||||
double result;
|
||||
|
||||
result = SDL_log10(NAN);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Log10(%f), expected %f, got %f",
|
||||
NAN, NAN, result);
|
||||
|
||||
result = SDL_log10(-1234.5678);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Log10(%f), expected %f, got %f",
|
||||
-1234.5678, NAN, result);
|
||||
|
||||
@@ -1477,7 +1477,7 @@ static int
|
||||
pow_badOperationCase(void *args)
|
||||
{
|
||||
const double result = SDL_pow(-2.0, 4.2);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Pow(%f,%f), expected %f, got %f",
|
||||
-2.0, 4.2, NAN, result);
|
||||
return TEST_COMPLETED;
|
||||
@@ -1529,17 +1529,17 @@ pow_nanArgsCases(void *args)
|
||||
double result;
|
||||
|
||||
result = SDL_pow(7.8, NAN);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Pow(%f,%f), expected %f, got %f",
|
||||
7.8, NAN, NAN, result);
|
||||
|
||||
result = SDL_pow(NAN, 10.0);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Pow(%f,%f), expected %f, got %f",
|
||||
NAN, 10.0, NAN, result);
|
||||
|
||||
result = SDL_pow(NAN, NAN);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Pow(%f,%f), expected %f, got %f",
|
||||
NAN, NAN, NAN, result);
|
||||
|
||||
@@ -1727,7 +1727,7 @@ pow_rangeTest(void *args)
|
||||
for (i = 0; i < RANGE_TEST_ITERATIONS; i++, test_value += RANGE_TEST_STEP) {
|
||||
double result;
|
||||
/* These are tested elsewhere */
|
||||
if (isnan(test_value) || isinf(test_value)) {
|
||||
if (ISNAN(test_value) || ISINF(test_value)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1775,7 +1775,7 @@ static int
|
||||
sqrt_nanCase(void *args)
|
||||
{
|
||||
const double result = SDL_sqrt(NAN);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Sqrt(%f), expected %f, got %f",
|
||||
NAN, NAN, result);
|
||||
return TEST_COMPLETED;
|
||||
@@ -1791,17 +1791,17 @@ sqrt_outOfDomainCases(void *args)
|
||||
double result;
|
||||
|
||||
result = SDL_sqrt(-1.0);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Sqrt(%f), expected %f, got %f",
|
||||
-1.0, NAN, result);
|
||||
|
||||
result = SDL_sqrt(-12345.6789);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Sqrt(%f), expected %f, got %f",
|
||||
-12345.6789, NAN, result);
|
||||
|
||||
result = SDL_sqrt(-INFINITY);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Sqrt(%f), expected %f, got %f",
|
||||
-INFINITY, NAN, result);
|
||||
|
||||
@@ -1910,7 +1910,7 @@ static int
|
||||
scalbn_nanCase(void *args)
|
||||
{
|
||||
const double result = SDL_scalbn(NAN, 2);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Scalbn(%f,%d), expected %f, got %f",
|
||||
NAN, 2, NAN, result);
|
||||
return TEST_COMPLETED;
|
||||
@@ -1965,12 +1965,12 @@ cos_infCases(void *args)
|
||||
double result;
|
||||
|
||||
result = SDL_cos(INFINITY);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Cos(%f), expected %f, got %f",
|
||||
INFINITY, NAN, result);
|
||||
|
||||
result = SDL_cos(-INFINITY);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Cos(%f), expected %f, got %f",
|
||||
-INFINITY, NAN, result);
|
||||
|
||||
@@ -1985,7 +1985,7 @@ static int
|
||||
cos_nanCase(void *args)
|
||||
{
|
||||
const double result = SDL_cos(NAN);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Cos(%f), expected %f, got %f",
|
||||
NAN, NAN, result);
|
||||
return TEST_COMPLETED;
|
||||
@@ -2054,7 +2054,7 @@ cos_rangeTest(void *args)
|
||||
for (i = 0; i < RANGE_TEST_ITERATIONS; i++, test_value += RANGE_TEST_STEP) {
|
||||
double result;
|
||||
/* These are tested elsewhere */
|
||||
if (isnan(test_value) || isinf(test_value)) {
|
||||
if (ISNAN(test_value) || ISINF(test_value)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2082,12 +2082,12 @@ sin_infCases(void *args)
|
||||
double result;
|
||||
|
||||
result = SDL_sin(INFINITY);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Sin(%f), expected %f, got %f",
|
||||
INFINITY, NAN, result);
|
||||
|
||||
result = SDL_sin(-INFINITY);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Sin(%f), expected %f, got %f",
|
||||
-INFINITY, NAN, result);
|
||||
|
||||
@@ -2102,7 +2102,7 @@ static int
|
||||
sin_nanCase(void *args)
|
||||
{
|
||||
const double result = SDL_sin(NAN);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Sin(%f), expected %f, got %f",
|
||||
NAN, NAN, result);
|
||||
return TEST_COMPLETED;
|
||||
@@ -2172,7 +2172,7 @@ sin_rangeTest(void *args)
|
||||
for (i = 0; i < RANGE_TEST_ITERATIONS; i++, test_value += RANGE_TEST_STEP) {
|
||||
double result;
|
||||
/* These are tested elsewhere */
|
||||
if (isnan(test_value) || isinf(test_value)) {
|
||||
if (ISNAN(test_value) || ISINF(test_value)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2200,12 +2200,12 @@ tan_infCases(void *args)
|
||||
double result;
|
||||
|
||||
result = SDL_tan(INFINITY);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Tan(%f), expected %f, got %f",
|
||||
INFINITY, NAN, result);
|
||||
|
||||
result = SDL_tan(-INFINITY);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Tan(%f), expected %f, got %f",
|
||||
-INFINITY, NAN, result);
|
||||
|
||||
@@ -2220,7 +2220,7 @@ static int
|
||||
tan_nanCase(void *args)
|
||||
{
|
||||
const double result = SDL_tan(NAN);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Tan(%f), expected %f, got %f",
|
||||
NAN, NAN, result);
|
||||
return TEST_COMPLETED;
|
||||
@@ -2307,12 +2307,12 @@ acos_outOfDomainCases(void *args)
|
||||
double result;
|
||||
|
||||
result = SDL_acos(1.1);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Acos(%f), expected %f, got %f",
|
||||
1.1, NAN, result);
|
||||
|
||||
result = SDL_acos(-1.1);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Acos(%f), expected %f, got %f",
|
||||
-1.1, NAN, result);
|
||||
|
||||
@@ -2327,7 +2327,7 @@ static int
|
||||
acos_nanCase(void *args)
|
||||
{
|
||||
const double result = SDL_acos(NAN);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Acos(%f), expected %f, got %f",
|
||||
NAN, NAN, result);
|
||||
return TEST_COMPLETED;
|
||||
@@ -2399,12 +2399,12 @@ asin_outOfDomainCases(void *args)
|
||||
double result;
|
||||
|
||||
result = SDL_asin(1.1);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Asin(%f), expected %f, got %f",
|
||||
1.1, NAN, result);
|
||||
|
||||
result = SDL_asin(-1.1);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Asin(%f), expected %f, got %f",
|
||||
-1.1, NAN, result);
|
||||
|
||||
@@ -2419,7 +2419,7 @@ static int
|
||||
asin_nanCase(void *args)
|
||||
{
|
||||
const double result = SDL_asin(NAN);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Asin(%f), expected %f, got %f",
|
||||
NAN, NAN, result);
|
||||
return TEST_COMPLETED;
|
||||
@@ -2513,7 +2513,7 @@ static int
|
||||
atan_nanCase(void *args)
|
||||
{
|
||||
const double result = SDL_atan(NAN);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Atan(%f), expected %f, got %f",
|
||||
NAN, NAN, result);
|
||||
return TEST_COMPLETED;
|
||||
@@ -2723,17 +2723,17 @@ atan2_nanCases(void *args)
|
||||
double result;
|
||||
|
||||
result = SDL_atan2(NAN, NAN);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Atan2(%f,%f), expected %f, got %f",
|
||||
NAN, NAN, NAN, result);
|
||||
|
||||
result = SDL_atan2(NAN, 1.0);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Atan2(%f,%f), expected %f, got %f",
|
||||
NAN, 1.0, NAN, result);
|
||||
|
||||
result = SDL_atan2(1.0, NAN);
|
||||
SDLTest_AssertCheck(isnan(result),
|
||||
SDLTest_AssertCheck(ISNAN(result),
|
||||
"Atan2(%f,%f), expected %f, got %f",
|
||||
1.0, NAN, NAN, result);
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
|
||||
#include <SDL3/SDL_test.h>
|
||||
|
||||
#define ISFINITE(X) isfinite((float)(X))
|
||||
#define ISINF(X) isinf((float)(X))
|
||||
#define ISNAN(X) isnan((float)(X))
|
||||
|
||||
/* Test collections */
|
||||
extern SDLTest_TestSuiteReference audioTestSuite;
|
||||
extern SDLTest_TestSuiteReference clipboardTestSuite;
|
||||
|
||||
@@ -1492,7 +1492,7 @@ int main(int argc, char *argv[])
|
||||
positions[i].h = (float)sprite_h;
|
||||
velocities[i].x = 0.0f;
|
||||
velocities[i].y = 0.0f;
|
||||
while (!velocities[i].x || !velocities[i].y) {
|
||||
while (velocities[i].x == 0.f || velocities[i].y == 0.f) {
|
||||
velocities[i].x = (float)((rand() % (2 + 1)) - 1);
|
||||
velocities[i].y = (float)((rand() % (2 + 1)) - 1);
|
||||
}
|
||||
|
||||
@@ -498,7 +498,7 @@ Render(unsigned int width, unsigned int height, shader_data *data)
|
||||
multiply_matrix(matrix_rotate, matrix_modelview, matrix_modelview);
|
||||
|
||||
/* Pull the camera back from the cube */
|
||||
matrix_modelview[14] -= 2.5;
|
||||
matrix_modelview[14] -= 2.5f;
|
||||
|
||||
perspective_matrix(45.0f, (float)width / height, 0.01f, 100.0f, matrix_perspective);
|
||||
multiply_matrix(matrix_perspective, matrix_modelview, matrix_mvp);
|
||||
|
||||
@@ -196,7 +196,7 @@ int main(int argc, char *argv[])
|
||||
positions[i].h = (float)sprite_h;
|
||||
velocities[i].x = 0.0f;
|
||||
velocities[i].y = 0.0f;
|
||||
while (!velocities[i].x && !velocities[i].y) {
|
||||
while (velocities[i].x == 0.f && velocities[i].y == 0.f) {
|
||||
velocities[i].x = (float)((rand() % (MAX_SPEED * 2 + 1)) - MAX_SPEED);
|
||||
velocities[i].y = (float)((rand() % (MAX_SPEED * 2 + 1)) - MAX_SPEED);
|
||||
}
|
||||
|
||||
@@ -568,7 +568,7 @@ int SDL_AppInit(void **appstate, int argc, char *argv[])
|
||||
positions[i].h = sprite_h;
|
||||
velocities[i].x = 0;
|
||||
velocities[i].y = 0;
|
||||
while (!velocities[i].x && !velocities[i].y) {
|
||||
while (velocities[i].x == 0.f && velocities[i].y == 0.f) {
|
||||
velocities[i].x = (float)SDLTest_RandomIntegerInRange(-MAX_SPEED, MAX_SPEED);
|
||||
velocities[i].y = (float)SDLTest_RandomIntegerInRange(-MAX_SPEED, MAX_SPEED);
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ int main(int argc, char *argv[])
|
||||
positions[i].h = (float)sprite_h;
|
||||
velocities[i].x = 0.0f;
|
||||
velocities[i].y = 0.0f;
|
||||
while (!velocities[i].x && !velocities[i].y) {
|
||||
while (velocities[i].x == 0.f && velocities[i].y == 0.f) {
|
||||
velocities[i].x = (float)((rand() % (MAX_SPEED * 2 + 1)) - MAX_SPEED);
|
||||
velocities[i].y = (float)((rand() % (MAX_SPEED * 2 + 1)) - MAX_SPEED);
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ static int InitSprites(void)
|
||||
positions[i].h = (float)sprite_h;
|
||||
velocities[i].x = 0.0f;
|
||||
velocities[i].y = 0.0f;
|
||||
while (!velocities[i].x && !velocities[i].y) {
|
||||
while (velocities[i].x == 0.f && velocities[i].y == 0.f) {
|
||||
velocities[i].x = (float)((rand() % (MAX_SPEED * 2 + 1)) - MAX_SPEED);
|
||||
velocities[i].y = (float)((rand() % (MAX_SPEED * 2 + 1)) - MAX_SPEED);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user