コード例 #1
0
TEST( SummaryTest, DefaultSummary ) {
	const char *head = "<qtitle>f1 doc</qtitle>";
	const char *body = "<p>cucumber</p>\n"
	                   "<a href=\"f3.html\">snegl</a>\n"
	                   "snegl\n";

	char input[MAX_BUF_SIZE];
	std::sprintf(input, HTML_FORMAT, head, body);

	Summary summary;
	generateSummary(summary, input, "banana", "http://www.example.com/");

	EXPECT_STREQ( "cucumber. snegl snegl", summary.getSummary() );
}
コード例 #2
0
TEST( SummaryTest, StripSamePunct ) {
	const char *body =
	   "<pre>"
	   "---------------------------------------------------------------------------------\n"
	   "|                      Name                      |       Total Donations        |\n"
	   "---------------------------------------------------------------------------------\n"
	   "| JENNI STANLEY                                  |                       $10.00 |\n"
	   "---------------------------------------------------------------------------------\n"
	   "| CANDRA BUDGE                                   |                       $22.00 |\n"
	   "---------------------------------------------------------------------------------\n"
	   "| JESSE NICLEY                                   |                       $34.00 |\n"
	   "---------------------------------------------------------------------------------\n"
	   "| SHARON YOKLEY                                  |                       $45.00 |\n"
	   "---------------------------------------------------------------------------------\n"
	   "</pre>";

	char input[MAX_BUF_SIZE];
	std::sprintf(input, HTML_FORMAT, "", body);

	Summary summary;
	generateSummary(summary, input, "jesse budge", "http://www.example.com/");

	EXPECT_STREQ("CANDRA BUDGE | $22.00 | … | JESSE NICLEY | $34.00 …", summary.getSummary());
}
コード例 #3
0
TEST( SummaryTest, DISABLED_BUGNoEllipsisAdded ) {
	const char *head =
		"<title>Instrument prices by Acme Inc.</title>\n"
		"<meta name=\"description\" content=\"Unorthodox musical instrument value estimation\">\n";

	const char *body =
		"<h1>Unusual saxophone valuation</h1>\n"
		"<p>Looking for knowing how much your saxophone is worth and what an appropriate insurance should be?. We provide that and other relevant information such as procedures, locations and time tables</p>\n"
		"<p>We also provide valuation for other musical instrucments.</p>\n";

	char input[MAX_BUF_SIZE];
	std::sprintf(input, HTML_FORMAT, head, body);

	Summary summary;
	generateSummary(summary, input, "saxophone", "http://www.example.com/");

	/// @todo ALC we're not adding ellipsis here due to lack of space. we should take one less word instead and add ellipsis.
	EXPECT_STREQ( "Unusual saxophone valuation. Looking for knowing how much your saxophone is worth and what an appropriate insurance should be?. We provide that and other relevant information …", summary.getSummary() );
}
コード例 #4
0
TEST( SummaryTest, DISABLED_BUGEllipsisAdded ) {
	const char *body = "Giraffe on rollerblades. Penguin on skateboard. The giraffe is way faster than that plumb bird with pathetic wings.\n";

	char input[MAX_BUF_SIZE];
	std::sprintf(input, "%s", body);

	Summary summary;
	generateSummary(summary, input, "giraffe", "http://www.example.com/");

	/// @todo ALC we're adding ellipsis even with a full sentence.
	EXPECT_STREQ( "Giraffe on rollerblades. Penguin on skateboard. The giraffe is way faster than that plumb bird with pathetic wings.", summary.getSummary() );
}