New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement tests for construct query parsing #540
Conversation
ASSERT_EQ(toStringView(result->first), std::string(BUFFER_SIZE, 'A')); | ||
ASSERT_TRUE(result->second); | ||
|
||
auto result2 = writer.get(errorCode); | ||
ASSERT_EQ(errorCode, boost::system::error_code()); | ||
ASSERT_NE(result, boost::none); | ||
ASSERT_TRUE(result2 != boost::none); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some unknown reason the ASSERT_NE/EQ makros cannot be used to compare boost::none with boost::optional. It seems like gtest has a problem trying to instantiate a templated function that produces a string representation of those types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try this out, if this is a bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is absolutely the correct direction,
You can add the additional test cases for the Parser (simpler cases, but also for single functions)
test/SparqlAntlrParserTest.cpp
Outdated
|
||
EXPECT_THAT(triples[0][0], IsBlankNode("_:g_0")); | ||
EXPECT_THAT(triples[0][1], IsVariable("?a")); | ||
EXPECT_THAT(triples[0][2], IsBlankNode("_:g_3")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EXPECT_THAT(triples[0], {Blank(true, "0"), Var("?a"), Blank(true, "3")});
or even
expectTriple(0, {Blank(true, "0"), Var("?a"), Blank(true, "3")})
;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and all Blank nodes are generated, so this can be also abstracted away
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank(0)
ASSERT_EQ(toStringView(result->first), std::string(BUFFER_SIZE, 'A')); | ||
ASSERT_TRUE(result->second); | ||
|
||
auto result2 = writer.get(errorCode); | ||
ASSERT_EQ(errorCode, boost::system::error_code()); | ||
ASSERT_NE(result, boost::none); | ||
ASSERT_TRUE(result2 != boost::none); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try this out, if this is a bug.
96f2e8e
to
02fc2c1
Compare
02fc2c1
to
153a863
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this is really useful,
there are only some small nitpicks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment to wrap this up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for these extensive tests.
WIP some design decisions need to be discussed