Reformat code with clang format

This commit is contained in:
Clang Format
2023-11-19 15:28:38 +01:00
committed by Jan
parent 22e17272fd
commit 6b4f5d94a8
1099 changed files with 16763 additions and 18076 deletions

View File

@ -1,10 +1,10 @@
#include <catch2/catch_test_macros.hpp>
#include <catch2/matchers/catch_matchers_floating_point.hpp>
#include <catch2/generators/catch_generators.hpp>
#include "Parsing/Header/Impl/HeaderLexer.h"
#include "Parsing/Mock/MockParserLineStream.h"
#include <catch2/catch_test_macros.hpp>
#include <catch2/generators/catch_generators.hpp>
#include <catch2/matchers/catch_matchers_floating_point.hpp>
using namespace Catch::Matchers;
namespace test::parsing::header::impl::header_lexer
@ -53,13 +53,7 @@ namespace test::parsing::header::impl::header_lexer
TEST_CASE("HeaderLexer: Ensure can parse simple hex numbers", "[parsing][header]")
{
const std::vector<std::string> lines
{
"0x1A4",
" 0xABC ",
" 0xAAA",
"0xBBB "
};
const std::vector<std::string> lines{"0x1A4", " 0xABC ", " 0xAAA", "0xBBB "};
MockParserLineStream mockStream(lines);
HeaderLexer lexer(&mockStream);
@ -74,12 +68,7 @@ namespace test::parsing::header::impl::header_lexer
TEST_CASE("HeaderLexer: Ensure can parse simple hex numbers surrounded by identifiers", "[parsing][header]")
{
const std::vector<std::string> lines
{
"abc 0xABC cba",
"aaa 0xAAA",
"0xBBB bbb"
};
const std::vector<std::string> lines{"abc 0xABC cba", "aaa 0xAAA", "0xBBB bbb"};
MockParserLineStream mockStream(lines);
HeaderLexer lexer(&mockStream);
@ -99,8 +88,7 @@ namespace test::parsing::header::impl::header_lexer
TEST_CASE("HeaderLexer: Ensure can parse simple hex numbers surrounded by symbols", "[parsing][header]")
{
const std::vector<std::string> lines
{
const std::vector<std::string> lines{
"0x25:0xABC,0x1a4",
};
@ -118,10 +106,7 @@ namespace test::parsing::header::impl::header_lexer
TEST_CASE("HeaderLexer: Ensure throws exception when parsing incomplete hex number", "[parsing][header]")
{
const std::vector<std::string> lines
{
"0x"
};
const std::vector<std::string> lines{"0x"};
MockParserLineStream mockStream(lines);
HeaderLexer lexer(&mockStream);
@ -131,11 +116,8 @@ namespace test::parsing::header::impl::header_lexer
TEST_CASE("HeaderLexer: Ensure throws exception when parsing invalid hex number", "[parsing][header]")
{
const std::vector<std::string> lines
{
"0xGEGE"
};
const std::vector<std::string> lines{"0xGEGE"};
MockParserLineStream mockStream(lines);
HeaderLexer lexer(&mockStream);
@ -144,10 +126,7 @@ namespace test::parsing::header::impl::header_lexer
TEST_CASE("HeaderLexer: Ensure throws exception when parsing invalid hex number that starts with a valid letter", "[parsing][header]")
{
const std::vector<std::string> lines
{
"0xEGEG"
};
const std::vector<std::string> lines{"0xEGEG"};
MockParserLineStream mockStream(lines);
HeaderLexer lexer(&mockStream);
@ -157,12 +136,7 @@ namespace test::parsing::header::impl::header_lexer
TEST_CASE("HeaderLexer: Ensure can parse simple integers", "[parsing][header]")
{
const std::vector<std::string> lines
{
" 524 ",
"4221111 1337 ",
"0 420"
};
const std::vector<std::string> lines{" 524 ", "4221111 1337 ", "0 420"};
MockParserLineStream mockStream(lines);
HeaderLexer lexer(&mockStream);
@ -176,12 +150,7 @@ namespace test::parsing::header::impl::header_lexer
TEST_CASE("HeaderLexer: Ensure can parse integers surrounded by identifiers", "[parsing][header]")
{
const std::vector<std::string> lines
{
"aa 6 bb",
"123456789 ccc",
"0 d 420"
};
const std::vector<std::string> lines{"aa 6 bb", "123456789 ccc", "0 d 420"};
MockParserLineStream mockStream(lines);
HeaderLexer lexer(&mockStream);
@ -198,28 +167,22 @@ namespace test::parsing::header::impl::header_lexer
TEST_CASE("HeaderLexer: Ensure parses negative numbers as character and number", "[parsing][header]")
{
const std::vector<std::string> lines
{
"-1337"
};
const std::vector<std::string> lines{"-1337"};
MockParserLineStream mockStream(lines);
HeaderLexer lexer(&mockStream);
ExpectCharacterToken(lexer, '-');
ExpectIntegerToken(lexer, 1337);
}
TEST_CASE("HeaderLexer: Ensure recognizes numbers surrounded by characters", "[parsing][header]")
{
const std::vector<std::string> lines
{
"(1337)"
};
const std::vector<std::string> lines{"(1337)"};
MockParserLineStream mockStream(lines);
HeaderLexer lexer(&mockStream);
ExpectCharacterToken(lexer, '(');
ExpectIntegerToken(lexer, 1337);
ExpectCharacterToken(lexer, ')');
@ -227,25 +190,17 @@ namespace test::parsing::header::impl::header_lexer
TEST_CASE("HeaderLexer: Ensure parses simple floating point numbers", "[parsing][header]")
{
const std::vector<std::string> lines
{
"420.1337"
};
const std::vector<std::string> lines{"420.1337"};
MockParserLineStream mockStream(lines);
HeaderLexer lexer(&mockStream);
ExpectFloatingPointToken(lexer, 420.1337);
}
TEST_CASE("HeaderLexer: Ensure parses simple floating point numbers surrounded by identifiers", "[parsing][header]")
{
const std::vector<std::string> lines
{
"aa 50.24 a",
"b 36.999",
"59595.2414 c"
};
const std::vector<std::string> lines{"aa 50.24 a", "b 36.999", "59595.2414 c"};
MockParserLineStream mockStream(lines);
HeaderLexer lexer(&mockStream);
@ -261,10 +216,7 @@ namespace test::parsing::header::impl::header_lexer
TEST_CASE("HeaderLexer: Ensure recognizes floating point numbers surrounded by characters", "[parsing][header]")
{
const std::vector<std::string> lines
{
"(1337.420)"
};
const std::vector<std::string> lines{"(1337.420)"};
MockParserLineStream mockStream(lines);
HeaderLexer lexer(&mockStream);
@ -276,10 +228,7 @@ namespace test::parsing::header::impl::header_lexer
TEST_CASE("HeaderLexer: Ensure can separate identifiers with symbols", "[parsing][header]")
{
const std::vector<std::string> lines
{
"hello|world hello_+universe"
};
const std::vector<std::string> lines{"hello|world hello_+universe"};
MockParserLineStream mockStream(lines);
HeaderLexer lexer(&mockStream);
@ -294,10 +243,7 @@ namespace test::parsing::header::impl::header_lexer
TEST_CASE("HeaderLexer: Can recognize shift left", "[parsing][header]")
{
const std::vector<std::string> lines
{
"<<hello<<world<<"
};
const std::vector<std::string> lines{"<<hello<<world<<"};
MockParserLineStream mockStream(lines);
HeaderLexer lexer(&mockStream);
@ -311,10 +257,7 @@ namespace test::parsing::header::impl::header_lexer
TEST_CASE("HeaderLexer: Can recognize less equals", "[parsing][header]")
{
const std::vector<std::string> lines
{
"<=hello<=world<="
};
const std::vector<std::string> lines{"<=hello<=world<="};
MockParserLineStream mockStream(lines);
HeaderLexer lexer(&mockStream);
@ -328,10 +271,7 @@ namespace test::parsing::header::impl::header_lexer
TEST_CASE("HeaderLexer: Can recognize less", "[parsing][header]")
{
const std::vector<std::string> lines
{
"<%hello<world<&"
};
const std::vector<std::string> lines{"<%hello<world<&"};
MockParserLineStream mockStream(lines);
HeaderLexer lexer(&mockStream);
@ -347,10 +287,7 @@ namespace test::parsing::header::impl::header_lexer
TEST_CASE("HeaderLexer: Can recognize shift right", "[parsing][header]")
{
const std::vector<std::string> lines
{
">>hello>>world>>"
};
const std::vector<std::string> lines{">>hello>>world>>"};
MockParserLineStream mockStream(lines);
HeaderLexer lexer(&mockStream);
@ -364,10 +301,7 @@ namespace test::parsing::header::impl::header_lexer
TEST_CASE("HeaderLexer: Can recognize greater equals", "[parsing][header]")
{
const std::vector<std::string> lines
{
">=hello>=world>="
};
const std::vector<std::string> lines{">=hello>=world>="};
MockParserLineStream mockStream(lines);
HeaderLexer lexer(&mockStream);
@ -381,10 +315,7 @@ namespace test::parsing::header::impl::header_lexer
TEST_CASE("HeaderLexer: Can recognize greater", "[parsing][header]")
{
const std::vector<std::string> lines
{
">%hello>world>&"
};
const std::vector<std::string> lines{">%hello>world>&"};
MockParserLineStream mockStream(lines);
HeaderLexer lexer(&mockStream);
@ -400,10 +331,7 @@ namespace test::parsing::header::impl::header_lexer
TEST_CASE("HeaderLexer: Can recognize equals", "[parsing][header]")
{
const std::vector<std::string> lines
{
"==hello==world=="
};
const std::vector<std::string> lines{"==hello==world=="};
MockParserLineStream mockStream(lines);
HeaderLexer lexer(&mockStream);
@ -417,10 +345,7 @@ namespace test::parsing::header::impl::header_lexer
TEST_CASE("HeaderLexer: Can recognize assign", "[parsing][header]")
{
const std::vector<std::string> lines
{
"=%hello=world=&"
};
const std::vector<std::string> lines{"=%hello=world=&"};
MockParserLineStream mockStream(lines);
HeaderLexer lexer(&mockStream);
@ -436,10 +361,7 @@ namespace test::parsing::header::impl::header_lexer
TEST_CASE("HeaderLexer: Can recognize logical and", "[parsing][header]")
{
const std::vector<std::string> lines
{
"&&hello&&world&&"
};
const std::vector<std::string> lines{"&&hello&&world&&"};
MockParserLineStream mockStream(lines);
HeaderLexer lexer(&mockStream);
@ -453,10 +375,7 @@ namespace test::parsing::header::impl::header_lexer
TEST_CASE("HeaderLexer: Can recognize ampersand", "[parsing][header]")
{
const std::vector<std::string> lines
{
"&%hello&world&+"
};
const std::vector<std::string> lines{"&%hello&world&+"};
MockParserLineStream mockStream(lines);
HeaderLexer lexer(&mockStream);
@ -472,10 +391,7 @@ namespace test::parsing::header::impl::header_lexer
TEST_CASE("HeaderLexer: Can recognize logical or", "[parsing][header]")
{
const std::vector<std::string> lines
{
"||hello||world||"
};
const std::vector<std::string> lines{"||hello||world||"};
MockParserLineStream mockStream(lines);
HeaderLexer lexer(&mockStream);
@ -489,10 +405,7 @@ namespace test::parsing::header::impl::header_lexer
TEST_CASE("HeaderLexer: Can recognize pipe", "[parsing][header]")
{
const std::vector<std::string> lines
{
"|%hello|world|&"
};
const std::vector<std::string> lines{"|%hello|world|&"};
MockParserLineStream mockStream(lines);
HeaderLexer lexer(&mockStream);
@ -508,10 +421,7 @@ namespace test::parsing::header::impl::header_lexer
TEST_CASE("HeaderLexer: Can recognize not equals", "[parsing][header]")
{
const std::vector<std::string> lines
{
"!=hello!=world!="
};
const std::vector<std::string> lines{"!=hello!=world!="};
MockParserLineStream mockStream(lines);
HeaderLexer lexer(&mockStream);
@ -525,10 +435,7 @@ namespace test::parsing::header::impl::header_lexer
TEST_CASE("HeaderLexer: Can recognize exclamation mark", "[parsing][header]")
{
const std::vector<std::string> lines
{
"!%hello!world!&"
};
const std::vector<std::string> lines{"!%hello!world!&"};
MockParserLineStream mockStream(lines);
HeaderLexer lexer(&mockStream);
@ -544,13 +451,7 @@ namespace test::parsing::header::impl::header_lexer
TEST_CASE("HeaderLexer: Can recognize strings", "[parsing][header]")
{
const std::vector<std::string> lines
{
"\"hello world\"",
"a\"hi there\"bbb",
" \"nice\"",
"\"meme\" "
};
const std::vector<std::string> lines{"\"hello world\"", "a\"hi there\"bbb", " \"nice\"", "\"meme\" "};
MockParserLineStream mockStream(lines);
HeaderLexer lexer(&mockStream);
@ -562,4 +463,4 @@ namespace test::parsing::header::impl::header_lexer
ExpectStringToken(lexer, "nice");
ExpectStringToken(lexer, "meme");
}
}
} // namespace test::parsing::header::impl::header_lexer

View File

@ -1,21 +1,20 @@
#include <catch2/catch_test_macros.hpp>
#include <catch2/generators/catch_generators.hpp>
#include "Parsing/Header/Sequence/SequenceNamespace.h"
#include "Parsing/Mock/MockLexer.h"
#include "Parsing/Mock/MockPackValueSupplier.h"
#include <catch2/catch_test_macros.hpp>
#include <catch2/generators/catch_generators.hpp>
namespace test::parsing::header::sequence::sequence_namespace
{
TEST_CASE("SequenceNamespace: Ensure can parse simple namespace directive", "[parsing][parsingstream]")
{
const TokenPos pos;
const auto lexer = std::make_unique<MockLexer<HeaderParserValue>>(MockLexer<HeaderParserValue>(
{
HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE),
HeaderParserValue::Identifier(pos, new std::string("test_namespace")),
HeaderParserValue::Character(pos, '{')
}, HeaderParserValue::EndOfFile(pos)));
const auto lexer =
std::make_unique<MockLexer<HeaderParserValue>>(MockLexer<HeaderParserValue>({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE),
HeaderParserValue::Identifier(pos, new std::string("test_namespace")),
HeaderParserValue::Character(pos, '{')},
HeaderParserValue::EndOfFile(pos)));
const auto packValueSupplier = std::make_unique<MockPackValueSupplier>();
const auto sequence = std::make_unique<SequenceNamespace>();
@ -26,4 +25,4 @@ namespace test::parsing::header::sequence::sequence_namespace
REQUIRE(result);
}
}
} // namespace test::parsing::header::sequence::sequence_namespace