Skip to content
Snippets Groups Projects
Commit 82651c7b authored by Adam Wardynski's avatar Adam Wardynski
Browse files

Remove check for current position, it should be handled earlier

I.E. empty sentence shouldn't be passed anyway and that is what
Operator class is checking for. But otherwise, at the level of
operator, it can deal with a sentence that has current pos outside
of boundaries.
parent c67faa52
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,7 @@ GetLemmas::BaseRetValPtr GetLemmas::apply_internal(const FunExecContext& context
{
const boost::shared_ptr<const Position>& pos = pos_expr_->apply(context);
const SentenceContext& sc = context.sentence_context();
if(pos->is_outside(sc) || !sc.is_current_inside()) {
if(pos->is_outside(sc)) {
return detail::DefaultFunction<StrSet>()->apply(context);
}
boost::shared_ptr<StrSet> u_set = boost::make_shared<StrSet>();
......
......@@ -18,7 +18,7 @@ GetOrth::BaseRetValPtr GetOrth::apply_internal(const FunExecContext& context) co
{
const boost::shared_ptr<const Position>& pos = pos_expr_->apply(context);
const SentenceContext& sc = context.sentence_context();
if(pos->is_outside(sc) || !sc.is_current_inside()) {
if(pos->is_outside(sc)) {
return detail::DefaultFunction<StrSet>()->apply(context);
}
boost::shared_ptr<StrSet> u_set = boost::make_shared<StrSet>();
......
......@@ -28,7 +28,7 @@ GetSymbols::BaseRetValPtr GetSymbols::apply_internal(const FunExecContext& conte
{
const boost::shared_ptr<const Position>& pos = pos_expr_->apply(context);
const SentenceContext& sc = context.sentence_context();
if(pos->is_outside(sc) || !sc.is_current_inside()) {
if(pos->is_outside(sc)) {
return detail::DefaultFunction<TSet>()->apply(context);
}
......
......@@ -97,7 +97,7 @@ BOOST_FIXTURE_TEST_CASE(lemmas_begin, LemmasPredFix)
sc.advance();
BOOST_CHECK(lemmas.apply(cx)->equals(first_lemmas));
sc.advance();
BOOST_CHECK(lemmas.apply(cx)->equals(empty_set));
BOOST_CHECK(lemmas.apply(cx)->equals(first_lemmas));
}
BOOST_FIXTURE_TEST_CASE(lemmas_end, LemmasPredFix)
......@@ -107,7 +107,7 @@ BOOST_FIXTURE_TEST_CASE(lemmas_end, LemmasPredFix)
sc.advance();
BOOST_CHECK(lemmas.apply(cx)->equals(second_lemmas));
sc.advance();
BOOST_CHECK(lemmas.apply(cx)->equals(empty_set));
BOOST_CHECK(lemmas.apply(cx)->equals(second_lemmas));
}
BOOST_FIXTURE_TEST_CASE(lemmas_zero, LemmasPredFix)
......@@ -137,6 +137,8 @@ BOOST_FIXTURE_TEST_CASE(lemmas_minus_one, LemmasPredFix)
sc.advance();
BOOST_CHECK(lemmas.apply(cx)->equals(first_lemmas));
sc.advance();
BOOST_CHECK(lemmas.apply(cx)->equals(second_lemmas));
sc.advance();
BOOST_CHECK(lemmas.apply(cx)->equals(empty_set));
}
//------ to_string test cases -------
......
......@@ -96,7 +96,7 @@ BOOST_FIXTURE_TEST_CASE(orth_begin, OrthPredFix)
sc.advance();
BOOST_CHECK(orth.apply(cx)->equals(first_orth));
sc.advance();
BOOST_CHECK(orth.apply(cx)->equals(empty_set));
BOOST_CHECK(orth.apply(cx)->equals(first_orth));
sc.goto_start();
}
......@@ -107,7 +107,7 @@ BOOST_FIXTURE_TEST_CASE(orth_end, OrthPredFix)
sc.advance();
BOOST_CHECK(orth.apply(cx)->equals(second_orth));
sc.advance();
BOOST_CHECK(orth.apply(cx)->equals(empty_set));
BOOST_CHECK(orth.apply(cx)->equals(second_orth));
sc.goto_start();
}
......@@ -140,6 +140,8 @@ BOOST_FIXTURE_TEST_CASE(orth_minus_one, OrthPredFix)
sc.advance();
BOOST_CHECK(orth.apply(cx)->equals(first_orth));
sc.advance();
BOOST_CHECK(orth.apply(cx)->equals(second_orth));
sc.advance();
BOOST_CHECK(orth.apply(cx)->equals(empty_set));
sc.goto_start();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment