diff options
author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-01-09 17:00:53 +0100 |
---|---|---|
committer | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-01-09 17:00:53 +0100 |
commit | f37d3cd42eb18433445c2e259cd71a1b2bd67be0 (patch) | |
tree | c4371b1b4e3f578a6d20dc76dd74fb85d6fb901a /test/plugins | |
parent | 58fed7b74357b82ba55558f91ae13123dc2380eb (diff) |
added non-pretty output of XML serialization, changed DemoOutput accordingly and changed DemoOutputTest to have some kind of automatic inspection instead of visual inspection.
Diffstat (limited to 'test/plugins')
-rw-r--r-- | test/plugins/html/DemoOutputTest.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/test/plugins/html/DemoOutputTest.cpp b/test/plugins/html/DemoOutputTest.cpp index 5a34112..5b2758d 100644 --- a/test/plugins/html/DemoOutputTest.cpp +++ b/test/plugins/html/DemoOutputTest.cpp @@ -19,6 +19,7 @@ #include <gtest/gtest.h> #include <iostream> +#include <sstream> #include <plugins/html/DemoOutput.hpp> @@ -56,9 +57,17 @@ TEST(DemoHTMLTransformer, writeHTML) mgr.exportGraphviz("bookDocument.dot"); #endif - // TODO: change this. Don't use printouts + // we can only do a rough check here. DemoHTMLTransformer transformer; - transformer.writeHTML(doc, std::cout); + std::stringstream out; + transformer.writeHTML(doc, out); + const std::string res = out.str(); + ASSERT_FALSE(res == ""); + ASSERT_TRUE(res.find("Was ist Aufklärung?") != std::string::npos); + ASSERT_TRUE(res.find( + "Aufklärung ist der Ausgang des Menschen aus seiner " + "selbstverschuldeten Unmündigkeit!") != std::string::npos); + ASSERT_TRUE(res.find("Sapere aude!") != std::string::npos); } TEST(DemoHTMLTransformer, AnnotationProcessing) @@ -100,9 +109,15 @@ TEST(DemoHTMLTransformer, AnnotationProcessing) buildAnnotationEntity(doc, logger, {"emphasized"}, em_start, em_end); buildAnnotationEntity(doc, logger, {"strong"}, strong_start, strong_end); - // TODO: change this. Don't use printouts + // Check serialization. DemoHTMLTransformer transformer; - transformer.writeHTML(doc, std::cout); + std::stringstream out; + transformer.writeHTML(doc, out, false); + const std::string res = out.str(); + // In HTML the overlapping structure must be serialized as follows: + ASSERT_TRUE( + res.find("<em>bla<strong>blub</strong></em><strong>bla</strong>") != + std::string::npos); } } } |