Revision: 9414
http://languagetool.svn.sourceforge.net/languagetool/?rev=9414&view=rev
Author: dnaber
Date: 2013-02-17 23:11:22 +0000 (Sun, 17 Feb 2013)
Log Message:
-----------
re-add more tests from pre-Maven days, now split up so that they are now in the
language module they belong to + a generic part in standalone module
Added Paths:
-----------
trunk/languagetool/languagetool-language-modules/de/src/test/java/org/languagetool/rules/de/GenericUnpairedBracketsRuleTest.java
trunk/languagetool/languagetool-language-modules/es/src/test/java/org/languagetool/rules/es/GenericUnpairedBracketsRuleTest.java
trunk/languagetool/languagetool-language-modules/fr/src/test/java/org/languagetool/rules/fr/GenericUnpairedBracketsRuleTest.java
trunk/languagetool/languagetool-language-modules/nl/src/test/java/org/languagetool/rules/nl/GenericUnpairedBracketsRuleTest.java
trunk/languagetool/languagetool-language-modules/ro/src/test/java/org/languagetool/rules/ro/GenericUnpairedBracketsRuleTest.java
trunk/languagetool/languagetool-standalone/src/test/java/org/languagetool/rules/GenericUnpairedBracketsRuleTest.java
Copied:
trunk/languagetool/languagetool-language-modules/de/src/test/java/org/languagetool/rules/de/GenericUnpairedBracketsRuleTest.java
(from rev 9047,
trunk/JLanguageTool/src/test/java/org/languagetool/rules/GenericUnpairedBracketsRuleTest.java)
===================================================================
---
trunk/languagetool/languagetool-language-modules/de/src/test/java/org/languagetool/rules/de/GenericUnpairedBracketsRuleTest.java
(rev 0)
+++
trunk/languagetool/languagetool-language-modules/de/src/test/java/org/languagetool/rules/de/GenericUnpairedBracketsRuleTest.java
2013-02-17 23:11:22 UTC (rev 9414)
@@ -0,0 +1,58 @@
+/* LanguageTool, a natural language style checker
+ * Copyright (C) 2008 Daniel Naber (http://www.danielnaber.de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+package org.languagetool.rules.de;
+
+import junit.framework.TestCase;
+import org.languagetool.JLanguageTool;
+import org.languagetool.Language;
+import org.languagetool.TestTools;
+import org.languagetool.language.German;
+import org.languagetool.rules.GenericUnpairedBracketsRule;
+import org.languagetool.rules.RuleMatch;
+
+import java.io.IOException;
+
+public class GenericUnpairedBracketsRuleTest extends TestCase {
+
+ private GenericUnpairedBracketsRule rule;
+ private JLanguageTool langTool;
+
+ public void testGermanRule() throws IOException {
+ setUpRule(new German());
+ // correct sentences:
+ assertMatches("(Das sind die Sätze, die sie testen sollen).", 0);
+ assertMatches("(Das sind die «Sätze», die sie testen sollen).", 0);
+ assertMatches("(Das sind die »Sätze«, die sie testen sollen).", 0);
+ assertMatches("(Das sind die Sätze (noch mehr Klammern [schon wieder!]),
die sie testen sollen).", 0);
+ // incorrect sentences:
+ assertMatches("Die „Sätze zum Testen.", 1);
+ assertMatches("Die «Sätze zum Testen.", 1);
+ assertMatches("Die »Sätze zum Testen.", 1);
+ }
+
+ private void setUpRule(Language language) throws IOException {
+ rule = new GenericUnpairedBracketsRule(TestTools.getEnglishMessages(),
language);
+ langTool = new JLanguageTool(language);
+ }
+
+ private void assertMatches(String input, int expectedMatches) throws
IOException {
+ final RuleMatch[] matches =
rule.match(langTool.getAnalyzedSentence(input));
+ assertEquals(expectedMatches, matches.length);
+ }
+}
Copied:
trunk/languagetool/languagetool-language-modules/es/src/test/java/org/languagetool/rules/es/GenericUnpairedBracketsRuleTest.java
(from rev 9047,
trunk/JLanguageTool/src/test/java/org/languagetool/rules/GenericUnpairedBracketsRuleTest.java)
===================================================================
---
trunk/languagetool/languagetool-language-modules/es/src/test/java/org/languagetool/rules/es/GenericUnpairedBracketsRuleTest.java
(rev 0)
+++
trunk/languagetool/languagetool-language-modules/es/src/test/java/org/languagetool/rules/es/GenericUnpairedBracketsRuleTest.java
2013-02-17 23:11:22 UTC (rev 9414)
@@ -0,0 +1,54 @@
+/* LanguageTool, a natural language style checker
+ * Copyright (C) 2008 Daniel Naber (http://www.danielnaber.de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+package org.languagetool.rules.es;
+
+import junit.framework.TestCase;
+import org.languagetool.JLanguageTool;
+import org.languagetool.Language;
+import org.languagetool.TestTools;
+import org.languagetool.language.Spanish;
+import org.languagetool.rules.GenericUnpairedBracketsRule;
+import org.languagetool.rules.RuleMatch;
+
+import java.io.IOException;
+
+public class GenericUnpairedBracketsRuleTest extends TestCase {
+
+ private GenericUnpairedBracketsRule rule;
+ private JLanguageTool langTool;
+
+ public void testSpanishRule() throws IOException {
+ setUpRule(new Spanish());
+ // correct sentences:
+ assertMatches("Soy un hombre (muy honrado).", 0);
+ // incorrect sentences:
+ assertMatches("De dónde vas?", 1);
+ assertMatches("¡Atención", 1);
+ }
+
+ private void setUpRule(Language language) throws IOException {
+ rule = new GenericUnpairedBracketsRule(TestTools.getEnglishMessages(),
language);
+ langTool = new JLanguageTool(language);
+ }
+
+ private void assertMatches(String input, int expectedMatches) throws
IOException {
+ final RuleMatch[] matches =
rule.match(langTool.getAnalyzedSentence(input));
+ assertEquals(expectedMatches, matches.length);
+ }
+}
Copied:
trunk/languagetool/languagetool-language-modules/fr/src/test/java/org/languagetool/rules/fr/GenericUnpairedBracketsRuleTest.java
(from rev 9047,
trunk/JLanguageTool/src/test/java/org/languagetool/rules/GenericUnpairedBracketsRuleTest.java)
===================================================================
---
trunk/languagetool/languagetool-language-modules/fr/src/test/java/org/languagetool/rules/fr/GenericUnpairedBracketsRuleTest.java
(rev 0)
+++
trunk/languagetool/languagetool-language-modules/fr/src/test/java/org/languagetool/rules/fr/GenericUnpairedBracketsRuleTest.java
2013-02-17 23:11:22 UTC (rev 9414)
@@ -0,0 +1,53 @@
+/* LanguageTool, a natural language style checker
+ * Copyright (C) 2008 Daniel Naber (http://www.danielnaber.de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+package org.languagetool.rules.fr;
+
+import junit.framework.TestCase;
+import org.languagetool.JLanguageTool;
+import org.languagetool.Language;
+import org.languagetool.TestTools;
+import org.languagetool.language.French;
+import org.languagetool.rules.GenericUnpairedBracketsRule;
+import org.languagetool.rules.RuleMatch;
+
+import java.io.IOException;
+
+public class GenericUnpairedBracketsRuleTest extends TestCase {
+
+ private GenericUnpairedBracketsRule rule;
+ private JLanguageTool langTool;
+
+ public void testFrenchRule() throws IOException {
+ setUpRule(new French());
+ // correct sentences:
+ assertMatches("(Qu'est ce que c'est ?)", 0);
+ // incorrect sentences:
+ assertMatches("(Qu'est ce que c'est ?", 1);
+ }
+
+ private void setUpRule(Language language) throws IOException {
+ rule = new GenericUnpairedBracketsRule(TestTools.getEnglishMessages(),
language);
+ langTool = new JLanguageTool(language);
+ }
+
+ private void assertMatches(String input, int expectedMatches) throws
IOException {
+ final RuleMatch[] matches =
rule.match(langTool.getAnalyzedSentence(input));
+ assertEquals(expectedMatches, matches.length);
+ }
+}
Copied:
trunk/languagetool/languagetool-language-modules/nl/src/test/java/org/languagetool/rules/nl/GenericUnpairedBracketsRuleTest.java
(from rev 9047,
trunk/JLanguageTool/src/test/java/org/languagetool/rules/GenericUnpairedBracketsRuleTest.java)
===================================================================
---
trunk/languagetool/languagetool-language-modules/nl/src/test/java/org/languagetool/rules/nl/GenericUnpairedBracketsRuleTest.java
(rev 0)
+++
trunk/languagetool/languagetool-language-modules/nl/src/test/java/org/languagetool/rules/nl/GenericUnpairedBracketsRuleTest.java
2013-02-17 23:11:22 UTC (rev 9414)
@@ -0,0 +1,57 @@
+/* LanguageTool, a natural language style checker
+ * Copyright (C) 2008 Daniel Naber (http://www.danielnaber.de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+package org.languagetool.rules.nl;
+
+import junit.framework.TestCase;
+import org.languagetool.JLanguageTool;
+import org.languagetool.Language;
+import org.languagetool.TestTools;
+import org.languagetool.language.Dutch;
+import org.languagetool.rules.GenericUnpairedBracketsRule;
+import org.languagetool.rules.RuleMatch;
+
+import java.io.IOException;
+
+public class GenericUnpairedBracketsRuleTest extends TestCase {
+
+ private GenericUnpairedBracketsRule rule;
+ private JLanguageTool langTool;
+
+ public void testDutchRule() throws IOException {
+ setUpRule(new Dutch());
+ // correct sentences:
+ assertMatches("Het centrale probleem van het werk is de ‘dichterlijke
kuischheid’.", 0);
+ //this was a bug as there are several pairs that start with the same char:
+ assertMatches(" Eurlings: “De gegevens van de dienst zijn van cruciaal
belang voor de veiligheid van de luchtvaart en de scheepvaart”.", 0);
+ assertMatches(" Eurlings: \u201eDe gegevens van de dienst zijn van
cruciaal belang voor de veiligheid van de luchtvaart en de scheepvaart\u201d.",
0);
+ // incorrect sentences:
+ assertMatches("Het centrale probleem van het werk is de „dichterlijke
kuischheid.", 1);
+ assertMatches(" Eurlings: “De gegevens van de dienst zijn van cruciaal
belang voor de veiligheid van de luchtvaart en de scheepvaart.", 1);
+ }
+
+ private void setUpRule(Language language) throws IOException {
+ rule = new GenericUnpairedBracketsRule(TestTools.getEnglishMessages(),
language);
+ langTool = new JLanguageTool(language);
+ }
+
+ private void assertMatches(String input, int expectedMatches) throws
IOException {
+ final RuleMatch[] matches =
rule.match(langTool.getAnalyzedSentence(input));
+ assertEquals(expectedMatches, matches.length);
+ }
+}
Copied:
trunk/languagetool/languagetool-language-modules/ro/src/test/java/org/languagetool/rules/ro/GenericUnpairedBracketsRuleTest.java
(from rev 9047,
trunk/JLanguageTool/src/test/java/org/languagetool/rules/GenericUnpairedBracketsRuleTest.java)
===================================================================
---
trunk/languagetool/languagetool-language-modules/ro/src/test/java/org/languagetool/rules/ro/GenericUnpairedBracketsRuleTest.java
(rev 0)
+++
trunk/languagetool/languagetool-language-modules/ro/src/test/java/org/languagetool/rules/ro/GenericUnpairedBracketsRuleTest.java
2013-02-17 23:11:22 UTC (rev 9414)
@@ -0,0 +1,67 @@
+/* LanguageTool, a natural language style checker
+ * Copyright (C) 2008 Daniel Naber (http://www.danielnaber.de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+package org.languagetool.rules.ro;
+
+import junit.framework.TestCase;
+import org.languagetool.JLanguageTool;
+import org.languagetool.Language;
+import org.languagetool.TestTools;
+import org.languagetool.language.Romanian;
+import org.languagetool.rules.GenericUnpairedBracketsRule;
+import org.languagetool.rules.RuleMatch;
+
+import java.io.IOException;
+
+public class GenericUnpairedBracketsRuleTest extends TestCase {
+
+ private GenericUnpairedBracketsRule rule;
+ private JLanguageTool langTool;
+
+ public void testRomanianRule() throws IOException {
+ setUpRule(new Romanian());
+ // correct sentences:
+ assertMatches("A fost plecat (pentru puțin timp).", 0);
+ assertMatches("Nu's de prin locurile astea.", 0);
+ assertMatches("A fost plecat pentru „puțin timp”.", 0);
+ assertMatches("A fost plecat „pentru... puțin timp”.", 0);
+ assertMatches("A fost plecat „pentru... «puțin» timp”.", 0);
+ // correct sentences ( " is _not_ a Romanian symbol - just
+ // ignore it, the correct form is [„] (start quote) and [”] (end quote)
+ assertMatches("A fost plecat \"pentru puțin timp.", 0);
+ // incorrect sentences:
+ assertMatches("A fost )plecat( pentru (puțin timp).", 2);
+ assertMatches("A fost {plecat) pentru (puțin timp}.", 4);
+ assertMatches("A fost plecat „pentru... puțin timp.", 1);
+ assertMatches("A fost plecat «puțin.", 1);
+ assertMatches("A fost plecat „pentru «puțin timp”.", 3);
+ assertMatches("A fost plecat „pentru puțin» timp”.", 3);
+ assertMatches("A fost plecat „pentru... puțin» timp”.", 3);
+ assertMatches("A fost plecat „pentru... «puțin” timp».", 4);
+ }
+
+ private void setUpRule(Language language) throws IOException {
+ rule = new GenericUnpairedBracketsRule(TestTools.getEnglishMessages(),
language);
+ langTool = new JLanguageTool(language);
+ }
+
+ private void assertMatches(String input, int expectedMatches) throws
IOException {
+ final RuleMatch[] matches =
rule.match(langTool.getAnalyzedSentence(input));
+ assertEquals(expectedMatches, matches.length);
+ }
+}
Copied:
trunk/languagetool/languagetool-standalone/src/test/java/org/languagetool/rules/GenericUnpairedBracketsRuleTest.java
(from rev 9047,
trunk/JLanguageTool/src/test/java/org/languagetool/rules/GenericUnpairedBracketsRuleTest.java)
===================================================================
---
trunk/languagetool/languagetool-standalone/src/test/java/org/languagetool/rules/GenericUnpairedBracketsRuleTest.java
(rev 0)
+++
trunk/languagetool/languagetool-standalone/src/test/java/org/languagetool/rules/GenericUnpairedBracketsRuleTest.java
2013-02-17 23:11:22 UTC (rev 9414)
@@ -0,0 +1,36 @@
+/* LanguageTool, a natural language style checker
+ * Copyright (C) 2008 Daniel Naber (http://www.danielnaber.de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+package org.languagetool.rules;
+
+import junit.framework.TestCase;
+import org.languagetool.Language;
+
+import java.io.IOException;
+
+public class GenericUnpairedBracketsRuleTest extends TestCase {
+
+ public void testStartSymbolCountEqualsEndSymbolCount() throws IOException {
+ for (Language language : Language.LANGUAGES) {
+ final int startSymbols = language.getUnpairedRuleStartSymbols().length;
+ final int endSymbols = language.getUnpairedRuleEndSymbols().length;
+ assertEquals("Different number of start and end symbols for " +
language, startSymbols, endSymbols);
+ }
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet,
is your hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials, tech docs,
whitepapers, evaluation guides, and opinion stories. Check out the most
recent posts - join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Languagetool-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/languagetool-commits