From 8aaedfd59414b94eb463eaa12d6c9bf5e716f645 Mon Sep 17 00:00:00 2001 From: Andrew Ferraiuolo Date: Thu, 15 Sep 2022 14:10:10 +0100 Subject: [PATCH] PR fixup --- src/ir/auth_logic/ast.h | 1 - src/ir/auth_logic/ast_equality_test.cc | 7 +++---- src/ir/datalog/program.h | 24 ++++++++++++------------ 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/ir/auth_logic/ast.h b/src/ir/auth_logic/ast.h index a28f2ef13..c9206524c 100644 --- a/src/ir/auth_logic/ast.h +++ b/src/ir/auth_logic/ast.h @@ -458,7 +458,6 @@ class Program { absl::StrJoin(query_strings, "\n"), ")"); } - // for debugging/testing only bool operator==(const Program& rhs) const { return relation_declarations_ == rhs.relation_declarations_ && says_assertions_ == rhs.says_assertions_ && queries_ == rhs.queries_; diff --git a/src/ir/auth_logic/ast_equality_test.cc b/src/ir/auth_logic/ast_equality_test.cc index 103c1b6d4..048bb757a 100644 --- a/src/ir/auth_logic/ast_equality_test.cc +++ b/src/ir/auth_logic/ast_equality_test.cc @@ -99,16 +99,15 @@ TEST_P(AttributeEqTest, AttributeEqTest) { static datalog::Predicate pred1("foo", {"bar", "baz"}, datalog::kPositive); static datalog::Predicate pred2("foooo", {"bar", "baz"}, datalog::kPositive); +static datalog::Predicate pred3("foo", {"bar", "baz"}, datalog::kNegated); static Attribute attr1(prinA, pred1); static Attribute attr2(prinB, pred2); static Attribute attr3(prinA, pred2); static Attribute attr4(prinB, pred1); +static Attribute attr4(prinB, pred3); static std::pair attributeTestVals[] = { - {attr1, 0}, - {attr2, 1}, - {attr3, 2}, - {attr4, 3}, + {attr1, 0}, {attr2, 1}, {attr3, 2}, {attr4, 3}, {attr5, 4}, }; INSTANTIATE_TEST_SUITE_P( diff --git a/src/ir/datalog/program.h b/src/ir/datalog/program.h index 0c9b123bd..f60b617b7 100644 --- a/src/ir/datalog/program.h +++ b/src/ir/datalog/program.h @@ -96,8 +96,8 @@ class ArgumentType { // The name field is only compared for arguments of kind kCustom // because the name field is only used for kCustom types (and // not for kPrincipal or kNumber). - return this->kind_ == otherType.kind() && - this->kind_ == Kind::kCustom ? this->name_ == otherType.name() : true; + return this->kind_ == otherType.kind_ && + this->kind_ == Kind::kCustom ? this->name_ == otherType.name_ : true; } private: @@ -120,8 +120,8 @@ class Argument { } bool operator==(const Argument& otherArgument) const { - return this->argument_name_ == otherArgument.argument_name() && - this->argument_type_ == otherArgument.argument_type(); + return this->argument_name_ == otherArgument.argument_name_ && + this->argument_type_ == otherArgument.argument_type_; } private: @@ -142,9 +142,9 @@ class RelationDeclaration { const std::vector& arguments() const { return arguments_; } bool operator==(const RelationDeclaration& otherDeclaration) const { - return this->relation_name_ == otherDeclaration.relation_name() && - this->is_attribute_ == otherDeclaration.is_attribute() && - this->arguments_ == otherDeclaration.arguments(); + return this->relation_name_ == otherDeclaration.relation_name_ && + this->is_attribute_ == otherDeclaration.is_attribute_ && + this->arguments_ == otherDeclaration.arguments_; } // A potentially ugly print of the state in this class @@ -178,8 +178,8 @@ class Rule { const std::vector& rhs() const { return rhs_; } bool operator==(const Rule& otherRule) const { - return this->lhs_ == otherRule.lhs() && - this->rhs_ == otherRule.rhs(); + return this->lhs_ == otherRule.lhs_ && + this->rhs_ == otherRule.rhs_; } private: @@ -202,9 +202,9 @@ class Program { bool operator==(const Program& otherProgram) const { return this->relation_declarations_ == - otherProgram.relation_declarations() && - this->rules_ == otherProgram.rules() && - this->outputs_ == otherProgram.outputs(); + otherProgram.relation_declarations_ && + this->rules_ == otherProgram.rules_ && + this->outputs_ == otherProgram.outputs_; } private: