|
@@ -41,14 +41,14 @@ struct Log {
|
|
"of log";
|
|
"of log";
|
|
{
|
|
{
|
|
SCOPED_TRACE("Checking that the first amount of checks did run");
|
|
SCOPED_TRACE("Checking that the first amount of checks did run");
|
|
- for (size_t i(0); i < amount; ++ i) {
|
|
|
|
|
|
+ for (size_t i(0); i < amount; ++i) {
|
|
EXPECT_TRUE(run[i]) << "Check #" << i << " did not run.";
|
|
EXPECT_TRUE(run[i]) << "Check #" << i << " did not run.";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
{
|
|
{
|
|
SCOPED_TRACE("Checking that the rest did not run");
|
|
SCOPED_TRACE("Checking that the rest did not run");
|
|
- for (size_t i(amount); i < LOG_SIZE; ++ i) {
|
|
|
|
|
|
+ for (size_t i(amount); i < LOG_SIZE; ++i) {
|
|
EXPECT_FALSE(run[i]) << "Check #" << i << "did run.";
|
|
EXPECT_FALSE(run[i]) << "Check #" << i << "did run.";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -59,19 +59,19 @@ struct Log {
|
|
// But it logs that it did run.
|
|
// But it logs that it did run.
|
|
class ConstCheck : public Check<Log*> {
|
|
class ConstCheck : public Check<Log*> {
|
|
public:
|
|
public:
|
|
- ConstCheck(bool accepts, size_t logNum) :
|
|
|
|
- logNum_(logNum),
|
|
|
|
|
|
+ ConstCheck(bool accepts, size_t log_num) :
|
|
|
|
+ log_num_(log_num),
|
|
accepts_(accepts)
|
|
accepts_(accepts)
|
|
{
|
|
{
|
|
- assert(logNum < LOG_SIZE); // If this fails, the LOG_SIZE is too small
|
|
|
|
|
|
+ assert(log_num < LOG_SIZE); // If this fails, the LOG_SIZE is too small
|
|
}
|
|
}
|
|
typedef Log* LPtr;
|
|
typedef Log* LPtr;
|
|
virtual bool matches(const LPtr& log) const {
|
|
virtual bool matches(const LPtr& log) const {
|
|
- log->run[logNum_] = true;
|
|
|
|
|
|
+ log->run[log_num_] = true;
|
|
return (accepts_);
|
|
return (accepts_);
|
|
}
|
|
}
|
|
private:
|
|
private:
|
|
- size_t logNum_;
|
|
|
|
|
|
+ size_t log_num_;
|
|
bool accepts_;
|
|
bool accepts_;
|
|
};
|
|
};
|
|
|
|
|
|
@@ -81,7 +81,7 @@ class TestAcl : public Acl<Log*> {
|
|
public:
|
|
public:
|
|
TestAcl() :
|
|
TestAcl() :
|
|
Acl(DROP)
|
|
Acl(DROP)
|
|
- { }
|
|
|
|
|
|
+ {}
|
|
// Check the stored policy there
|
|
// Check the stored policy there
|
|
void checkPolicy(Action ac) {
|
|
void checkPolicy(Action ac) {
|
|
EXPECT_EQ(policy_, ac);
|
|
EXPECT_EQ(policy_, ac);
|
|
@@ -93,14 +93,14 @@ public:
|
|
class AclTest : public ::testing::Test {
|
|
class AclTest : public ::testing::Test {
|
|
public:
|
|
public:
|
|
AclTest() :
|
|
AclTest() :
|
|
- nextCheck_(0)
|
|
|
|
- { }
|
|
|
|
|
|
+ next_check_(0)
|
|
|
|
+ {}
|
|
TestAcl acl_;
|
|
TestAcl acl_;
|
|
Log log_;
|
|
Log log_;
|
|
- size_t nextCheck_;
|
|
|
|
|
|
+ size_t next_check_;
|
|
shared_ptr<Check<Log*> > getCheck(bool accepts) {
|
|
shared_ptr<Check<Log*> > getCheck(bool accepts) {
|
|
return (shared_ptr<Check<Log*> >(new ConstCheck(accepts,
|
|
return (shared_ptr<Check<Log*> >(new ConstCheck(accepts,
|
|
- nextCheck_ ++)));
|
|
|
|
|
|
+ next_check_++)));
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|