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,13 +1,10 @@
#include <catch2/catch_test_macros.hpp>
#include <catch2/generators/catch_generators.hpp>
#include "Parsing/Commands/Impl/CommandsLexer.h"
#include "Parsing/Mock/MockParserLineStream.h"
#include <catch2/catch_test_macros.hpp>
#include <catch2/generators/catch_generators.hpp>
namespace test::parsing::commands::impl::commands_lexer
{
TEST_CASE("CommandsLexer: ", "[parsing][commands]")
{
}
}
TEST_CASE("CommandsLexer: ", "[parsing][commands]") {}
} // namespace test::parsing::commands::impl::commands_lexer

View File

@ -1,12 +1,12 @@
#include <catch2/catch_test_macros.hpp>
#include <catch2/generators/catch_generators.hpp>
#include "Utils/ClassUtils.h"
#include "Parsing/Commands/Sequence/SequenceAction.h"
#include "Parsing/Mock/MockLexer.h"
#include "Parsing/PostProcessing/CreateMemberInformationPostProcessor.h"
#include "Parsing/PostProcessing/CreateStructureInformationPostProcessor.h"
#include "Persistence/InMemory/InMemoryRepository.h"
#include "Utils/ClassUtils.h"
#include <catch2/catch_test_macros.hpp>
#include <catch2/generators/catch_generators.hpp>
namespace test::parsing::commands::sequence::sequence_action
{
@ -54,8 +54,7 @@ namespace test::parsing::commands::sequence::sequence_action
auto createStructureInformation = std::make_unique<CreateStructureInformationPostProcessor>();
auto createMemberInformation = std::make_unique<CreateMemberInformationPostProcessor>();
return createStructureInformation->PostProcess(m_repository.get())
&& createMemberInformation->PostProcess(m_repository.get());
return createStructureInformation->PostProcess(m_repository.get()) && createMemberInformation->PostProcess(m_repository.get());
}
void AddSampleData()
@ -89,7 +88,6 @@ namespace test::parsing::commands::sequence::sequence_action
}
public:
CommandsSequenceTestsHelper()
: m_repository(std::make_unique<InMemoryRepository>()),
m_state(std::make_unique<CommandsParserState>(m_repository.get())),
@ -127,16 +125,14 @@ namespace test::parsing::commands::sequence::sequence_action
{
CommandsSequenceTestsHelper helper;
const TokenPos pos;
helper.Tokens({
CommandsParserValue::Identifier(pos, new std::string("set")),
CommandsParserValue::Identifier(pos, new std::string("action")),
CommandsParserValue::Identifier(pos, new std::string("test_struct_t")),
CommandsParserValue::Identifier(pos, new std::string("TestMethod")),
CommandsParserValue::Character(pos, '('),
CommandsParserValue::Character(pos, ')'),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)
});
helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")),
CommandsParserValue::Identifier(pos, new std::string("action")),
CommandsParserValue::Identifier(pos, new std::string("test_struct_t")),
CommandsParserValue::Identifier(pos, new std::string("TestMethod")),
CommandsParserValue::Character(pos, '('),
CommandsParserValue::Character(pos, ')'),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)});
auto result = helper.PerformTest();
@ -151,17 +147,15 @@ namespace test::parsing::commands::sequence::sequence_action
{
CommandsSequenceTestsHelper helper;
const TokenPos pos;
helper.Tokens({
CommandsParserValue::Identifier(pos, new std::string("set")),
CommandsParserValue::Identifier(pos, new std::string("action")),
CommandsParserValue::Identifier(pos, new std::string("test_struct_t")),
CommandsParserValue::Identifier(pos, new std::string("TestMethod")),
CommandsParserValue::Character(pos, '('),
CommandsParserValue::Identifier(pos, new std::string("arg_t")),
CommandsParserValue::Character(pos, ')'),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)
});
helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")),
CommandsParserValue::Identifier(pos, new std::string("action")),
CommandsParserValue::Identifier(pos, new std::string("test_struct_t")),
CommandsParserValue::Identifier(pos, new std::string("TestMethod")),
CommandsParserValue::Character(pos, '('),
CommandsParserValue::Identifier(pos, new std::string("arg_t")),
CommandsParserValue::Character(pos, ')'),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)});
auto result = helper.PerformTest();
@ -177,19 +171,17 @@ namespace test::parsing::commands::sequence::sequence_action
{
CommandsSequenceTestsHelper helper;
const TokenPos pos;
helper.Tokens({
CommandsParserValue::Identifier(pos, new std::string("set")),
CommandsParserValue::Identifier(pos, new std::string("action")),
CommandsParserValue::Identifier(pos, new std::string("test_struct_t")),
CommandsParserValue::Identifier(pos, new std::string("TestMethod")),
CommandsParserValue::Character(pos, '('),
CommandsParserValue::Identifier(pos, new std::string("arg_t")),
CommandsParserValue::Character(pos, ','),
CommandsParserValue::Identifier(pos, new std::string("another_arg_t")),
CommandsParserValue::Character(pos, ')'),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)
});
helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")),
CommandsParserValue::Identifier(pos, new std::string("action")),
CommandsParserValue::Identifier(pos, new std::string("test_struct_t")),
CommandsParserValue::Identifier(pos, new std::string("TestMethod")),
CommandsParserValue::Character(pos, '('),
CommandsParserValue::Identifier(pos, new std::string("arg_t")),
CommandsParserValue::Character(pos, ','),
CommandsParserValue::Identifier(pos, new std::string("another_arg_t")),
CommandsParserValue::Character(pos, ')'),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)});
auto result = helper.PerformTest();
@ -206,21 +198,19 @@ namespace test::parsing::commands::sequence::sequence_action
{
CommandsSequenceTestsHelper helper;
const TokenPos pos;
helper.Tokens({
CommandsParserValue::Identifier(pos, new std::string("set")),
CommandsParserValue::Identifier(pos, new std::string("action")),
CommandsParserValue::Identifier(pos, new std::string("test_struct_t")),
CommandsParserValue::Identifier(pos, new std::string("TestMethod")),
CommandsParserValue::Character(pos, '('),
CommandsParserValue::Identifier(pos, new std::string("arg_t")),
CommandsParserValue::Character(pos, ','),
CommandsParserValue::Identifier(pos, new std::string("another_arg_t")),
CommandsParserValue::Character(pos, ','),
CommandsParserValue::Identifier(pos, new std::string("yeet_t")),
CommandsParserValue::Character(pos, ')'),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)
});
helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")),
CommandsParserValue::Identifier(pos, new std::string("action")),
CommandsParserValue::Identifier(pos, new std::string("test_struct_t")),
CommandsParserValue::Identifier(pos, new std::string("TestMethod")),
CommandsParserValue::Character(pos, '('),
CommandsParserValue::Identifier(pos, new std::string("arg_t")),
CommandsParserValue::Character(pos, ','),
CommandsParserValue::Identifier(pos, new std::string("another_arg_t")),
CommandsParserValue::Character(pos, ','),
CommandsParserValue::Identifier(pos, new std::string("yeet_t")),
CommandsParserValue::Character(pos, ')'),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)});
auto result = helper.PerformTest();
@ -238,16 +228,14 @@ namespace test::parsing::commands::sequence::sequence_action
{
CommandsSequenceTestsHelper helper;
const TokenPos pos;
helper.Tokens({
CommandsParserValue::Identifier(pos, new std::string("set")),
CommandsParserValue::Identifier(pos, new std::string("action")),
CommandsParserValue::Identifier(pos, new std::string("unknown_struct_t")),
CommandsParserValue::Identifier(pos, new std::string("TestMethod")),
CommandsParserValue::Character(pos, '('),
CommandsParserValue::Character(pos, ')'),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)
});
helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")),
CommandsParserValue::Identifier(pos, new std::string("action")),
CommandsParserValue::Identifier(pos, new std::string("unknown_struct_t")),
CommandsParserValue::Identifier(pos, new std::string("TestMethod")),
CommandsParserValue::Character(pos, '('),
CommandsParserValue::Character(pos, ')'),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)});
REQUIRE_THROWS_AS(helper.PerformTest(), ParsingException);
REQUIRE(helper.m_test_struct->m_post_load_action == nullptr);
@ -257,21 +245,19 @@ namespace test::parsing::commands::sequence::sequence_action
{
CommandsSequenceTestsHelper helper;
const TokenPos pos;
helper.Tokens({
CommandsParserValue::Identifier(pos, new std::string("set")),
CommandsParserValue::Identifier(pos, new std::string("action")),
CommandsParserValue::Identifier(pos, new std::string("test_struct_t")),
CommandsParserValue::Identifier(pos, new std::string("TestMethod")),
CommandsParserValue::Character(pos, '('),
CommandsParserValue::Identifier(pos, new std::string("arg_t")),
CommandsParserValue::Character(pos, ','),
CommandsParserValue::Identifier(pos, new std::string("another_arg_t")),
CommandsParserValue::Character(pos, ','),
CommandsParserValue::Identifier(pos, new std::string("unknown_type_t")),
CommandsParserValue::Character(pos, ')'),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)
});
helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")),
CommandsParserValue::Identifier(pos, new std::string("action")),
CommandsParserValue::Identifier(pos, new std::string("test_struct_t")),
CommandsParserValue::Identifier(pos, new std::string("TestMethod")),
CommandsParserValue::Character(pos, '('),
CommandsParserValue::Identifier(pos, new std::string("arg_t")),
CommandsParserValue::Character(pos, ','),
CommandsParserValue::Identifier(pos, new std::string("another_arg_t")),
CommandsParserValue::Character(pos, ','),
CommandsParserValue::Identifier(pos, new std::string("unknown_type_t")),
CommandsParserValue::Character(pos, ')'),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)});
REQUIRE_THROWS_AS(helper.PerformTest(), ParsingException);
REQUIRE(helper.m_test_struct->m_post_load_action == nullptr);
@ -281,15 +267,13 @@ namespace test::parsing::commands::sequence::sequence_action
{
CommandsSequenceTestsHelper helper;
const TokenPos pos;
helper.Tokens({
CommandsParserValue::Identifier(pos, new std::string("set")),
CommandsParserValue::Identifier(pos, new std::string("action")),
CommandsParserValue::Identifier(pos, new std::string("TestMethod")),
CommandsParserValue::Character(pos, '('),
CommandsParserValue::Character(pos, ')'),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)
});
helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")),
CommandsParserValue::Identifier(pos, new std::string("action")),
CommandsParserValue::Identifier(pos, new std::string("TestMethod")),
CommandsParserValue::Character(pos, '('),
CommandsParserValue::Character(pos, ')'),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)});
REQUIRE_THROWS_AS(helper.PerformTest(), ParsingException);
REQUIRE(helper.m_test_struct->m_post_load_action == nullptr);
@ -299,15 +283,13 @@ namespace test::parsing::commands::sequence::sequence_action
{
CommandsSequenceTestsHelper helper;
const TokenPos pos;
helper.Tokens({
CommandsParserValue::Identifier(pos, new std::string("set")),
CommandsParserValue::Identifier(pos, new std::string("action")),
CommandsParserValue::Identifier(pos, new std::string("TestMethod")),
CommandsParserValue::Character(pos, '('),
CommandsParserValue::Character(pos, ')'),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)
});
helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")),
CommandsParserValue::Identifier(pos, new std::string("action")),
CommandsParserValue::Identifier(pos, new std::string("TestMethod")),
CommandsParserValue::Character(pos, '('),
CommandsParserValue::Character(pos, ')'),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)});
helper.m_state->SetInUse(helper.m_test_struct);
auto result = helper.PerformTest();
@ -323,19 +305,17 @@ namespace test::parsing::commands::sequence::sequence_action
{
CommandsSequenceTestsHelper helper;
const TokenPos pos;
helper.Tokens({
CommandsParserValue::Identifier(pos, new std::string("set")),
CommandsParserValue::Identifier(pos, new std::string("action")),
CommandsParserValue::Identifier(pos, new std::string("container_struct_t")),
CommandsParserValue::Character(pos, ':'),
CommandsParserValue::Character(pos, ':'),
CommandsParserValue::Identifier(pos, new std::string("m_child")),
CommandsParserValue::Identifier(pos, new std::string("TestMethod")),
CommandsParserValue::Character(pos, '('),
CommandsParserValue::Character(pos, ')'),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)
});
helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")),
CommandsParserValue::Identifier(pos, new std::string("action")),
CommandsParserValue::Identifier(pos, new std::string("container_struct_t")),
CommandsParserValue::Character(pos, ':'),
CommandsParserValue::Character(pos, ':'),
CommandsParserValue::Identifier(pos, new std::string("m_child")),
CommandsParserValue::Identifier(pos, new std::string("TestMethod")),
CommandsParserValue::Character(pos, '('),
CommandsParserValue::Character(pos, ')'),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)});
auto result = helper.PerformTest();
@ -350,16 +330,14 @@ namespace test::parsing::commands::sequence::sequence_action
{
CommandsSequenceTestsHelper helper;
const TokenPos pos;
helper.Tokens({
CommandsParserValue::Identifier(pos, new std::string("set")),
CommandsParserValue::Identifier(pos, new std::string("action")),
CommandsParserValue::Identifier(pos, new std::string("m_child")),
CommandsParserValue::Identifier(pos, new std::string("TestMethod")),
CommandsParserValue::Character(pos, '('),
CommandsParserValue::Character(pos, ')'),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)
});
helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")),
CommandsParserValue::Identifier(pos, new std::string("action")),
CommandsParserValue::Identifier(pos, new std::string("m_child")),
CommandsParserValue::Identifier(pos, new std::string("TestMethod")),
CommandsParserValue::Character(pos, '('),
CommandsParserValue::Character(pos, ')'),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)});
helper.m_state->SetInUse(helper.m_test_struct2);
auto result = helper.PerformTest();
@ -375,19 +353,17 @@ namespace test::parsing::commands::sequence::sequence_action
{
CommandsSequenceTestsHelper helper;
const TokenPos pos;
helper.Tokens({
CommandsParserValue::Identifier(pos, new std::string("set")),
CommandsParserValue::Identifier(pos, new std::string("action")),
CommandsParserValue::Identifier(pos, new std::string("container_struct_t")),
CommandsParserValue::Character(pos, ':'),
CommandsParserValue::Character(pos, ':'),
CommandsParserValue::Identifier(pos, new std::string("m_child")),
CommandsParserValue::Identifier(pos, new std::string("TestMethod")),
CommandsParserValue::Character(pos, '('),
CommandsParserValue::Character(pos, ')'),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)
});
helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")),
CommandsParserValue::Identifier(pos, new std::string("action")),
CommandsParserValue::Identifier(pos, new std::string("container_struct_t")),
CommandsParserValue::Character(pos, ':'),
CommandsParserValue::Character(pos, ':'),
CommandsParserValue::Identifier(pos, new std::string("m_child")),
CommandsParserValue::Identifier(pos, new std::string("TestMethod")),
CommandsParserValue::Character(pos, '('),
CommandsParserValue::Character(pos, ')'),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)});
helper.m_state->SetInUse(helper.m_arg_struct2);
auto result = helper.PerformTest();
@ -403,21 +379,19 @@ namespace test::parsing::commands::sequence::sequence_action
{
CommandsSequenceTestsHelper helper;
const TokenPos pos;
helper.Tokens({
CommandsParserValue::Identifier(pos, new std::string("set")),
CommandsParserValue::Identifier(pos, new std::string("action")),
CommandsParserValue::Identifier(pos, new std::string("test_struct_t")),
CommandsParserValue::Character(pos, ':'),
CommandsParserValue::Character(pos, ':'),
CommandsParserValue::Identifier(pos, new std::string("m_test")),
CommandsParserValue::Identifier(pos, new std::string("TestMethod")),
CommandsParserValue::Character(pos, '('),
CommandsParserValue::Character(pos, ')'),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)
});
helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")),
CommandsParserValue::Identifier(pos, new std::string("action")),
CommandsParserValue::Identifier(pos, new std::string("test_struct_t")),
CommandsParserValue::Character(pos, ':'),
CommandsParserValue::Character(pos, ':'),
CommandsParserValue::Identifier(pos, new std::string("m_test")),
CommandsParserValue::Identifier(pos, new std::string("TestMethod")),
CommandsParserValue::Character(pos, '('),
CommandsParserValue::Character(pos, ')'),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)});
REQUIRE_THROWS_AS(helper.PerformTest(), ParsingException);
REQUIRE(helper.m_test_struct->m_post_load_action == nullptr);
}
}
} // namespace test::parsing::commands::sequence::sequence_action

