Using unsigned constants in tests to avoid warnings with Google Test.

This commit is contained in:
Patrick Lühne 2016-05-26 00:17:55 +02:00
parent 2281967176
commit d9a40af3f0
2 changed files with 25 additions and 25 deletions

View File

@ -50,7 +50,7 @@ TEST_F(SASParserTests, ParseValidSASFile)
ASSERT_FALSE(description.usesActionCosts()); ASSERT_FALSE(description.usesActionCosts());
ASSERT_EQ(description.variables().size(), 37); ASSERT_EQ(description.variables().size(), 37u);
ASSERT_EQ(description.variables()[0].axiomLayer(), -1); ASSERT_EQ(description.variables()[0].axiomLayer(), -1);
ASSERT_EQ(description.variables()[0].values()[0].sign(), plasp::sas::Value::Sign::Positive); ASSERT_EQ(description.variables()[0].values()[0].sign(), plasp::sas::Value::Sign::Positive);
ASSERT_EQ(description.variables()[0].values()[0].name(), "activate(philosopher-0, forks--pid-rfork)"); ASSERT_EQ(description.variables()[0].values()[0].name(), "activate(philosopher-0, forks--pid-rfork)");
@ -58,51 +58,51 @@ TEST_F(SASParserTests, ParseValidSASFile)
ASSERT_EQ(description.variables()[36].values()[1].sign(), plasp::sas::Value::Sign::Negative); ASSERT_EQ(description.variables()[36].values()[1].sign(), plasp::sas::Value::Sign::Negative);
ASSERT_EQ(description.variables()[36].values()[1].name(), "queue-tail-msg(forks-1-, fork)"); ASSERT_EQ(description.variables()[36].values()[1].name(), "queue-tail-msg(forks-1-, fork)");
ASSERT_EQ(description.mutexGroups().size(), 8); ASSERT_EQ(description.mutexGroups().size(), 8u);
ASSERT_EQ(description.mutexGroups()[0].facts().size(), 9); ASSERT_EQ(description.mutexGroups()[0].facts().size(), 9u);
ASSERT_EQ(&description.mutexGroups()[0].facts()[0].value(), &description.variables()[0].values()[0]); ASSERT_EQ(&description.mutexGroups()[0].facts()[0].value(), &description.variables()[0].values()[0]);
ASSERT_EQ(description.mutexGroups()[7].facts().size(), 2); ASSERT_EQ(description.mutexGroups()[7].facts().size(), 2u);
ASSERT_EQ(&description.mutexGroups()[7].facts()[1].value(), &description.variables()[34].values()[1]); ASSERT_EQ(&description.mutexGroups()[7].facts()[1].value(), &description.variables()[34].values()[1]);
ASSERT_EQ(description.initialState().facts().size(), 37); ASSERT_EQ(description.initialState().facts().size(), 37u);
ASSERT_EQ(&description.initialState().facts()[0].value(), &description.variables()[0].values()[8]); ASSERT_EQ(&description.initialState().facts()[0].value(), &description.variables()[0].values()[8]);
ASSERT_EQ(&description.initialState().facts()[36].value(), &description.variables()[36].values()[1]); ASSERT_EQ(&description.initialState().facts()[36].value(), &description.variables()[36].values()[1]);
ASSERT_EQ(description.goal().facts().size(), 2); ASSERT_EQ(description.goal().facts().size(), 2u);
ASSERT_EQ(&description.goal().facts()[0].value(), &description.variables()[6].values()[0]); ASSERT_EQ(&description.goal().facts()[0].value(), &description.variables()[6].values()[0]);
ASSERT_EQ(&description.goal().facts()[1].value(), &description.variables()[7].values()[0]); ASSERT_EQ(&description.goal().facts()[1].value(), &description.variables()[7].values()[0]);
ASSERT_EQ(description.operators().size(), 34); ASSERT_EQ(description.operators().size(), 34u);
ASSERT_EQ(description.operators()[0].predicate().name(), "activate-trans"); ASSERT_EQ(description.operators()[0].predicate().name(), "activate-trans");
ASSERT_EQ(description.operators()[0].predicate().arguments().size(), 5); ASSERT_EQ(description.operators()[0].predicate().arguments().size(), 5u);
ASSERT_EQ(description.operators()[0].predicate().arguments()[0], "philosopher-0"); ASSERT_EQ(description.operators()[0].predicate().arguments()[0], "philosopher-0");
ASSERT_EQ(description.operators()[0].predicate().arguments()[4], "state-3"); ASSERT_EQ(description.operators()[0].predicate().arguments()[4], "state-3");
ASSERT_EQ(description.operators()[0].preconditions().size(), 3); ASSERT_EQ(description.operators()[0].preconditions().size(), 3u);
ASSERT_EQ(&description.operators()[0].preconditions()[0].value(), &description.variables()[4].values()[4]); ASSERT_EQ(&description.operators()[0].preconditions()[0].value(), &description.variables()[4].values()[4]);
ASSERT_EQ(&description.operators()[0].preconditions()[1].value(), &description.variables()[16].values()[1]); ASSERT_EQ(&description.operators()[0].preconditions()[1].value(), &description.variables()[16].values()[1]);
ASSERT_EQ(&description.operators()[0].preconditions()[2].value(), &description.variables()[0].values()[8]); ASSERT_EQ(&description.operators()[0].preconditions()[2].value(), &description.variables()[0].values()[8]);
ASSERT_EQ(description.operators()[0].effects().size(), 1); ASSERT_EQ(description.operators()[0].effects().size(), 1u);
ASSERT_EQ(description.operators()[0].effects()[0].conditions().size(), 0); ASSERT_EQ(description.operators()[0].effects()[0].conditions().size(), 0u);
ASSERT_EQ(&description.operators()[0].effects()[0].postcondition().value(), &description.variables()[0].values()[0]); ASSERT_EQ(&description.operators()[0].effects()[0].postcondition().value(), &description.variables()[0].values()[0]);
ASSERT_EQ(description.operators()[33].predicate().name(), "queue-write"); ASSERT_EQ(description.operators()[33].predicate().name(), "queue-write");
ASSERT_EQ(description.operators()[33].predicate().arguments().size(), 4); ASSERT_EQ(description.operators()[33].predicate().arguments().size(), 4u);
ASSERT_EQ(description.operators()[33].predicate().arguments()[0], "philosopher-1"); ASSERT_EQ(description.operators()[33].predicate().arguments()[0], "philosopher-1");
ASSERT_EQ(description.operators()[33].predicate().arguments()[3], "fork"); ASSERT_EQ(description.operators()[33].predicate().arguments()[3], "fork");
ASSERT_EQ(description.operators()[33].preconditions().size(), 2); ASSERT_EQ(description.operators()[33].preconditions().size(), 2u);
ASSERT_EQ(&description.operators()[33].preconditions()[0].value(), &description.variables()[1].values()[3]); ASSERT_EQ(&description.operators()[33].preconditions()[0].value(), &description.variables()[1].values()[3]);
ASSERT_EQ(&description.operators()[33].preconditions()[1].value(), &description.variables()[2].values()[2]); ASSERT_EQ(&description.operators()[33].preconditions()[1].value(), &description.variables()[2].values()[2]);
ASSERT_EQ(description.operators()[33].effects().size(), 3); ASSERT_EQ(description.operators()[33].effects().size(), 3u);
ASSERT_EQ(description.operators()[33].effects()[0].conditions().size(), 0); ASSERT_EQ(description.operators()[33].effects()[0].conditions().size(), 0u);
ASSERT_EQ(&description.operators()[33].effects()[0].postcondition().value(), &description.variables()[1].values()[7]); ASSERT_EQ(&description.operators()[33].effects()[0].postcondition().value(), &description.variables()[1].values()[7]);
ASSERT_EQ(&description.operators()[33].effects()[2].postcondition().value(), &description.variables()[35].values()[0]); ASSERT_EQ(&description.operators()[33].effects()[2].postcondition().value(), &description.variables()[35].values()[0]);
ASSERT_EQ(description.axiomRules().size(), 33); ASSERT_EQ(description.axiomRules().size(), 33u);
ASSERT_EQ(description.axiomRules()[0].conditions().size(), 4); ASSERT_EQ(description.axiomRules()[0].conditions().size(), 4u);
ASSERT_EQ(&description.axiomRules()[0].conditions()[0].value(), &description.variables()[0].values()[0]); ASSERT_EQ(&description.axiomRules()[0].conditions()[0].value(), &description.variables()[0].values()[0]);
ASSERT_EQ(&description.axiomRules()[0].conditions()[2].value(), &description.variables()[27].values()[0]); ASSERT_EQ(&description.axiomRules()[0].conditions()[2].value(), &description.variables()[27].values()[0]);
ASSERT_EQ(&description.axiomRules()[0].conditions()[3].value(), &description.variables()[8].values()[1]); ASSERT_EQ(&description.axiomRules()[0].conditions()[3].value(), &description.variables()[8].values()[1]);
ASSERT_EQ(&description.axiomRules()[0].postcondition().value(), &description.variables()[8].values()[0]); ASSERT_EQ(&description.axiomRules()[0].postcondition().value(), &description.variables()[8].values()[0]);
ASSERT_EQ(description.axiomRules()[32].conditions().size(), 2); ASSERT_EQ(description.axiomRules()[32].conditions().size(), 2u);
ASSERT_EQ(&description.axiomRules()[32].conditions()[0].value(), &description.variables()[15].values()[0]); ASSERT_EQ(&description.axiomRules()[32].conditions()[0].value(), &description.variables()[15].values()[0]);
ASSERT_EQ(&description.axiomRules()[32].conditions()[1].value(), &description.variables()[25].values()[0]); ASSERT_EQ(&description.axiomRules()[32].conditions()[1].value(), &description.variables()[25].values()[0]);
ASSERT_EQ(&description.axiomRules()[32].postcondition().value(), &description.variables()[25].values()[1]); ASSERT_EQ(&description.axiomRules()[32].postcondition().value(), &description.variables()[25].values()[1]);
@ -160,14 +160,14 @@ TEST_F(SASParserTests, ParseRequirements)
ASSERT_TRUE(description.usesConditionalEffects()); ASSERT_TRUE(description.usesConditionalEffects());
ASSERT_FALSE(description.usesAxiomRules()); ASSERT_FALSE(description.usesAxiomRules());
ASSERT_EQ(description.operators().size(), 496); ASSERT_EQ(description.operators().size(), 496u);
ASSERT_EQ(description.operators()[0].costs(), 1); ASSERT_EQ(description.operators()[0].costs(), 1u);
ASSERT_EQ(description.operators()[172].costs(), 10); ASSERT_EQ(description.operators()[172].costs(), 10u);
ASSERT_EQ(description.operators()[173].costs(), 63); ASSERT_EQ(description.operators()[173].costs(), 63u);
ASSERT_EQ(description.operators()[172].effects().size(), 3); ASSERT_EQ(description.operators()[172].effects().size(), 3u);
ASSERT_EQ(description.operators()[172].effects()[1].conditions().size(), 1); ASSERT_EQ(description.operators()[172].effects()[1].conditions().size(), 1u);
ASSERT_EQ(&description.operators()[172].effects()[1].conditions()[0].value(), &description.variables()[1].values()[4]); ASSERT_EQ(&description.operators()[172].effects()[1].conditions()[0].value(), &description.variables()[1].values()[4]);
} }
catch (const std::exception &e) catch (const std::exception &e)

View File

@ -9,7 +9,7 @@ TEST(UtilsTests, ParseSimple)
std::stringstream stream("identifier 5 \n-51\t expected unexpected 100 -100"); std::stringstream stream("identifier 5 \n-51\t expected unexpected 100 -100");
ASSERT_EQ(plasp::utils::parse<std::string>(stream), "identifier"); ASSERT_EQ(plasp::utils::parse<std::string>(stream), "identifier");
ASSERT_EQ(plasp::utils::parse<size_t>(stream), 5); ASSERT_EQ(plasp::utils::parse<size_t>(stream), 5u);
ASSERT_EQ(plasp::utils::parse<int>(stream), -51); ASSERT_EQ(plasp::utils::parse<int>(stream), -51);
ASSERT_NO_THROW(plasp::utils::parseExpected<std::string>(stream, "expected")); ASSERT_NO_THROW(plasp::utils::parseExpected<std::string>(stream, "expected"));
ASSERT_THROW(plasp::utils::parseExpected<std::string>(stream, "expected"), plasp::utils::ParserException); ASSERT_THROW(plasp::utils::parseExpected<std::string>(stream, "expected"), plasp::utils::ParserException);