mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-19 15:52:53 +00:00
Fix example line formatting in DefinesStreamProxy Test
This commit is contained in:
parent
12bb974324
commit
c1c5378b08
@ -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);
|
||||
@ -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);
|
||||
@ -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);
|
||||
@ -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);
|
||||
@ -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);
|
||||
@ -97,7 +129,8 @@ 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",
|
||||
const std::vector<std::string> lines{
|
||||
"#define ASDF",
|
||||
"#ifdef ASDF",
|
||||
"#ifdef NONO",
|
||||
"Hello World1",
|
||||
@ -111,7 +144,8 @@ namespace test::parsing::impl::defines_stream_proxy
|
||||
"Hello World4",
|
||||
"#endif",
|
||||
"#endif",
|
||||
"Hello Galaxy"};
|
||||
"Hello Galaxy",
|
||||
};
|
||||
|
||||
MockParserLineStream mockStream(lines);
|
||||
DefinesStreamProxy proxy(&mockStream);
|
||||
@ -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);
|
||||
@ -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);
|
||||
@ -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);
|
||||
@ -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);
|
||||
@ -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);
|
||||
@ -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);
|
||||
@ -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);
|
||||
@ -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);
|
||||
@ -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);
|
||||
@ -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);
|
||||
@ -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);
|
||||
@ -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);
|
||||
@ -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);
|
||||
@ -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);
|
||||
@ -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);
|
||||
@ -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);
|
||||
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user