Commit graph

37 commits

Author SHA1 Message Date
Aaron Rossetto
e7bb83729a tests: Apply clang-format to convert_test 2022-03-08 07:58:51 -06:00
Aaron Rossetto
be588b1483 tests: Fix converter benchmark disable on Boost <1.68
Boost versions prior to 1.68 appear to have a bug where a decorator to
denote a test as disabled is not honored when affixed to a data-driven
test case, which is how the benchmarks in convert_test are skipped when
the unit test is run. (The tests take some time to complete and we don't
want them running with every CI pass.)

This commit adds an alternative benchmark skipping mechanism when Boost
<1.68 is used. The benchmark test cases perform a runtime check for the
user-provided `--benchmark` command-line option. If not found, the test
case returns prematurely. If found, the test case will execute. Note
that because `--benchmark` is a command-line option specific to this
test, and not to Boost, the options must follow `--` in the command
line in order to take effect: `convert_test -- --benchmark`.
2022-03-08 07:58:51 -06:00
Aaron Rossetto
9c654a8f9a tests: Add saturating test cases
This commit adds test cases to convert_test to specifically test the
saturating behavior of the fc32/fc64-to-sc16 conversions.
2022-02-28 14:47:47 -06:00
Aaron Rossetto
b93a2bbf82 tests: Add conversion benchmarking tests
This commit adds Boost test cases for benchmarking each of the existing
conversions that are tested in convert_test. The benchmarks do take some
time, and we do not want to run they as part of every CI run, so they
are marked with a test decorator that disables the benchmark by default.

To run the benchmarks, invoke convert_test with `--run-test=+benchmark*`
to explicitly enable all disabled tests that begin with the word
'benchmark'. Individual benchmark test cases can be enabled by
specifying the full name of the benchmark test or by crafting a wildcard
that includes all benchmark test cases of interest.
2022-02-28 14:47:47 -06:00
Aaron Rossetto
751ef29584 convert: Add benchmarking abilities
This commit adds code to the convert tests to support the ability to
benchmark individual conversion test cases.
2022-02-28 14:47:47 -06:00
Martin Braun
16d6ef5c8a tests: Force converter tests to be run with all available prios 2022-02-28 14:47:47 -06:00
Aaron Rossetto
d835d348b3 convert: Minor cleanup
This commit implements some minor cleanup of various converter- and
convert test-related code:

* Improves the log messages regarding which converter was returned for a
request.

* Modifies the result checking code in the converter tests to only
report an out-of-range sample error once, rather than reporting every
out-of-range sample encountered during the test. This vastly cuts down
on the output when a conversion has failed.

* Adds a function `reverse_converter()` which, given a
`convert::id_type` describing a conversion from C1 to C2, returns a
`convert::id_type` describing the reverse conversion (C2 to C1).

* Removes two redundant test cases from the converter test.
2022-02-28 14:47:47 -06:00
Martin Braun
876d4150aa uhd: Apply clang-format against all .cpp and .hpp files in host/
Note: template_lvbitx.{cpp,hpp} need to be excluded from the list of
files that clang-format gets applied against.
2020-03-03 08:51:32 -06:00
Martin Braun
fed32af080 convert: Add CHDR converters
The difference between the _chdr converters and the _item32_ converters
is that the former do not require item32 boundaries, they do not require
endianness swapping, and they don't use IQ swapping either.

This is possible because the FPGA will do byte-swapping.
2019-11-26 11:49:10 -08:00
Brent Stapleton
967be2a4e8 uhd: mpm: apply clang-format to all files
Applying formatting changes to all .cpp and .hpp files in the following
directories:
```
find host/examples/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find host/tests/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find host/lib/usrp/dboard/neon/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find host/lib/usrp/dboard/magnesium/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find host/lib/usrp/device3/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find host/lib/usrp/mpmd/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find host/lib/usrp/x300/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find host/utils/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find mpm/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
```

Also formatted host/include/, except Cpp03 was used as a the language
standard instead of Cpp11.
```
sed -i 's/ Cpp11/ Cpp03/g' .clang-format
find host/include/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
```

Formatting style was designated by the .clang-format file.
2019-01-16 11:40:23 -08:00
Martin Braun
5d9a7c92d3 lib: Purge use of boost::assign, except for uhd::dict
Replaced with initialization lists.
Note: uhd::dict does not work with initializer lists without making
changes to said data structure. This commit has no functional changes,
so keeping the boost::assigns for uhd::dict.
2018-05-02 17:01:21 -07:00
Martin Braun
ae5211d71d uhd: Update license headers
All copyright is now attributed to "Ettus Research, a National
Instruments company".

