aboutsummaryrefslogtreecommitdiffstats
path: root/host/tests/nocscript_parser_test.cpp
diff options
context:
space:
mode:
authorBrent Stapleton <brent.stapleton@ettus.com>2019-01-14 10:35:25 -0800
committerBrent Stapleton <brent.stapleton@ettus.com>2019-01-16 11:40:23 -0800
commit967be2a4e82b1a125b26bb72a60318a4fb2b50c4 (patch)
tree8a24954b54d1546dc8049a17e485adb0a605f74f /host/tests/nocscript_parser_test.cpp
parentaafe4e8b742a0e21d3818f21f34e3c8613132530 (diff)
downloaduhd-967be2a4e82b1a125b26bb72a60318a4fb2b50c4.tar.gz
uhd-967be2a4e82b1a125b26bb72a60318a4fb2b50c4.tar.bz2
uhd-967be2a4e82b1a125b26bb72a60318a4fb2b50c4.zip
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.
Diffstat (limited to 'host/tests/nocscript_parser_test.cpp')
-rw-r--r--host/tests/nocscript_parser_test.cpp37
1 files changed, 14 insertions, 23 deletions
diff --git a/host/tests/nocscript_parser_test.cpp b/host/tests/nocscript_parser_test.cpp
index caa2ae6e0..eb9352995 100644
--- a/host/tests/nocscript_parser_test.cpp
+++ b/host/tests/nocscript_parser_test.cpp
@@ -7,21 +7,20 @@
#include "../lib/rfnoc/nocscript/function_table.hpp"
#include "../lib/rfnoc/nocscript/parser.hpp"
+#include "nocscript_common.hpp"
#include <uhd/exception.hpp>
-#include <boost/test/unit_test.hpp>
-#include <boost/test/floating_point_comparison.hpp>
#include <boost/assign/list_of.hpp>
#include <boost/bind.hpp>
#include <boost/make_shared.hpp>
+#include <boost/test/floating_point_comparison.hpp>
+#include <boost/test/unit_test.hpp>
#include <algorithm>
#include <iostream>
-#include "nocscript_common.hpp"
-
const int SPP_VALUE = 64;
// Need those for the variable testing:
-expression::type_t variable_get_type(const std::string &var_name)
+expression::type_t variable_get_type(const std::string& var_name)
{
if (var_name == "spp") {
std::cout << "Returning type for $spp..." << std::endl;
@@ -35,7 +34,7 @@ expression::type_t variable_get_type(const std::string &var_name)
throw uhd::syntax_error("Cannot infer type (unknown variable)");
}
-expression_literal variable_get_value(const std::string &var_name)
+expression_literal variable_get_value(const std::string& var_name)
{
if (var_name == "spp") {
std::cout << "Returning value for $spp..." << std::endl;
@@ -49,13 +48,10 @@ expression_literal variable_get_value(const std::string &var_name)
throw uhd::syntax_error("Cannot read value (unknown variable)");
}
-#define SETUP_FT_AND_PARSER() \
+#define SETUP_FT_AND_PARSER() \
function_table::sptr ft = function_table::make(); \
- parser::sptr p = parser::make( \
- ft, \
- boost::bind(&variable_get_type, _1), \
- boost::bind(&variable_get_value, _1) \
- );
+ parser::sptr p = parser::make( \
+ ft, boost::bind(&variable_get_type, _1), boost::bind(&variable_get_value, _1));
BOOST_AUTO_TEST_CASE(test_fail)
{
@@ -79,11 +75,11 @@ BOOST_AUTO_TEST_CASE(test_adds_no_vars)
BOOST_REQUIRE(ft->function_exists("ADD"));
const std::string line("ADD(1, ADD(2, ADD(3, 4)))");
- expression::sptr e = p->create_expr_tree(line);
+ expression::sptr e = p->create_expr_tree(line);
expression_literal result = e->eval();
BOOST_REQUIRE_EQUAL(result.infer_type(), expression::TYPE_INT);
- BOOST_CHECK_EQUAL(result.get_int(), 1+2+3+4);
+ BOOST_CHECK_EQUAL(result.get_int(), 1 + 2 + 3 + 4);
}
BOOST_AUTO_TEST_CASE(test_adds_with_vars)
@@ -91,11 +87,11 @@ BOOST_AUTO_TEST_CASE(test_adds_with_vars)
SETUP_FT_AND_PARSER();
const std::string line("ADD(1, ADD(2, $spp))");
- expression::sptr e = p->create_expr_tree(line);
+ expression::sptr e = p->create_expr_tree(line);
expression_literal result = e->eval();
BOOST_REQUIRE_EQUAL(result.infer_type(), expression::TYPE_INT);
- BOOST_CHECK_EQUAL(result.get_int(), 1+2+SPP_VALUE);
+ BOOST_CHECK_EQUAL(result.get_int(), 1 + 2 + SPP_VALUE);
}
BOOST_AUTO_TEST_CASE(test_fft_check)
@@ -103,7 +99,7 @@ BOOST_AUTO_TEST_CASE(test_fft_check)
SETUP_FT_AND_PARSER();
const std::string line("GE($spp, 16) AND LE($spp, 4096) AND IS_PWR_OF_2($spp)");
- expression::sptr e = p->create_expr_tree(line);
+ expression::sptr e = p->create_expr_tree(line);
expression_literal result = e->eval();
BOOST_REQUIRE_EQUAL(result.infer_type(), expression::TYPE_BOOL);
@@ -135,11 +131,7 @@ BOOST_AUTO_TEST_CASE(test_multi_commmand)
SETUP_FT_AND_PARSER();
ft->register_function(
- "DUMMY",
- boost::bind(&dummy_false, _1),
- expression::TYPE_BOOL,
- no_args
- );
+ "DUMMY", boost::bind(&dummy_false, _1), expression::TYPE_BOOL, no_args);
dummy_false_counter = 0;
p->create_expr_tree("DUMMY(), DUMMY(), DUMMY()")->eval();
@@ -153,4 +145,3 @@ BOOST_AUTO_TEST_CASE(test_multi_commmand)
p->create_expr_tree("DUMMY() OR DUMMY() OR DUMMY()")->eval();
BOOST_CHECK_EQUAL(dummy_false_counter, 3);
}
-