View File

@ -1,10 +1,10 @@
#include <catch2/catch_test_macros.hpp>
#include <catch2/generators/catch_generators.hpp>
#include "Utils/ClassUtils.h"
#include "Parsing/Commands/Sequence/SequenceArchitecture.h"
#include "Parsing/Mock/MockLexer.h"
#include "Persistence/InMemory/InMemoryRepository.h"
#include "Utils/ClassUtils.h"
#include <catch2/catch_test_macros.hpp>
#include <catch2/generators/catch_generators.hpp>
namespace test::parsing::commands::sequence::sequence_architecture
{
@ -16,7 +16,7 @@ namespace test::parsing::commands::sequence::sequence_architecture
std::unique_ptr<ILexer<CommandsParserValue>> m_lexer;
unsigned m_consumed_token_count;
CommandsSequenceTestsHelper()
: m_repository(std::make_unique<InMemoryRepository>()),
m_state(std::make_unique<CommandsParserState>(m_repository.get())),
@ -41,12 +41,10 @@ namespace test::parsing::commands::sequence::sequence_architecture
{
CommandsSequenceTestsHelper helper;
const TokenPos pos;
helper.Tokens({
CommandsParserValue::Identifier(pos, new std::string("architecture")),
CommandsParserValue::Identifier(pos, new std::string("x86")),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)
});
helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("architecture")),
CommandsParserValue::Identifier(pos, new std::string("x86")),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)});
auto result = helper.PerformTest();
@ -59,12 +57,10 @@ namespace test::parsing::commands::sequence::sequence_architecture
{
CommandsSequenceTestsHelper helper;
const TokenPos pos;
helper.Tokens({
CommandsParserValue::Identifier(pos, new std::string("architecture")),
CommandsParserValue::Identifier(pos, new std::string("x86")),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)
});
helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("architecture")),
CommandsParserValue::Identifier(pos, new std::string("x86")),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)});
auto result = helper.PerformTest();
@ -77,14 +73,12 @@ namespace test::parsing::commands::sequence::sequence_architecture
{
CommandsSequenceTestsHelper helper;
const TokenPos pos;
helper.Tokens({
CommandsParserValue::Identifier(pos, new std::string("architecture")),
CommandsParserValue::Identifier(pos, new std::string("x1337")),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)
});
helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("architecture")),
CommandsParserValue::Identifier(pos, new std::string("x1337")),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)});
REQUIRE_THROWS_AS(helper.PerformTest(), ParsingException);
REQUIRE(helper.m_repository->GetArchitecture() == Architecture::UNKNOWN);
}
}
} // namespace test::parsing::commands::sequence::sequence_architecture

