Skip to content
Snippets Groups Projects
Commit d8840260 authored by ilor's avatar ilor
Browse files

fix tests

parent 693399c7
No related merge requests found
......@@ -12,8 +12,9 @@ struct F {
"A tag tog other a3 \n"
"B data thing tag-thing thang\n"
"C a b c \n"
"[POS]\n some A B [C]\n same A B\n";
tagset.reset(new Corpus2::Tagset(tagset_string));
"[POS]\n some A B [C]\n same A B \n P3 [A] [B]\n";
tagset.reset(new Corpus2::Tagset());
*tagset = Corpus2::Tagset::from_data(tagset_string);
}
boost::shared_ptr<Corpus2::Tagset> tagset;
......@@ -22,10 +23,15 @@ struct F {
std::set<std::string> actual;
std::vector<Corpus2::Tag> tags;
Corpus2::Token t;
tagset->lexemes_into_token(t, UnicodeString(), s);
try {
tagset->lexemes_into_token(t, UnicodeString(), s);
} catch (Corpus2::TagParseError& e) {
throw;
}
foreach (const Corpus2::Lexeme& lex, t.lexemes()) {
const Corpus2::Tag& tag = lex.tag();
BOOST_WARN(tagset->validate_tag(tag, false));
BOOST_WARN(tagset->validate_tag(tag, false, &std::cerr));
actual.insert(tagset->tag_to_string(tag));
tags.push_back(tag);
}
......@@ -89,9 +95,9 @@ BOOST_FIXTURE_TEST_CASE( dots_plus, F )
BOOST_FIXTURE_TEST_CASE( missing, F )
{
const char tag[] = "some:data";
const char tag[] = "P3:data";
std::set<std::string> r;
r.insert("some::data");
r.insert("P3:data");
check_split(tag, r);
}
......@@ -163,8 +169,8 @@ BOOST_FIXTURE_TEST_CASE( underscore_dots, F )
BOOST_FIXTURE_TEST_CASE( tag_size, F )
{
Corpus2::Tag t = tagset->parse_simple_tag("some:tag:data", false);
Corpus2::Tag t2 = tagset->parse_simple_tag("some:tog", false);
Corpus2::Tag t3 = tagset->parse_simple_tag("same", false);
Corpus2::Tag t2 = tagset->parse_simple_tag("some:tog:data", false);
Corpus2::Tag t3 = tagset->parse_simple_tag("same:tag:data", false);
BOOST_CHECK(tagset->tag_is_singular(t));
BOOST_CHECK_EQUAL(tagset->tag_size(t), 1);
BOOST_CHECK(tagset->tag_is_singular(t2));
......
......@@ -26,19 +26,23 @@ BOOST_AUTO_TEST_CASE( empty )
BOOST_AUTO_TEST_CASE( minimal )
{
Corpus2::Tagset t;
try {
parse(PRE POSA);
t = parse(PRE POSA);
} catch (Corpus2::TagsetParseError& e) {
BOOST_FAIL(e.info());
}
BOOST_CHECK_EQUAL(t.pos_count(), 1);
}
BOOST_AUTO_TEST_CASE( minimal_nonewline )
{
Corpus2::Tagset t;
try {
parse(PRE "[POS]\n POS1");
t = parse(PRE "[POS]\n POS1");
} catch (Corpus2::TagsetParseError& e) {
BOOST_FAIL(e.info());
}
BOOST_CHECK_EQUAL(t.pos_count(), 1);
}
BOOST_AUTO_TEST_CASE( dupe_val )
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment