summaryrefslogtreecommitdiff
path: root/tests/test_parser.cpp
diff options
context:
space:
mode:
authormethodus <methodus@web.de>2012-09-16 09:10:44 +0200
committermethodus <methodus@web.de>2012-09-16 09:10:44 +0200
commita24cf8ab2364600681fa7fb001a4c4cbc706a31a (patch)
tree411143876fc3071634874688ae082f043745f6eb /tests/test_parser.cpp
parentfb5c28b99ec95e6ca59899191e77af162cf96cbc (diff)
downloadvdr-plugin-upnp-a24cf8ab2364600681fa7fb001a4c4cbc706a31a.tar.gz
vdr-plugin-upnp-a24cf8ab2364600681fa7fb001a4c4cbc706a31a.tar.bz2
Tests für Parser hinzugefügt
Diffstat (limited to 'tests/test_parser.cpp')
-rw-r--r--tests/test_parser.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/test_parser.cpp b/tests/test_parser.cpp
new file mode 100644
index 0000000..68b2fb0
--- /dev/null
+++ b/tests/test_parser.cpp
@@ -0,0 +1,36 @@
+/*
+ * test_parser.cpp
+ *
+ * Created on: 16.09.2012
+ * Author: savop
+ */
+
+#include "../include/parser.h"
+#include <iostream>
+
+void checkSearch(string t, string e) {
+
+ string r = upnp::cSearch::parse(t);
+
+ cout << "Suche: \"" << t << "\"" << endl;
+ cout << "Erwartet: \"" << e << "\"" << endl;
+ cout << "Ergebnis: \"" << r << "\"" << endl;
+ cout << "-------> " << (e.compare(r) ? "FEHLGESCHLAGEN!" : "ERFOLGREICH!") << endl << endl;
+
+}
+
+int main(){
+ checkSearch("upnp:class = \"object.item.imageItem\" and ( dc:date >= \"2001-10-01\" and dc:date <= \"2001-10-31\" )",
+ "class == 'object.item.imageItem' AND ( date >= '2001-10-01' AND date <= '2001-10-31' ) ");
+
+ checkSearch("@id = \"20\"",
+ string());
+
+ checkSearch("dc:title contains \"Christmas\"",
+ "title LIKE '%Christmas%' ");
+
+ checkSearch("upnp:class derivedfrom \"object.container.album\"",
+ "class LIKE '%object.container.album%' ");
+
+ return 0;
+}