summaryrefslogtreecommitdiff
path: root/test/net
diff options
context:
space:
mode:
authorreger <reger18@arcor.de>2015-10-26 21:19:35 +0100
committerreger <reger18@arcor.de>2015-10-26 21:19:35 +0100
commitd223cf0ae4b5853841f141fec98590497798b1d5 (patch)
tree2e12d9da44ced4f4cab22cecc1f71610d544ee8a /test/net
parent2b775d5be6e0132d63383b611478d4a7f2d9f53e (diff)
adjust MediaWiki importer geo coordinate calculation
- allow lat/long 0.xxx - south / west assignment include test class
Diffstat (limited to 'test/net')
-rw-r--r--test/net/yacy/data/wiki/WikiCodeTest.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/net/yacy/data/wiki/WikiCodeTest.java b/test/net/yacy/data/wiki/WikiCodeTest.java
new file mode 100644
index 000000000..c4b75a511
--- /dev/null
+++ b/test/net/yacy/data/wiki/WikiCodeTest.java
@@ -0,0 +1,35 @@
+package net.yacy.data.wiki;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+
+public class WikiCodeTest {
+
+ /**
+ * test geo location metadata convert
+ */
+ @Test
+ public void testProcessMetadata() {
+ String[] testmeta = new String[]{
+ "{{coordinate|NS=52.205944|EW=0.117593|region=GB-CAM|type=landmark}}", // decimal N-E location
+ "{{coordinate|NS=43/50/29/N|EW=73/23/17/W|type=landmark|region=US-NY}}", // N-W location
+
+ "{{Coordinate |text=DMS |NS=50/7/49/N |EW=6/8/09/E |type=landmark |region=BE-WLG |name=Monument des trois Frontières}}",
+ "{{Coordinate |text=DMS |NS= 49.047169|EW=7.899148|region=DE-RP |type=landmark |name=Europadenkmal (Rheinland-Pfalz)}}",
+
+ "{{coordinate|NS=0.00000|EW=0.117593}}", // testing equator coord
+ "{{coordinate|NS=-10.00000|EW=-10.10000}}" // testing S-E location
+
+ };
+ WikiCode wc = new WikiCode();
+ for (int i = 0; i < testmeta.length; i++) {
+ String result = wc.transform("http://wiki:8080",testmeta[i]);
+ System.out.println(testmeta[i] + " --> " + result);
+ // simply check if replacement took place, if no coordinate recognized original string is just html encoded
+ assertFalse(result.contains("#124;")); // simple check - result not containing char code for "{",
+ assertFalse(result.contains("#125;")); // simple check - result not containing char code for "}"
+ }
+ }
+
+} \ No newline at end of file