summaryrefslogtreecommitdiffstats
path: root/host/tests/convert_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/tests/convert_test.cpp')
-rw-r--r--host/tests/convert_test.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/host/tests/convert_test.cpp b/host/tests/convert_test.cpp
index b63ff6752..1a5d30080 100644
--- a/host/tests/convert_test.cpp
+++ b/host/tests/convert_test.cpp
@@ -53,10 +53,14 @@ template <typename Range> static void loopback(
std::vector<void *> output0(1, &interm[0]), output1(1, &output[0]);
//convert to intermediate type
- convert::get_converter(in_id)(input0, output0, nsamps, 32767.);
+ convert::converter::sptr c0 = convert::get_converter(in_id)();
+ c0->set_scalar(32767.);
+ c0->conv(input0, output0, nsamps);
//convert back to host type
- convert::get_converter(out_id)(input1, output1, nsamps, 1/32767.);
+ convert::converter::sptr c1 = convert::get_converter(out_id)();
+ c1->set_scalar(1/32767.);
+ c1->conv(input1, output1, nsamps);
}
/***********************************************************************
@@ -216,10 +220,14 @@ BOOST_AUTO_TEST_CASE(test_convert_types_fc32_to_sc16){
std::vector<void *> output0(1, &interm[0]), output1(1, &output[0]);
//convert float to intermediate
- convert::get_converter(in_id)(input0, output0, nsamps, 32767.);
+ convert::converter::sptr c0 = convert::get_converter(in_id)();
+ c0->set_scalar(32767.);
+ c0->conv(input0, output0, nsamps);
//convert intermediate to short
- convert::get_converter(out_id)(input1, output1, nsamps, 1/32767.);
+ convert::converter::sptr c1 = convert::get_converter(out_id)();
+ c1->set_scalar(1/32767.);
+ c1->conv(input1, output1, nsamps);
//test that the inputs and outputs match
for (size_t i = 0; i < nsamps; i++){
@@ -257,10 +265,14 @@ BOOST_AUTO_TEST_CASE(test_convert_types_sc16_to_fc32){
std::vector<void *> output0(1, &interm[0]), output1(1, &output[0]);
//convert short to intermediate
- convert::get_converter(in_id)(input0, output0, nsamps, 32767.);
+ convert::converter::sptr c0 = convert::get_converter(in_id)();
+ c0->set_scalar(32767.);
+ c0->conv(input0, output0, nsamps);
//convert intermediate to float
- convert::get_converter(out_id)(input1, output1, nsamps, 1/32767.);
+ convert::converter::sptr c1 = convert::get_converter(out_id)();
+ c1->set_scalar(1/32767.);
+ c1->conv(input1, output1, nsamps);
//test that the inputs and outputs match
for (size_t i = 0; i < nsamps; i++){