"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "auxil/broker/tests/cpp/topic.cc" between
zeek-4.0.2.tar.gz and zeek-4.0.3.tar.gz

About: Zeek (formerly Bro) is a flexible network analysis framework focusing on network security monitoring. LTS (Long Term Support) release.

topic.cc  (zeek-4.0.2):topic.cc  (zeek-4.0.3)
skipping to change at line 18 skipping to change at line 18
namespace { namespace {
auto sep = std::string{topic::sep}; auto sep = std::string{topic::sep};
} // namespace <anonymous> } // namespace <anonymous>
TEST(concatenation) { TEST(concatenation) {
topic t; topic t;
t /= "foo"; t /= "foo";
CHECK_EQUAL(t, "foo"); CHECK_EQUAL(t.string(), "foo");
t /= "bar"; t /= "bar";
CHECK_EQUAL(t, "foo" + sep + "bar"); CHECK_EQUAL(t.string(), "foo" + sep + "bar");
t /= "/baz"; t /= "/baz";
CHECK_EQUAL(t, "foo" + sep + "bar" + sep + "baz"); CHECK_EQUAL(t.string(), "foo" + sep + "bar" + sep + "baz");
} }
TEST(split) { TEST(split) {
auto xs = topic::split("foo/bar/baz"_t); auto xs = topic::split("foo/bar/baz"_t);
REQUIRE_EQUAL(xs.size(), 3u); REQUIRE_EQUAL(xs.size(), 3u);
CHECK_EQUAL(xs[0], "foo"); CHECK_EQUAL(xs[0], "foo");
CHECK_EQUAL(xs[1], "bar"); CHECK_EQUAL(xs[1], "bar");
CHECK_EQUAL(xs[2], "baz"); CHECK_EQUAL(xs[2], "baz");
auto framed = topic::split("/foo/bar/baz/"_t); auto framed = topic::split("/foo/bar/baz/"_t);
CHECK(xs == framed); CHECK(xs == framed);
} }
TEST(join) { TEST(join) {
std::vector<std::string> xs{"/foo", "bar/", "/baz"}; std::vector<std::string> xs{"/foo", "bar/", "/baz"};
auto t = topic::join(xs); auto t = topic::join(xs);
CHECK_EQUAL(t, sep + "foo" + sep + "bar" + sep + "baz"); CHECK_EQUAL(t.string(), sep + "foo" + sep + "bar" + sep + "baz");
} }
TEST(prefix) { TEST(prefix) {
topic t0 = "/zeek/"; topic t0 = "/zeek/";
topic t1 = "/zeek/events/"; topic t1 = "/zeek/events/";
topic t2 = "/zeek/events/debugging/"; topic t2 = "/zeek/events/debugging/";
topic t3 = "/zeek/stores/"; topic t3 = "/zeek/stores/";
topic t4 = "/zeek/stores/masters/"; topic t4 = "/zeek/stores/masters/";
topic t5 = "/"; topic t5 = "/";
// t0 is a prefix of all topics except t5 // t0 is a prefix of all topics except t5
 End of changes. 4 change blocks. 
4 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)