test/test_mixramp: workaround for -Wdouble-promotion

This commit is contained in:
Max Kellermann 2021-04-28 09:15:06 +02:00
parent 018858ec97
commit 8c51440057
2 changed files with 9 additions and 9 deletions

View File

@ -13,25 +13,25 @@ TEST(MixRamp, Interpolate)
const char *input = "1.0 0.00;3.0 0.10;6.0 2.50;"; const char *input = "1.0 0.00;3.0 0.10;6.0 2.50;";
char *foo = strdup(input); char *foo = strdup(input);
EXPECT_NEAR(double(0), EXPECT_NEAR(0.,
mixramp_interpolate(foo, 0).count(), mixramp_interpolate(foo, 0).count(),
0.05); 0.05);
free(foo); free(foo);
foo = strdup(input); foo = strdup(input);
EXPECT_NEAR(float(0), EXPECT_NEAR(0.,
mixramp_interpolate(foo, 1).count(), mixramp_interpolate(foo, 1).count(),
0.005); 0.005);
free(foo); free(foo);
foo = strdup(input); foo = strdup(input);
EXPECT_NEAR(float(0.1), EXPECT_NEAR(0.1,
mixramp_interpolate(foo, 3).count(), mixramp_interpolate(foo, 3).count(),
0.005); 0.005);
free(foo); free(foo);
foo = strdup(input); foo = strdup(input);
EXPECT_NEAR(float(2.5), EXPECT_NEAR(2.5,
mixramp_interpolate(foo, 6).count(), mixramp_interpolate(foo, 6).count(),
0.01); 0.01);
free(foo); free(foo);
@ -41,25 +41,25 @@ TEST(MixRamp, Interpolate)
free(foo); free(foo);
foo = strdup(input); foo = strdup(input);
EXPECT_NEAR(float(0.05), EXPECT_NEAR(0.05,
mixramp_interpolate(foo, 2).count(), mixramp_interpolate(foo, 2).count(),
0.05); 0.05);
free(foo); free(foo);
foo = strdup(input); foo = strdup(input);
EXPECT_NEAR(float(1.3), EXPECT_NEAR(1.3,
mixramp_interpolate(foo, 4.5).count(), mixramp_interpolate(foo, 4.5).count(),
0.05); 0.05);
free(foo); free(foo);
foo = strdup(input); foo = strdup(input);
EXPECT_NEAR(float(0.9), EXPECT_NEAR(0.9,
mixramp_interpolate(foo, 4).count(), mixramp_interpolate(foo, 4).count(),
0.05); 0.05);
free(foo); free(foo);
foo = strdup(input); foo = strdup(input);
EXPECT_NEAR(float(1.7), EXPECT_NEAR(1.7,
mixramp_interpolate(foo, 5).count(), mixramp_interpolate(foo, 5).count(),
0.05); 0.05);
free(foo); free(foo);

View File

@ -154,7 +154,7 @@ TEST(PcmTest, VolumeFloat)
const auto _dest = ConstBuffer<float>::FromVoid(dest); const auto _dest = ConstBuffer<float>::FromVoid(dest);
for (unsigned i = 0; i < N; ++i) for (unsigned i = 0; i < N; ++i)
EXPECT_NEAR(_src[i] / 2, _dest[i], 1); EXPECT_NEAR((double)_src[i] / 2., (double)_dest[i], 1.);
pv.Close(); pv.Close();
} }