diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-01-24 03:08:16 +0100 |
---|---|---|
committer | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-01-24 03:08:16 +0100 |
commit | 67d36e699a2852ce471c4d1b8dab5992d6c01a98 (patch) | |
tree | 0ef23befe3fa5af9c5d83b3b8934e444366a8575 /test/core/common/CharReaderTest.cpp | |
parent | f819b42057b2baea205569dd808c4fcf2bc4d630 (diff) |
Implemented SourceContextReader, added unit tests, implemented SourceContextReader interface in ResourceManager, added LoggerTest
Diffstat (limited to 'test/core/common/CharReaderTest.cpp')
-rw-r--r-- | test/core/common/CharReaderTest.cpp | 167 |
1 files changed, 0 insertions, 167 deletions
diff --git a/test/core/common/CharReaderTest.cpp b/test/core/common/CharReaderTest.cpp index fba60f9..a1ea18f 100644 --- a/test/core/common/CharReaderTest.cpp +++ b/test/core/common/CharReaderTest.cpp @@ -565,172 +565,5 @@ TEST(CharReader, fork) ASSERT_EQ(5, reader.getOffset()); } -/*TEST(CharReader, context) -{ - std::string testStr{"first line\n\n\rsecond line\n\rlast line"}; - // 0123456789 0 123456789012 3456789012 - // 0 1 2 3 - - // Retrieval at beginning of stream - { - CharReader reader{testStr}; - SourceContext ctx = reader.getContext(80); - ASSERT_EQ("first line", ctx.text); - ASSERT_EQ(0, ctx.relPos); - ASSERT_FALSE(ctx.truncatedStart); - ASSERT_FALSE(ctx.truncatedEnd); - } - - // Retrieval in middle of line - { - CharReader reader{testStr}; - SourceContext ctx = reader.getContext(80); - - char c; - for (int i = 0; i < 5; i++) - reader.read(c); - - ASSERT_EQ("first line", ctx.text); - ASSERT_EQ(0, ctx.relPos); - ASSERT_FALSE(ctx.truncatedStart); - ASSERT_FALSE(ctx.truncatedEnd); - } - - // Retrieval in whitespace sequence - { - CharReader reader{testStr}; - - char c; - for (int i = 0; i < 11; i++) - reader.read(c); - - SourceContext ctx = reader.getContext(80); - ASSERT_EQ("first line", ctx.text); - ASSERT_EQ(10, ctx.relPos); - ASSERT_FALSE(ctx.truncatedStart); - ASSERT_FALSE(ctx.truncatedEnd); - } - - // Truncation of text - { - CharReader reader{testStr}; - - char c; - for (int i = 0; i < 5; i++) - reader.read(c); - - SourceContext ctx = reader.getContext(3); - ASSERT_EQ("t l", ctx.text); - ASSERT_EQ(1, ctx.relPos); - ASSERT_TRUE(ctx.truncatedStart); - ASSERT_TRUE(ctx.truncatedEnd); - } - - // Second line - { - CharReader reader{testStr}; - - char c; - for (int i = 0; i < 12; i++) - reader.read(c); - - SourceContext ctx = reader.getContext(80); - ASSERT_EQ("second line", ctx.text); - ASSERT_EQ(0, ctx.relPos); - ASSERT_FALSE(ctx.truncatedStart); - ASSERT_FALSE(ctx.truncatedEnd); - } - - // End of second line - { - CharReader reader{testStr}; - - char c; - for (int i = 0; i < 23; i++) - reader.read(c); - - SourceContext ctx = reader.getContext(80); - ASSERT_EQ("second line", ctx.text); - ASSERT_EQ(11, ctx.relPos); - ASSERT_FALSE(ctx.truncatedStart); - ASSERT_FALSE(ctx.truncatedEnd); - } - - // Last line - { - CharReader reader{testStr}; - - char c; - for (int i = 0; i < 24; i++) - reader.read(c); - - SourceContext ctx = reader.getContext(80); - ASSERT_EQ("last line", ctx.text); - ASSERT_EQ(0, ctx.relPos); - ASSERT_FALSE(ctx.truncatedStart); - ASSERT_FALSE(ctx.truncatedEnd); - } - - // Middle of last line - { - CharReader reader{testStr}; - - char c; - for (int i = 0; i < 28; i++) - reader.read(c); - - SourceContext ctx = reader.getContext(80); - ASSERT_EQ("last line", ctx.text); - ASSERT_EQ(4, ctx.relPos); - ASSERT_FALSE(ctx.truncatedStart); - ASSERT_FALSE(ctx.truncatedEnd); - } - - // Middle of last line truncated - { - CharReader reader{testStr}; - - char c; - for (int i = 0; i < 28; i++) - reader.read(c); - - SourceContext ctx = reader.getContext(3); - ASSERT_EQ("t l", ctx.text); - ASSERT_EQ(1, ctx.relPos); - ASSERT_TRUE(ctx.truncatedStart); - ASSERT_TRUE(ctx.truncatedEnd); - } - - // End of stream - { - CharReader reader{testStr}; - - char c; - for (int i = 0; i < 100; i++) - reader.read(c); - - SourceContext ctx = reader.getContext(80); - ASSERT_EQ("last line", ctx.text); - ASSERT_EQ(9, ctx.relPos); - ASSERT_FALSE(ctx.truncatedStart); - ASSERT_FALSE(ctx.truncatedEnd); - } - - // End of stream truncated - { - CharReader reader{testStr}; - - char c; - for (int i = 0; i < 100; i++) - reader.read(c); - - SourceContext ctx = reader.getContext(4); - ASSERT_EQ("line", ctx.text); - ASSERT_EQ(4, ctx.relPos); - ASSERT_TRUE(ctx.truncatedStart); - ASSERT_FALSE(ctx.truncatedEnd); - } -}*/ - } |