33 TEST_CASE(
"Reject's are constructable.",
"[Reject]")
35 SECTION(
"Without a condition (match all packet/address combinations).")
39 SECTION(
"With a condition.")
42 REQUIRE_NOTHROW(
Reject(
If().type(
"PING")));
43 REQUIRE_NOTHROW(
Reject(
If().from(
"192.168")));
44 REQUIRE_NOTHROW(
Reject(
If().to(
"172.16")));
71 TEST_CASE(
"Reject's 'action' method determines what to do with a " 72 "packet/address combination.",
"[Reject]")
75 SECTION(
"Returns the reject action if there is no conditional.")
81 SECTION(
"Returns the reject action if the conditional is a match.")
90 SECTION(
"Returns the continue action if the conditional does not match.")
102 TEST_CASE(
"Reject's are printable (without a condition).",
"[Reject]")
107 SECTION(
"By direct type.")
111 SECTION(
"By polymorphic type.")
113 REQUIRE(
str(
rule) ==
"reject");
118 TEST_CASE(
"Reject's are printable (with a condition).",
"[Reject]")
121 Reject reject(
If().type(
"PING").from(
"192.168/8").to(
"172.16/4"));
123 SECTION(
"By direct type.")
125 REQUIRE(
str(
reject) ==
"reject if PING from 192.168/8 to 172.16/4");
127 SECTION(
"By polymorphic type.")
129 REQUIRE(
str(
rule) ==
"reject if PING from 192.168/8 to 172.16/4");
134 TEST_CASE(
"Reject's 'clone' method returns a polymorphic copy.",
"[Reject]")
138 std::unique_ptr<Rule> polymorphic_copy =
rule.
clone();
139 REQUIRE(
reject == *polymorphic_copy);
static Action make_reject()
std::string str(const T &object)
TEST_CASE("Reject's are constructable.", "[Reject]")
virtual std::unique_ptr< Rule > clone() const =0
static Action make_continue()