Skip to content
Snippets Groups Projects
Commit 926a99e5 authored by Marco Biasini's avatar Marco Biasini
Browse files

fix for BZDNG-219 (bracketed-within query ignores not)

parent bffecd20
Branches
Tags
No related merge requests found
......@@ -1037,7 +1037,7 @@ Node* QueryImpl::ParseWithinExpr(QueryLexer& lexer) {
geom::Vec3 point;
if (this->ParsePoint(lexer, point)) {
ParamType pt(WithinParam(point, rv*rv));
CompOP comp_op= COP_LE;
CompOP comp_op=COP_LE;
if (inversion_stack_.back())
comp_op=COP_GE;
SelNode* within_node=new SelNode(Prop(Prop::WITHIN, Prop::VEC_DIST,
......@@ -1077,8 +1077,11 @@ Node* QueryImpl::ParseWithinExpr(QueryLexer& lexer) {
ParamType pt(WithinParam(bracketed_expr_.size()-1, rv*rv));
inversion_stack_.pop_back();
CompOP comp_op= COP_LE;
if (inversion_stack_.back())
if (inversion_stack_.back()) {
std::cout << "INV" << std::endl;
comp_op=COP_GE;
}
SelNode* within_node=new SelNode(Prop(Prop::WITHIN, Prop::VEC_DIST,
Prop::ATOM),
comp_op, pt);
......
......@@ -72,7 +72,7 @@ bool QueryState::do_within(const geom::Vec3& pos, const impl::WithinParam& p,
if (geom::Dot(d, d) <= p.GetRadiusSquare()) {
return true;
}
} else if (geom::Dot(d, d) > p.GetRadiusSquare()) {
} else if (geom::Dot(d, d) < p.GetRadiusSquare()) {
return false;
}
}
......
......@@ -76,13 +76,13 @@ void ensure_counts(EntityHandle e, const String& qs, int cc, int rc, int ac) {
BOOST_CHECK_NO_THROW(v=e.Select(qs));
BOOST_CHECK_MESSAGE(v.GetChainCount()==cc,
"wrong chain count " << v.GetChainCount()
<< " for query String " << qs);
<< " for query string " << qs);
BOOST_CHECK_MESSAGE(v.GetResidueCount()==rc,
"wrong residue count " << v.GetResidueCount() <<
" for query String " << qs);
" for query string " << qs);
BOOST_CHECK_MESSAGE(v.GetAtomCount()==ac,
"wrong atom count " << v.GetAtomCount() <<
" for query String " << qs);
" for query string " << qs);
}
void ensure_counts_v(EntityView src, const String& qs,
......@@ -208,6 +208,9 @@ BOOST_AUTO_TEST_CASE(test_query_eval)
ensure_counts(e, "rtype=C", 1, 3, 27);
ensure_counts(e, "not (aname=CA and not aname=CA)", 1, 3, 27);
ensure_counts(e, "3 <> {21.5,35,57.0}", 1, 2, 5);
ensure_counts(e, "not 3 <> {21.5,35,57.0}", 1, 3, 22);
ensure_counts(e, "3 <> {21.5,35,57} and not 0.5 <> {21.5,35,57} ", 1, 2, 4);
ensure_counts(e, "not 0.5 <> [rnum=3]", 1, 2, 19);
ensure_counts(e, "1 <> {0,0,0}", 0, 0, 0);
ensure_counts(e, "gatestpropa:0=1", 1, 1, 1);
ensure_counts(e, "gatestpropa:1.0=1", 1, 3, 27);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment