diff --git a/src/tests/arithmetic/conjugate_test.cc b/src/tests/arithmetic/conjugate_test.cc index 4a76fa4e1..20badc36d 100644 --- a/src/tests/arithmetic/conjugate_test.cc +++ b/src/tests/arithmetic/conjugate_test.cc @@ -116,8 +116,8 @@ TEST(Conjugate_Test, ArmadilloComplexImplementation) TEST(Conjugate_Test, VolkComplexImplementation) { - std::complex* input = new std::complex[FLAGS_size_conjugate_test]; - std::complex* output = new std::complex[FLAGS_size_conjugate_test]; + std::complex* input = (std::complex*)volk_malloc(FLAGS_size_conjugate_test * sizeof(std::complex), volk_get_alignment()); + std::complex* output = (std::complex*)volk_malloc(FLAGS_size_conjugate_test * sizeof(std::complex), volk_get_alignment()); memset(input, 0, sizeof(std::complex) * FLAGS_size_conjugate_test); struct timeval tv; @@ -132,6 +132,6 @@ TEST(Conjugate_Test, VolkComplexImplementation) << "-length complex float vector using VOLK finished in " << (end - begin) << " microseconds" << std::endl; ASSERT_LE(0, end - begin); - delete [] input; - delete [] output; + volk_free(input); + volk_free(output); } diff --git a/src/tests/arithmetic/magnitude_squared_test.cc b/src/tests/arithmetic/magnitude_squared_test.cc index ef0e4bc50..ba66a50a5 100644 --- a/src/tests/arithmetic/magnitude_squared_test.cc +++ b/src/tests/arithmetic/magnitude_squared_test.cc @@ -116,9 +116,9 @@ TEST(MagnitudeSquared_Test, ArmadilloComplexImplementation) TEST(MagnitudeSquared_Test, VolkComplexImplementation) { - std::complex* input = new std::complex[FLAGS_size_magnitude_test]; + std::complex* input = (std::complex*)volk_malloc(FLAGS_size_magnitude_test * sizeof(std::complex), volk_get_alignment()); memset(input, 0, sizeof(std::complex) * FLAGS_size_magnitude_test); - float* output = new float[FLAGS_size_magnitude_test]; + float* output = (float*)volk_malloc(FLAGS_size_magnitude_test * sizeof(float), volk_get_alignment()); struct timeval tv; gettimeofday(&tv, NULL); long long int begin = tv.tv_sec * 1000000 + tv.tv_usec; @@ -131,8 +131,8 @@ TEST(MagnitudeSquared_Test, VolkComplexImplementation) << "-length vector using VOLK computed in " << (end - begin) << " microseconds" << std::endl; ASSERT_LE(0, end - begin); - delete [] input; - delete [] output; + volk_free(input); + volk_free(output); } // volk_32f_accumulator_s32f(&d_input_power, d_magnitude, d_fft_size); diff --git a/src/tests/arithmetic/multiply_test.cc b/src/tests/arithmetic/multiply_test.cc index eb0d16f4f..e4bfef12e 100644 --- a/src/tests/arithmetic/multiply_test.cc +++ b/src/tests/arithmetic/multiply_test.cc @@ -181,8 +181,8 @@ TEST(Multiply_Test, ArmadilloComplexImplementation) TEST(Multiply_Test, VolkComplexImplementation) { - std::complex* input = new std::complex[FLAGS_size_multiply_test]; - std::complex* output = new std::complex[FLAGS_size_multiply_test]; + std::complex* input = (std::complex*)volk_malloc(FLAGS_size_multiply_test * sizeof(std::complex), volk_get_alignment()); + std::complex* output = (std::complex*)volk_malloc(FLAGS_size_multiply_test * sizeof(std::complex), volk_get_alignment()); memset(input, 0, sizeof(std::complex) * FLAGS_size_multiply_test); struct timeval tv; @@ -198,8 +198,9 @@ TEST(Multiply_Test, VolkComplexImplementation) << " microseconds" << std::endl; ASSERT_LE(0, end - begin); - float* mag = new float [FLAGS_size_multiply_test]; + float* mag = (float*)volk_malloc(FLAGS_size_multiply_test * sizeof(float), volk_get_alignment()); volk_32fc_magnitude_32f(mag, output, FLAGS_size_multiply_test); + float* result = new float(0); volk_32f_accumulator_s32f(result, mag, FLAGS_size_multiply_test); // Comparing floating-point numbers is tricky. @@ -207,8 +208,8 @@ TEST(Multiply_Test, VolkComplexImplementation) // See http://code.google.com/p/googletest/wiki/AdvancedGuide#Floating-Point_Comparison float expected = 0; ASSERT_FLOAT_EQ(expected, result[0]); - delete [] input; - delete [] output; - delete [] mag; + volk_free(input); + volk_free(output); + volk_free(mag); }