kfr

Fast, modern C++ DSP framework, FFT, Sample Rate Conversion, FIR/IIR/Biquad Filters (SSE, AVX, AVX-512, ARM NEON)
Log | Files | Refs | README

commit ce2f289e6a86245d194da54efcb5244d01edf234
parent b0a620c8d9724510f96d4efdc1264d8a63437e38
Author: d.levin256@gmail.com <d.levin256@gmail.com>
Date:   Mon, 16 Oct 2023 08:44:49 +0100

KFR_USE_STD_ALLOCATION test

Diffstat:
Mtests/base_test.cpp | 17+++++++++++++++++
1 file changed, 17 insertions(+), 0 deletions(-)

diff --git a/tests/base_test.cpp b/tests/base_test.cpp @@ -94,6 +94,23 @@ TEST(test_basic) TEST(ctti) { CHECK(cometa::type_name<float>() == std::string("float")); } +#ifdef KFR_USE_STD_ALLOCATION +TEST(std_allocation) +{ + univector<float> u; + std::vector<float>& v = u; + + std::vector<float> v2{ 1, 2, 3, 4 }; + + // Technically an UB but ok with all sane compilers + reinterpret_cast<univector<float>&>(v2) += 100.f; + CHECK(v2[0] == 101); + CHECK(v2[1] == 102); + CHECK(v2[2] == 103); + CHECK(v2[3] == 104); +} +#endif + } // namespace CMT_ARCH_NAME #ifndef KFR_NO_MAIN