SPDX headers were also updated to latest version 3.0.
2018-02-19 16:54:52 -08:00
Martin Braun
4f948e2c8b Move all license headers to SPDX format. 2017-12-22 10:45:51 -08:00
Tom Tsou
f21874e68a convert: Add sc12-sc16 converters
Create missing sc12-sc16 and sc16-sc12 type converters. To avoid
replicating the full sc12 converter class object, overload the
converter calls with C++11 std::enable_if metafunctions. When
used with std::is_floating and std::is_integral templates, this
allow a single template interface with compile time function
selection and static type checking.

Note the below std::enable_if interface is confusing, but quite
effective in this case.

  typename enable_if<is_floating_point<type>::value>::type* = NULL

Fixes: #966
Related: #967, #1721
2017-07-18 12:45:56 -07:00
Martin Braun
3d5176874f Merge branch 'maint' 2017-07-17 18:44:48 -07:00
Martin Braun
38723f6218 converters: Added some tolerance for floating point-based tests to account for acceptable rounding 2017-07-07 13:42:48 -07:00
Andrej Rode
26cc20847c uhd: replace BOOST_FOREACH with C++11 range-based for loop
Note: This is the first commit that uses for-range, and range-based
for-loops are now usable for UHD development.
2017-02-10 16:44:33 -08:00
Andrej Rode
797249bf72 utils: tests: cast RAND_MAX to double before division 2017-01-12 15:15:37 -08:00
Andrej Rode
94a043ab5b tests: fix coverity reports 2017-01-12 15:15:37 -08:00
Martin Braun
99c2730bc9 Remove all boost:: namespace prefix for uint32_t, int32_t etc. (fixed-width types)
- Also removes all references to boost/cstdint.hpp and replaces it with
  stdint.h (The 'correct' replacement would be <cstdint>, but not all of our
  compilers support that).
2016-11-08 08:02:22 -08:00
Derek Kozel
9af57b2e2c Fixed floating point rounding error in converter tests
Integer rounding was producing out of range values and causing tests to
fail
2016-09-26 17:07:21 -07:00
Martin Braun
71f6902d33 convert: Added s8, s16 types and did some refactoring 2015-09-01 16:00:31 -07:00
Martin Braun
bd293b70f4 convert: Added converters for raw strings
- u8: Converts arbitrary-length strings from and to item32
- item32->item32 memcpy non-conversion
2015-07-31 12:26:44 -07:00
Ben Hilburn
178ac3f1c9 Merging USRP X300 and X310 support!! 2014-02-04 11:04:07 -08:00
Josh Blum
6b2e4ef52d convert: added prio param to get converter
We can now test generic conversion implementations against SIMD (for example)
2012-04-27 16:19:49 -07:00
Josh Blum
1151000340 uhd: various tweaks for compiler warns and valgrind 2012-02-09 17:59:48 -08:00
Josh Blum
d466847109 uhd: added sse2 conversions for fc64 to sc8 2012-02-08 19:22:38 -08:00
Josh Blum
2a79f19280 uhd: better quantization check for convert test 2012-02-08 12:37:58 -08:00
Josh Blum
893af3dc28 uhd: added sc8 conversion tests 2012-02-07 11:59:42 -08:00
Josh Blum
dd78230894 convert: made conversion functions into classes so they can keep state 2011-11-12 15:45:52 -08:00
Josh Blum
c885da1138 uhd: renamed convert markup to format
removed convert args

added simd level

got orc and neon updated
2011-11-03 20:37:12 -07:00
Josh Blum
839b9379d4 convert: restored unit test functionality 2011-11-03 20:37:10 -07:00
Nick Foster
3dca19a3e7 UHD: Fixed convert_test (scalars backwards), fixed Orc conversions (endianness backwards). 2011-06-14 17:27:46 -07:00
Josh Blum
86f12cd1c1 uhd: added scaling factor to conversion routines 2011-06-14 17:27:46 -07:00
Josh Blum
08bad571b7 uhd: use ref vector class for the conversion routines I/O 2011-02-10 14:24:51 -08:00
Josh Blum
43b19815fe uhd: added io type and conversion for complex64 (its not really useful) 2011-02-03 16:45:34 -08:00
Josh Blum
132e622379 uhd: renamed test directory to tests to be consitent 2011-01-14 10:50:07 -08:00
Renamed from host/test/convert_test.cpp (Browse further)