View File

@ -1,10 +1,10 @@
#include <catch2/catch_test_macros.hpp>
#include <catch2/generators/catch_generators.hpp>
#include "Utils/ClassUtils.h"
#include "Parsing/Commands/Sequence/SequenceGame.h"
#include "Parsing/Mock/MockLexer.h"
#include "Persistence/InMemory/InMemoryRepository.h"
#include "Utils/ClassUtils.h"
#include <catch2/catch_test_macros.hpp>
#include <catch2/generators/catch_generators.hpp>
namespace test::parsing::commands::sequence::sequence_game
{
@ -41,12 +41,10 @@ namespace test::parsing::commands::sequence::sequence_game
{
CommandsSequenceTestsHelper helper;
const TokenPos pos;
helper.Tokens({
CommandsParserValue::Identifier(pos, new std::string("game")),
CommandsParserValue::Identifier(pos, new std::string("very_cool_game")),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)
});
helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("game")),
CommandsParserValue::Identifier(pos, new std::string("very_cool_game")),
CommandsParserValue::Character(pos, ';'),
CommandsParserValue::EndOfFile(pos)});
auto result = helper.PerformTest();
@ -54,4 +52,4 @@ namespace test::parsing::commands::sequence::sequence_game
REQUIRE(helper.m_consumed_token_count == 3);
REQUIRE(helper.m_repository->GetGameName() == "very_cool_game");
}
}
} // namespace test::parsing::commands::sequence::sequence_game

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

File diff suppressed because it is too large Load Diff