Commit a0b932ca authored by Tobias Winchen's avatar Tobias Winchen
Browse files

Use proper float comparision

parent 58591230
Pipeline #86743 failed with stages
in 4 minutes and 48 seconds
......@@ -22,7 +22,7 @@ void SpectralKurtosisTester::TearDown()
{
}
void SpectralKurtosisTester::test_vector_generation(std::size_t sample_size, std::size_t window_size,
void SpectralKurtosisTester::test_vector_generation(std::size_t sample_size, std::size_t window_size,
bool with_rfi, float rfi_freq, float rfi_amp,
const std::vector<int> &rfi_window_indices,
std::vector<std::complex<float>> &samples)
......@@ -33,12 +33,12 @@ void SpectralKurtosisTester::test_vector_generation(std::size_t sample_size, std
tv.generate_test_vector(rfi_window_indices, samples);
}
void SpectralKurtosisTester::sk_computation(std::size_t nch, std::size_t window_size,
void SpectralKurtosisTester::sk_computation(std::size_t nch, std::size_t window_size,
const std::vector<std::complex<float>> &samples,
RFIStatistics &stat)
{
float sk_min = 0.8;
float sk_max = 1.2;
float sk_max = 1.2;
SpectralKurtosis sk(nch, window_size, sk_min, sk_max);
sk.compute_sk(samples, stat);
}
......@@ -68,7 +68,7 @@ TEST_F(SpectralKurtosisTester, sk_withoutRFI)
std::size_t nch = 1;
sk_computation(nch, window_size, samples, stat);
float expected_rfi_fraction = 0;
EXPECT_EQ(expected_rfi_fraction, stat.rfi_fraction);
EXPECT_FLOAT_EQ(expected_rfi_fraction, stat.rfi_fraction);
}
TEST_F(SpectralKurtosisTester, sk_withRFI)
......@@ -83,7 +83,7 @@ TEST_F(SpectralKurtosisTester, sk_withRFI)
std::size_t nch = 1;
sk_computation(nch, window_size, samples, stat);
float expected_rfi_fraction = (rfi_window_indices.size()/float(sample_size/window_size)) + 0.01;
EXPECT_EQ(expected_rfi_fraction, stat.rfi_fraction); //To check: fails inspite of actual and expected values being same.
EXPECT_FLOAT_EQ(expected_rfi_fraction, stat.rfi_fraction); //To check: fails inspite of actual and expected values being same.
}
TEST_F(SpectralKurtosisTester, sk_replacement)
......@@ -100,7 +100,7 @@ TEST_F(SpectralKurtosisTester, sk_replacement)
std::vector<int> rfi_window_indices{1, 2, 3, 4, 6, 7, 8, 9, 20, 30, 40};
std::vector<std::complex<float>> samples;
tv.generate_test_vector(rfi_window_indices, samples); //generating test vector
//SK
std::size_t nch = 1;
float sk_min = 0.8;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment