Skip to content

Commit

Permalink
Fix example line formatting in DefinesStreamProxy Test
Browse files Browse the repository at this point in the history
  • Loading branch information
Clang Format committed Dec 23, 2023
1 parent 2a8cc56 commit 270ede6
Showing 1 changed file with 144 additions and 38 deletions.
182 changes: 144 additions & 38 deletions test/ParserTests/Parsing/Impl/DefinesStreamProxyTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ namespace test::parsing::impl::defines_stream_proxy

TEST_CASE("DefinesStreamProxy: Ensure simple define and positive ifdef is working", "[parsing][parsingstream]")
{
const std::vector<std::string> lines{"#define ASDF", "#ifdef ASDF", "Hello World", "#endif", "Hello Galaxy"};
const std::vector<std::string> lines{
"#define ASDF",
"#ifdef ASDF",
"Hello World",
"#endif",
"Hello Galaxy",
};

MockParserLineStream mockStream(lines);
DefinesStreamProxy proxy(&mockStream);
Expand All @@ -31,7 +37,13 @@ namespace test::parsing::impl::defines_stream_proxy

TEST_CASE("DefinesStreamProxy: Ensure simple define and negative ifdef is working", "[parsing][parsingstream]")
{
const std::vector<std::string> lines{"#define ASDF", "#ifdef NONO", "Hello World", "#endif", "Hello Galaxy"};
const std::vector<std::string> lines{
"#define ASDF",
"#ifdef NONO",
"Hello World",
"#endif",
"Hello Galaxy",
};

MockParserLineStream mockStream(lines);
DefinesStreamProxy proxy(&mockStream);
Expand All @@ -47,7 +59,13 @@ namespace test::parsing::impl::defines_stream_proxy

TEST_CASE("DefinesStreamProxy: Ensure simple define and positive ifndef is working", "[parsing][parsingstream]")
{
const std::vector<std::string> lines{"#define ASDF", "#ifndef NONO", "Hello World", "#endif", "Hello Galaxy"};
const std::vector<std::string> lines{
"#define ASDF",
"#ifndef NONO",
"Hello World",
"#endif",
"Hello Galaxy",
};

MockParserLineStream mockStream(lines);
DefinesStreamProxy proxy(&mockStream);
Expand All @@ -63,7 +81,13 @@ namespace test::parsing::impl::defines_stream_proxy

TEST_CASE("DefinesStreamProxy: Ensure simple define and negative ifndef is working", "[parsing][parsingstream]")
{
const std::vector<std::string> lines{"#define ASDF", "#ifndef ASDF", "Hello World", "#endif", "Hello Galaxy"};
const std::vector<std::string> lines{
"#define ASDF",
"#ifndef ASDF",
"Hello World",
"#endif",
"Hello Galaxy",
};

MockParserLineStream mockStream(lines);
DefinesStreamProxy proxy(&mockStream);
Expand All @@ -79,7 +103,15 @@ namespace test::parsing::impl::defines_stream_proxy

TEST_CASE("DefinesStreamProxy: Ensure else is working", "[parsing][parsingstream]")
{
const std::vector<std::string> lines{"#define ASDF", "#ifdef NONO", "Hello World1", "#else", "Hello World2", "#endif", "Hello Galaxy"};
const std::vector<std::string> lines{
"#define ASDF",
"#ifdef NONO",
"Hello World1",
"#else",
"Hello World2",
"#endif",
"Hello Galaxy",
};

MockParserLineStream mockStream(lines);
DefinesStreamProxy proxy(&mockStream);
Expand All @@ -97,21 +129,23 @@ namespace test::parsing::impl::defines_stream_proxy

TEST_CASE("DefinesStreamProxy: Ensure nested ifdef is working", "[parsing][parsingstream]")
{
const std::vector<std::string> lines{"#define ASDF",
"#ifdef ASDF",
"#ifdef NONO",
"Hello World1",
"#else",
"Hello World2",
"#endif",
"#else",
"#ifdef ASDF",
"Hello World3",
"#else",
"Hello World4",
"#endif",
"#endif",
"Hello Galaxy"};
const std::vector<std::string> lines{
"#define ASDF",
"#ifdef ASDF",
"#ifdef NONO",
"Hello World1",
"#else",
"Hello World2",
"#endif",
"#else",
"#ifdef ASDF",
"Hello World3",
"#else",
"Hello World4",
"#endif",
"#endif",
"Hello Galaxy",
};

MockParserLineStream mockStream(lines);
DefinesStreamProxy proxy(&mockStream);
Expand All @@ -138,7 +172,16 @@ namespace test::parsing::impl::defines_stream_proxy
TEST_CASE("DefinesStreamProxy: Ensure undef is working", "[parsing][parsingstream]")
{
const std::vector<std::string> lines{
"#define ASDF", "#ifdef ASDF", "Hello World", "#endif", "#undef ASDF", "#ifdef ASDF", "Hello World", "#endif", "Hello Galaxy"};
"#define ASDF",
"#ifdef ASDF",
"Hello World",
"#endif",
"#undef ASDF",
"#ifdef ASDF",
"Hello World",
"#endif",
"Hello Galaxy",
};

MockParserLineStream mockStream(lines);
DefinesStreamProxy proxy(&mockStream);
Expand All @@ -159,7 +202,16 @@ namespace test::parsing::impl::defines_stream_proxy
TEST_CASE("DefinesStreamProxy: Ensure undef does not undefine everything", "[parsing][parsingstream]")
{
const std::vector<std::string> lines{
"#define ASDF", "#ifdef ASDF", "Hello World", "#endif", "#undef NONO", "#ifdef ASDF", "Hello World", "#endif", "Hello Galaxy"};
"#define ASDF",
"#ifdef ASDF",
"Hello World",
"#endif",
"#undef NONO",
"#ifdef ASDF",
"Hello World",
"#endif",
"Hello Galaxy",
};

MockParserLineStream mockStream(lines);
DefinesStreamProxy proxy(&mockStream);
Expand All @@ -179,7 +231,13 @@ namespace test::parsing::impl::defines_stream_proxy

TEST_CASE("DefinesStreamProxy: Ensure simple defines are working", "[parsing][parsingstream]")
{
const std::vector<std::string> lines{"#define ASDF LOL", "ASDF", "A ASDF B", "ASDF B", "A ASDF"};
const std::vector<std::string> lines{
"#define ASDF LOL",
"ASDF",
"A ASDF B",
"ASDF B",
"A ASDF",
};

MockParserLineStream mockStream(lines);
DefinesStreamProxy proxy(&mockStream);
Expand All @@ -195,7 +253,10 @@ namespace test::parsing::impl::defines_stream_proxy

TEST_CASE("DefinesStreamProxy: Ensure defines can be surrounded by symbols", "[parsing][parsingstream]")
{
const std::vector<std::string> lines{"#define ASDF LOL", "!ASDF%"};
const std::vector<std::string> lines{
"#define ASDF LOL",
"!ASDF%",
};

MockParserLineStream mockStream(lines);
DefinesStreamProxy proxy(&mockStream);
Expand All @@ -208,7 +269,11 @@ namespace test::parsing::impl::defines_stream_proxy

TEST_CASE("DefinesStreamProxy: Ensure can use multiple defines in one line", "[parsing][parsingstream]")
{
const std::vector<std::string> lines{"#define A Hello", "#define B world", "A my dear B!"};
const std::vector<std::string> lines{
"#define A Hello",
"#define B world",
"A my dear B!",
};

MockParserLineStream mockStream(lines);
DefinesStreamProxy proxy(&mockStream);
Expand All @@ -222,7 +287,12 @@ namespace test::parsing::impl::defines_stream_proxy

TEST_CASE("DefinesStreamProxy: Ensure defines in disabled block are ignored", "[parsing][parsingstream]")
{
const std::vector<std::string> lines{"#ifdef LOLO", "#define hello world", "#endif", "hello"};
const std::vector<std::string> lines{
"#ifdef LOLO",
"#define hello world",
"#endif",
"hello",
};

MockParserLineStream mockStream(lines);
DefinesStreamProxy proxy(&mockStream);
Expand All @@ -237,7 +307,13 @@ namespace test::parsing::impl::defines_stream_proxy

TEST_CASE("DefinesStreamProxy: Ensure undefs in disabled block are ignored", "[parsing][parsingstream]")
{
const std::vector<std::string> lines{"#define hello world", "#ifdef LOLO", "#undef hello", "#endif", "hello"};
const std::vector<std::string> lines{
"#define hello world",
"#ifdef LOLO",
"#undef hello",
"#endif",
"hello",
};

MockParserLineStream mockStream(lines);
DefinesStreamProxy proxy(&mockStream);
Expand All @@ -253,7 +329,10 @@ namespace test::parsing::impl::defines_stream_proxy

TEST_CASE("DefinesStreamProxy: Ensure can define name with underscores and digits", "[parsing][parsingstream]")
{
const std::vector<std::string> lines{"#define __int16 short", "unsigned __int16 value;"};
const std::vector<std::string> lines{
"#define __int16 short",
"unsigned __int16 value;",
};

MockParserLineStream mockStream(lines);
DefinesStreamProxy proxy(&mockStream);
Expand Down Expand Up @@ -288,7 +367,10 @@ namespace test::parsing::impl::defines_stream_proxy

TEST_CASE("DefinesStreamProxy: Ensure can add define with parameters", "[parsing][parsingstream]")
{
const std::vector<std::string> lines{"#define test(x) alignas(x)", "struct test(1337) test_struct"};
const std::vector<std::string> lines{
"#define test(x) alignas(x)",
"struct test(1337) test_struct",
};

MockParserLineStream mockStream(lines);
DefinesStreamProxy proxy(&mockStream);
Expand All @@ -301,7 +383,10 @@ namespace test::parsing::impl::defines_stream_proxy

TEST_CASE("DefinesStreamProxy: Ensure can use parameter multiple times", "[parsing][parsingstream]")
{
const std::vector<std::string> lines{"#define test(x) x|x|x|x", "struct test(1337) test_struct"};
const std::vector<std::string> lines{
"#define test(x) x|x|x|x",
"struct test(1337) test_struct",
};

MockParserLineStream mockStream(lines);
DefinesStreamProxy proxy(&mockStream);
Expand All @@ -314,7 +399,10 @@ namespace test::parsing::impl::defines_stream_proxy

TEST_CASE("DefinesStreamProxy: Ensure can use parameterized define in between symbols", "[parsing][parsingstream]")
{
const std::vector<std::string> lines{"#define test(x) x|x|x|x", "%test(5)%"};
const std::vector<std::string> lines{
"#define test(x) x|x|x|x",
"%test(5)%",
};

MockParserLineStream mockStream(lines);
DefinesStreamProxy proxy(&mockStream);
Expand All @@ -327,7 +415,10 @@ namespace test::parsing::impl::defines_stream_proxy

TEST_CASE("DefinesStreamProxy: Ensure can define multiple parameters", "[parsing][parsingstream]")
{
const std::vector<std::string> lines{"#define test(a1, a2, a3) a1 + a2 = a3", "make calc test(1, 2, 3);"};
const std::vector<std::string> lines{
"#define test(a1, a2, a3) a1 + a2 = a3",
"make calc test(1, 2, 3);",
};

MockParserLineStream mockStream(lines);
DefinesStreamProxy proxy(&mockStream);
Expand All @@ -340,7 +431,10 @@ namespace test::parsing::impl::defines_stream_proxy

TEST_CASE("DefinesStreamProxy: Ensure can define multiple parameters without spacing", "[parsing][parsingstream]")
{
const std::vector<std::string> lines{"#define test(a1,a2,a3) a1+a2=a3", "make calc test(1,2,3);"};
const std::vector<std::string> lines{
"#define test(a1,a2,a3) a1+a2=a3",
"make calc test(1,2,3);",
};

MockParserLineStream mockStream(lines);
DefinesStreamProxy proxy(&mockStream);
Expand All @@ -353,7 +447,10 @@ namespace test::parsing::impl::defines_stream_proxy

TEST_CASE("DefinesStreamProxy: Ensure can define parameters with underscore", "[parsing][parsingstream]")
{
const std::vector<std::string> lines{"#define test(test_parameter) this is test_parameter", "Apparently test(a very cool text);"};
const std::vector<std::string> lines{
"#define test(test_parameter) this is test_parameter",
"Apparently test(a very cool text);",
};

MockParserLineStream mockStream(lines);
DefinesStreamProxy proxy(&mockStream);
Expand Down Expand Up @@ -558,7 +655,10 @@ namespace test::parsing::impl::defines_stream_proxy

TEST_CASE("DefinesStreamProxy: Ensure can use parenthesis in parameters values", "[parsing][parsingstream]")
{
const std::vector<std::string> lines{"#define someStuff(param1) Hello param1 World", "someStuff(A sentence with (parenthesis) and stuff)"};
const std::vector<std::string> lines{
"#define someStuff(param1) Hello param1 World",
"someStuff(A sentence with (parenthesis) and stuff)",
};

MockParserLineStream mockStream(lines);
DefinesStreamProxy proxy(&mockStream);
Expand All @@ -571,8 +671,10 @@ namespace test::parsing::impl::defines_stream_proxy

TEST_CASE("DefinesStreamProxy: Ensure can use comma in parenthesis in parameters values", "[parsing][parsingstream]")
{
const std::vector<std::string> lines{"#define someStuff(param1) Hello param1 World",
"someStuff(A sentence with (parenthesis and a , character) and stuff)"};
const std::vector<std::string> lines{
"#define someStuff(param1) Hello param1 World",
"someStuff(A sentence with (parenthesis and a , character) and stuff)",
};

MockParserLineStream mockStream(lines);
DefinesStreamProxy proxy(&mockStream);
Expand All @@ -585,7 +687,11 @@ namespace test::parsing::impl::defines_stream_proxy

TEST_CASE("DefinesStreamProxy: Ensure defines can go over multiple lines", "[parsing][parsingstream]")
{
const std::vector<std::string> lines{"#define someStuff(param1) Hello param1 World \\", "and hello universe", "someStuff(lovely)"};
const std::vector<std::string> lines{
"#define someStuff(param1) Hello param1 World \\",
"and hello universe",
"someStuff(lovely)",
};

MockParserLineStream mockStream(lines);
DefinesStreamProxy proxy(&mockStream);
Expand Down

0 comments on commit 270ede6

Please sign in to comment.