diff --git a/src/edit_tests.cxx b/src/edit_tests.cxx index 61bf171..bbb3487 100644 --- a/src/edit_tests.cxx +++ b/src/edit_tests.cxx @@ -350,7 +350,11 @@ void edit_test005a( ){ assertTrue( p->isinstance() ); std::vector alt3; +#if FOLIA_INT_VERSION < 221 assertNoThrow( alt3 = w->alternatives(PosAnnotation_t, pos_set) ); +#else + assertNoThrow( alt3 = w->alternatives(ElementType::PosAnnotation_t, pos_set) ); +#endif assertEqual( alt3.size(), 1 ); assertEqual( alt[0] , alt3[0] ); diff --git a/src/foliapy_tests.cxx b/src/foliapy_tests.cxx index 9335453..e16911d 100644 --- a/src/foliapy_tests.cxx +++ b/src/foliapy_tests.cxx @@ -132,11 +132,18 @@ void Test_E001_Tokens_Structure(){ { startTestSerie( "Simple Token & Structure Test - Declarations" ); assertTrue( doc.declared(AnnotationType::TOKEN) ); - assertTrue( doc.declared(Word_t) ); // same as above, resolves automatically assertTrue( doc.declared(AnnotationType::TEXT) ); +#if FOLIA_INT_VERSION < 221 + assertTrue( doc.declared(Word_t) ); // same as above, resolves automatically assertTrue( doc.declared(TextContent_t) ); //same as above, resolves automatically assertTrue( doc.declared(Sentence_t) ); assertTrue( doc.declared(Paragraph_t) ); +#else + assertTrue( doc.declared(ElementType::Word_t) ); // same as above, resolves automatically + assertTrue( doc.declared(ElementType::TextContent_t) ); //same as above, resolves automatically + assertTrue( doc.declared(ElementType::Sentence_t) ); + assertTrue( doc.declared(ElementType::Paragraph_t) ); +#endif } } diff --git a/src/foliatest.cxx b/src/foliatest.cxx index 31e2574..7130219 100644 --- a/src/foliatest.cxx +++ b/src/foliatest.cxx @@ -1129,8 +1129,13 @@ void query_test002(){ void query_test003(){ startTestSerie( " Find Words by annotation " ); vector words = { "de", "historisch", "wetenschap", "worden" }; +#if FOLIA_INT_VERSION < 221 vector >matches = qDoc.findwords( Pattern( words, LemmaAnnotation_t ) ); +#else + vector >matches = qDoc.findwords( Pattern( words, + ElementType::LemmaAnnotation_t ) ); +#endif assertEqual( matches.size(), 1 ); assertEqual( len(matches[0]), 4 ); @@ -1143,7 +1148,12 @@ void query_test003(){ void query_test004(){ startTestSerie( " Find Words using multiple patterns " ); Pattern p1( { "de", "historische", "*", "wordt" } ); +#if FOLIA_INT_VERSION < 221 Pattern p2( { "de", "historisch", "wetenschap", "worden" }, LemmaAnnotation_t ); +#else + Pattern p2( { "de", "historisch", "wetenschap", "worden" }, + ElementType::LemmaAnnotation_t ); +#endif list l; l.push_back( p1 ); l.push_back( p2 ); @@ -1270,8 +1280,13 @@ void query_test010b(){ void query_test011(){ startTestSerie( " Find Words by non existing annotation " ); vector words = { "bli", "bla", "blu" }; +#if FOLIA_INT_VERSION < 221 vector >matches = qDoc.findwords( Pattern(words, SenseAnnotation_t ) ); +#else + vector >matches = qDoc.findwords( Pattern(words, + ElementType::SenseAnnotation_t ) ); +#endif assertEqual( matches.size(), 0 ); } diff --git a/src/sanity_tests.cxx b/src/sanity_tests.cxx index 9f291bc..5bed6b4 100644 --- a/src/sanity_tests.cxx +++ b/src/sanity_tests.cxx @@ -235,7 +235,7 @@ void sanity_test009( ){ #if FOLIA_INT_VERSION < 221 assertTrue( isSubClass( PosAnnotation_t, AbstractTokenAnnotation_t ) ); #else - assertTrue( is_subtype( PosAnnotation_t, AbstractTokenAnnotation_t ) ); + assertTrue( is_subtype( ElementType::PosAnnotation_t, ElementType::AbstractTokenAnnotation_t ) ); #endif #if FOLIA_INT_VERSION <= 215 || FOLIA_INT_VERSION >= 219 bool test = isSubClass(); @@ -672,13 +672,14 @@ void sanity_test026a(){ startTestSerie(" Features " ); FoliaElement *w = sanityDoc["WR-P-E-J-0000000001.p.1.s.6.w.1"]; FoliaElement *pos = w->annotation(); -#if FOLIA_INT_VERSION <= 215 || FOLIA_INT_VERSION >= 219 +#if FOLIA_INT_VERSION <= 215 assertTrue( pos->isSubClass( AbstractTokenAnnotation_t ) ); #endif #if FOLIA_INT_VERSION < 221 assertTrue( isSubClass( pos->element_id(), AbstractTokenAnnotation_t ) ); #else - assertTrue( is_subtype( pos->element_id(), AbstractTokenAnnotation_t ) ); + assertTrue( pos->isSubClass() ); + assertTrue( is_subtype( pos->element_id(), ElementType::AbstractTokenAnnotation_t ) ); #endif assertTrue( pos->isinstance() ); assertTrue( pos->cls() == "WW(vd,prenom,zonder)" ); @@ -689,8 +690,8 @@ void sanity_test026a(){ assertFalse( isSubClass( features[0]->element_id(), Sentence_t ) ); assertTrue( isSubClass( features[0]->element_id(), Feature_t ) ); #else - assertFalse( is_subtype( features[0]->element_id(), Sentence_t ) ); - assertTrue( is_subtype( features[0]->element_id(), Feature_t ) ); + assertFalse( is_subtype( features[0]->element_id(), ElementType::Sentence_t ) ); + assertTrue( is_subtype( features[0]->element_id(), ElementType::Feature_t ) ); #endif assertTrue( features[0]->isinstance() ); assertTrue( features[0]->subset() == "head" ); @@ -777,7 +778,6 @@ void sanity_test030( ){ FoliaElement *w2= sanityDoc["WR-P-E-J-0000000001.p.1.s.6.w.31"]; assertTrue( w2->text() == "vierkante" ); assertTrue( w2->stricttext() == "vierkante" ); - } void sanity_test030b( ){ @@ -2105,7 +2105,7 @@ void sanity_test109( ){ #if FOLIA_INT_VERSION < 221 assertTrue( isSubClass( PosAnnotation_t, AbstractTokenAnnotation_t ) ); #else - assertTrue( is_subtype( PosAnnotation_t, AbstractTokenAnnotation_t ) ); + assertTrue( is_subtype( ElementType::PosAnnotation_t, ElementType::AbstractTokenAnnotation_t ) ); assertTrue( ( isSubClass() ) ); assertTrue( ( isSubClass() ) ); #endif