Skip to content

Commit

Permalink
Merge branch 'master' into PROPS
Browse files Browse the repository at this point in the history
  • Loading branch information
kosloot committed May 8, 2024
2 parents add603e + b7c8b2a commit 4ee3e65
Show file tree
Hide file tree
Showing 24 changed files with 496 additions and 31 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Delete old workflow runs
on:
schedule:
- cron: '0 1 1 * *'
# Run monthly, at 01:00 on the 1st day of month. (testing)
- cron: '0 15 2 * *'
# Run monthly, at 15:00 on the 2t day of month.

jobs:
del_runs:
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/foliatest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,28 @@ jobs:
needs: notification
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-14]
compiler: [g++, clang++]

steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v3
- uses: actions/checkout@v4.1.1

- name: Install Build Environment
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get install pkg-config autoconf-archive
else
brew upgrade;
brew install pkg-config;
brew install autoconf-archive;
brew install autoconf;
brew install automake;
brew install pkg-config
brew install libtool
brew install autoconf-archive
brew install autoconf
brew install automake
fi
- name: Install Dependencies
run: |
Expand Down
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
foliatest 0.12 2021-07-12
[Ko van der Sloot]
* added and improved numerous tests upto libfolia 2.18

foliatest 0.11 2021-07-12
[Ko van der Sloot]
* added tests for newer Correction handling in FoLiA
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# Foliatest

(c) CLST/TiCC/CLiPS 2021
(c) CLST/TiCC/CLiPS 2024
https://github.com/LanguageMachines/foliatest

Centre for Language and Speech Technology, Radboud University Nijmegen
Expand Down
22 changes: 12 additions & 10 deletions bootstrap.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

# bootstrap - script to bootstrap the distribution rolling engine

# usage:
Expand Down Expand Up @@ -38,7 +40,7 @@ aclocal=aclocal
# inspired by hack as used in mcl (from http://micans.org/)

# autoconf-archive Debian package, aclocal-archive RPM, obsolete/badly supported OS, installed in home dir
acdirs="/usr/share/autoconf-archive/ /usr/share/aclocal/ /usr/local/share/aclocal/ $HOME/local/share/autoconf-archive/"
acdirs="/usr/share/autoconf-archive/ /usr/share/aclocal/ /usr/local/share/aclocal/ $HOME/local/share/autoconf-archive/ /opt/homebrew/share/aclocal/"

found=false
for d in $acdirs
Expand All @@ -61,27 +63,27 @@ EOT
fi


if $automake --version|head -1 |grep ' 1\.[4-9]'; then
echo "automake 1.4-1.8 is active. You should use automake 1.10 or later"
if $automake --version|head -1 |grep ' 1\.[4-8]'; then
echo "automake 1.4-1.8 is active. You should use automake 1.9 or later"
if test -f /etc/debian_version; then
echo " sudo apt-get install automake1.10"
echo " sudo apt-get install automake1.9"
echo " sudo update-alternatives --config automake"
fi
exit 1
fi

if $aclocal --version|head -1 |grep ' 1\.[4-9]'; then
echo "aclocal 1.4-1.8 is active. You should use aclocal 1.10 or later"
if $aclocal --version|head -1 |grep ' 1\.[4-8]'; then
echo "aclocal 1.4-1.8 is active. You should use aclocal 1.9 or later"
if test -f /etc/debian_version; then
echo " sudo apt-get install aclocal1.10"
echo " sudo apt-get install aclocal1.9"
echo " sudo update-alternatives --config aclocal"
fi
exit 1
fi

# Debian automake package installs as automake-version. Use this
# to make sure the right automake is being used.
# if not installed, use: apt-get install automake1.10
# if not installed, use: apt-get install automake1.9

AUTOMAKE=automake ACLOCAL=aclocal autoreconf --install \
--symlink
Expand All @@ -90,6 +92,6 @@ AUTOMAKE=automake ACLOCAL=aclocal autoreconf --install \

