aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/benchmarks/lexer.cpp2
-rw-r--r--test/unit_tests/lexer.cpp43
-rw-r--r--test/unit_tests/parser.cpp38
3 files changed, 39 insertions, 44 deletions
diff --git a/test/benchmarks/lexer.cpp b/test/benchmarks/lexer.cpp
index 5475c82..9384ee2 100644
--- a/test/benchmarks/lexer.cpp
+++ b/test/benchmarks/lexer.cpp
@@ -34,7 +34,7 @@ protected:
};
};
-}
+} // namespace
BENCHMARK_F(NumberExamples, StdParseNumber)(benchmark::State& state) {
using namespace math::server::lexer::details;
diff --git a/test/unit_tests/lexer.cpp b/test/unit_tests/lexer.cpp
index c47e9f2..c43b879 100644
--- a/test/unit_tests/lexer.cpp
+++ b/test/unit_tests/lexer.cpp
@@ -9,8 +9,8 @@
#include <server/lexer/token.hpp>
#include <server/lexer/token_type.hpp>
-#include <boost/test/data/test_case.hpp>
#include <boost/test/data/monomorphic.hpp>
+#include <boost/test/data/test_case.hpp>
#include <boost/test/unit_test.hpp>
#include <ostream>
@@ -135,7 +135,7 @@ const std::vector<Expected> expected{
}},
};
-}
+} // namespace get_tokens::valid
namespace get_tokens::invalid {
@@ -149,32 +149,29 @@ const std::vector<std::string> error_msg{
"server error: lexer error: invalid input at: & 456",
};
-}
-}
-
-BOOST_DATA_TEST_CASE(
- test_get_tokens_valid,
- bdata::make(get_tokens::valid::input) ^ get_tokens::valid::expected,
- input,
- expected) {
+} // namespace get_tokens::invalid
+} // namespace
+BOOST_DATA_TEST_CASE(test_get_tokens_valid,
+ bdata::make(get_tokens::valid::input) ^ get_tokens::valid::expected,
+ input,
+ expected) {
Lexer lexer{input};
const auto actual = lexer.get_tokens();
- BOOST_CHECK_EQUAL_COLLECTIONS(actual.cbegin(), actual.cend(),
- expected.m_tokens.cbegin(),
- expected.m_tokens.cend());
+ BOOST_CHECK_EQUAL_COLLECTIONS(actual.cbegin(), actual.cend(), expected.m_tokens.cbegin(),
+ expected.m_tokens.cend());
}
-BOOST_DATA_TEST_CASE(
- test_get_tokens_invalid,
- bdata::make(get_tokens::invalid::input) ^ get_tokens::invalid::error_msg,
- input,
- error_msg) {
-
- BOOST_REQUIRE_THROW(do {
- Lexer lexer{input};
- lexer.get_tokens();
- } while (0), LexerError);
+BOOST_DATA_TEST_CASE(test_get_tokens_invalid,
+ bdata::make(get_tokens::invalid::input) ^ get_tokens::invalid::error_msg,
+ input,
+ error_msg) {
+ BOOST_REQUIRE_THROW(
+ do {
+ Lexer lexer{input};
+ lexer.get_tokens();
+ } while (0),
+ LexerError);
try {
Lexer lexer{input};
diff --git a/test/unit_tests/parser.cpp b/test/unit_tests/parser.cpp
index 231be3d..2e90992 100644
--- a/test/unit_tests/parser.cpp
+++ b/test/unit_tests/parser.cpp
@@ -6,8 +6,8 @@
#include <server/parser/error.hpp>
#include <server/parser/parser.hpp>
-#include <boost/test/data/test_case.hpp>
#include <boost/test/data/monomorphic.hpp>
+#include <boost/test/data/test_case.hpp>
#include <boost/test/unit_test.hpp>
#include <string>
@@ -83,7 +83,7 @@ const std::vector<double> expected{
-3.9375,
};
-}
+} // namespace exec::valid
namespace exec::invalid {
@@ -111,29 +111,27 @@ const std::vector<std::string> error_msg{
"server error: parser error: expected a binary operator",
};
-}
-}
-
-BOOST_DATA_TEST_CASE(
- test_exec_valid,
- bdata::make(exec::valid::input) ^ exec::valid::expected,
- input,
- expected) {
+} // namespace exec::invalid
+} // namespace
+BOOST_DATA_TEST_CASE(test_exec_valid,
+ bdata::make(exec::valid::input) ^ exec::valid::expected,
+ input,
+ expected) {
Parser parser{input};
BOOST_TEST(parser.exec() == expected);
}
-BOOST_DATA_TEST_CASE(
- test_exec_invalid,
- bdata::make(exec::invalid::input) ^ exec::invalid::error_msg,
- input,
- error_msg) {
-
- BOOST_REQUIRE_THROW(do {
- Parser parser{input};
- parser.exec();
- } while (0), ParserError);
+BOOST_DATA_TEST_CASE(test_exec_invalid,
+ bdata::make(exec::invalid::input) ^ exec::invalid::error_msg,
+ input,
+ error_msg) {
+ BOOST_REQUIRE_THROW(
+ do {
+ Parser parser{input};
+ parser.exec();
+ } while (0),
+ ParserError);
try {
Parser parser{input};