# autoreconf should run something like:
#
# aclocal-1.10 \
# && automake-1.10 --add-missing --verbose --gnu \
# aclocal-1.9 \
# && automake-1.9 --add-missing --verbose --gnu \
# && autoconf
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
AC_INIT([foliatest],[0.12],[lamasoftware@science.ru.nl])
AC_INIT([foliatest],[0.13],[lamasoftware@science.ru.nl])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_MACRO_DIR([m4])
Expand Down
18 changes: 15 additions & 3 deletions m4/ac_osx_pkg.m4
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# osx_pkg.m4 - Macros to add OSX brew locations to pkg-config. -*- Autoconf -*-
# serial 1 (pkg-config-0.24)
# serial 2 (pkg-config-0.24)
#
# Copyright © 2018 Ko van der Sloot <K.vanderSloot@let.ru.nl>
# Copyright © 2024 Ko van der Sloot <K.vanderSloot@let.ru.nl>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -40,6 +40,13 @@ case ${host_os} in
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/$i/lib/pkgconfig"
fi
done
for i in `ls /opt/homewbrew/opt`
do
if test -d "/opt/homebrew/opt/$i/lib/pkgconfig"
then
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/opt/homebrew/opt/$i/lib/pkgconfig"
fi
done
;;
esac
])
Expand All @@ -55,12 +62,17 @@ case ${host_os} in
# linux is wellbehaved
;;
darwin*)
# darwin isn't
# darwin/mac0s isn't
for i in $*
do
if test -d "/usr/local/opt/$i/lib/pkgconfig"
then
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/$i/lib/pkgconfig"
else
if test -d "/opt/homebrew/opt//$i/lib/pkgconfig"
then
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/opt/homebrew/opt/$i/lib/pkgconfig"
fi
fi
done
;;
Expand Down
2 changes: 1 addition & 1 deletion src/edit_tests.cxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2006 - 2020
Copyright (c) 2006 - 2024
CLST - Radboud University
ILK - Tilburg University
Expand Down
4 changes: 2 additions & 2 deletions src/engine_tests.cxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2006 - 2020
Copyright (c) 2006 - 2024
CLST - Radboud University
ILK - Tilburg University
Expand Down Expand Up @@ -681,8 +681,8 @@ void engine_test012() {

void engine_test013() {
startTestSerie( " Test reading of a file with PI's" );
string path = "tests/PI.xml";
#if FOLIA_INT_VERSION >= 216
string path = "tests/PI.xml";
{
Engine proc;
// proc.set_debug(true);
Expand Down
2 changes: 1 addition & 1 deletion src/foliapy_tests.cxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2006 - 2020
Copyright (c) 2006 - 2024
CLST - Radboud University
ILK - Tilburg University
Expand Down
67 changes: 66 additions & 1 deletion src/foliatest.cxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2006 - 2020
Copyright (c) 2006 - 2024
CLST - Radboud University
ILK - Tilburg University
Expand Down Expand Up @@ -407,6 +407,7 @@ extern void sanity_test140();
extern void sanity_test141();
extern void sanity_test150();
extern void sanity_test151();
extern void sanity_test152();

extern void Test_E001_Tokens_Structure();
extern void Test_Exxx_Hidden_Tokens();
Expand Down Expand Up @@ -480,6 +481,7 @@ extern void text_test19a();
extern void text_test19b();
extern void text_test20();
extern void text_test21();
extern void text_test22();

extern void engine_test001a();
extern void engine_test001b();
Expand Down Expand Up @@ -997,6 +999,63 @@ void correction_test008b(){
"<correction xmlns=\"http://ilk.uvt.nl/folia\" xml:id=\"WR-P-E-J-0000000001.p.1.s.6.w.31.correction.1\" annotator=\"testscript\"><new><t>ronde</t></new><original auth=\"no\"><correction xml:id=\"WR-P-E-J-0000000001.p.1.s.6.w.31.c.1\"><new><t>vierkante</t></new><original auth=\"no\"><t>vierkant</t></original></correction></original></correction>" );
}

void correction_test009a(){
startTestSerie( " Correction - don't accept invalid corrections" );
#if FOLIA_INT_VERSION >= 218
assertThrow( Document cor_doc( "tests/invalid_corr.xml" ), XmlError );
assertThrow( Document cor_doc( "tests/invalid_corr_2.xml" ), XmlError );
#else
Document cor_doc;
assertNoThrow( cor_doc.read_from_file( "tests/invalid_corr.xml" ) );
assertNoThrow( cor_doc.read_from_file( "tests/invalid_corr_2.xml" ) );
#endif
}

void correction_test009b(){
startTestSerie( " Correction - invalid creation of correction" );
Document cor_doc( "tests/examplev1.5.xml" );
FoliaElement *node = cor_doc["example.p.1.s.1.w.1"];
vector<PosAnnotation*> pV;
FoliaElement *pos = node->getPosAnnotations( "http://ilk.uvt.nl/folia/sets/frog-mbpos-cgn", pV );
vector<FoliaElement*> oV;
oV.push_back(pos);
vector<FoliaElement*> sV;
vector<FoliaElement*> cV;
vector<FoliaElement*> nV;
KWargs args;
args["xml:id"] = "BLA";
FoliaElement *sent = new Sentence( args );
nV.push_back(sent);
Correction *c;
#if FOLIA_INT_VERSION >= 218
assertThrow( c = node->correct( oV, cV, nV, sV, args ), XmlError );
#else
c = node->correct( oV, cV, nV, sV, args );
assertEqual( c->xmlstring(),
"<correction xmlns=\"http://ilk.uvt.nl/folia\" xml:id=\"example.p.1.s.1.w.1.correction.1\"><new><s xml:id=\"BLA\"/></new><original auth=\"no\"><pos class=\"WW(pv,tgw,ev)\" confidence=\"0.996196\" head=\"WW\"><feat class=\"pv\" subset=\"wvorm\"/><feat class=\"tgw\" subset=\"pvtijd\"/><feat class=\"ev\" subset=\"pvagr\"/></pos></original></correction>" );
#endif
}

void correction_test009c(){
startTestSerie( " Correction - accept complex corrections" );
{
Document cor_doc;
assertNoThrow( cor_doc.read_from_file( "tests/corrected_1.xml" ) );
}
{
Document cor_doc;
assertNoThrow( cor_doc.read_from_file( "tests/corrected_2.xml" ) );
}
{
Document cor_doc;
assertNoThrow( cor_doc.read_from_file( "tests/corrected_3.xml" ) );
}
{
Document cor_doc;
assertNoThrow( cor_doc.read_from_file( "tests/corrected_4.xml" ) );
}
}

Document qDoc( "file='tests/example.xml'" );

void query_test001(){
Expand Down Expand Up @@ -1447,6 +1506,7 @@ int main( int argc, char* argv[] ){
sanity_test141();
sanity_test150();
sanity_test151();
sanity_test152();
edit_test001a();
edit_test001b();
edit_test002();
Expand Down Expand Up @@ -1509,6 +1569,7 @@ int main( int argc, char* argv[] ){
text_test19b();
text_test20();
text_test21();
text_test22();
create_test001();
create_test002();
create_test003();
Expand All @@ -1524,6 +1585,9 @@ int main( int argc, char* argv[] ){
correction_test007();
correction_test008a();
correction_test008b();
correction_test009a();
correction_test009b();
correction_test009c();
query_test001();
query_test002();
query_test003();
Expand Down Expand Up @@ -1574,6 +1638,7 @@ int main( int argc, char* argv[] ){
whitespace_test008();
whitespace_test009();
whitespace_test010();
whitespace_test010b();
whitespace_test011();
whitespace_test012();
whitespace_test013();
Expand Down
14 changes: 13 additions & 1 deletion src/sanity_tests.cxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2006 - 2020
Copyright (c) 2006 - 2024
CLST - Radboud University
ILK - Tilburg University
Expand Down Expand Up @@ -2319,3 +2319,15 @@ void sanity_test151( ){
assertEqual( PIS[0]->content(), "content2A" );
#endif
}

void sanity_test152( ){
startTestSerie( " Reading a document with a lot of comment " );
Document d;
assertNoThrow( d.read_from_file( "tests/comment.xml" ) );
assertNoThrow( d.save( "/tmp/test152.xml", true ) );
#if FOLIA_INT_VERSION >= 218
int stat = system( "./tests/foliadiff.sh /tmp/test152.xml tests/comment.xml" );
assertMessage( "/tmp/test152.xml tests/comment.xml differ!",
(stat == 0) );
#endif
}
25 changes: 24 additions & 1 deletion src/text_tests.cxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2006 - 2020
Copyright (c) 2006 - 2024
CLST - Radboud University
ILK - Tilburg University
Expand Down Expand Up @@ -1442,3 +1442,26 @@ void text_test21(){
UnresolvableTextContent );
#endif
}

void text_test22(){
startTestSerie( "Validation - document with empty <t>" );
#if FOLIA_INT_VERSION >= 218
{
Document doc;
assertThrow( doc.read_from_file("tests/empty.xml"), XmlError );
}
#else
{
Document doc;
assertNoThrow( doc.read_from_file("tests/empty.xml" ) );
}
#endif
{
Document doc;
assertNoThrow( doc.read_from_file("tests/empty2.xml") );
}
{
Document doc;
assertNoThrow( doc.read_from_file("tests/empty3.xml") );
}
}
Loading

0 comments on commit 4ee3e65

Please sign in to comment.