From dcdefcf8bd955a92a312dc2c40eb48210a48011a Mon Sep 17 00:00:00 2001 From: methodus Date: Sun, 16 Sep 2012 14:23:23 +0200 Subject: Fixed some bugs in the SortCriteria parser. --- tests/test_parser.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests/test_parser.cpp') diff --git a/tests/test_parser.cpp b/tests/test_parser.cpp index 8e3053a..ec455bc 100644 --- a/tests/test_parser.cpp +++ b/tests/test_parser.cpp @@ -8,6 +8,18 @@ #include "../include/parser.h" #include +void checkSort(string s){ + + upnp::cSortCriteria::SortCriteriaList list = upnp::cSortCriteria::parse(s); + + cout << "Sort: \"" << s << "\"" << endl; + for(upnp::cSortCriteria::SortCriteriaList::iterator it = list.begin(); it != list.end(); ++it){ + cout << " " << (*it).property << " " <<((*it).sortDescending ? "DESC" : "ASC") << endl; + } + cout << endl; + +} + void checkSearch(string t, string e) { string r = upnp::cSearch::parse(t); @@ -50,5 +62,15 @@ int main(){ checkFilter("@id,dc:title,upnp:longDescription,res"); + checkSort(""); + + checkSort("+dc:title,-dc:creator"); + + checkSort("dc:title"); + + checkSort("+upnp:class"); + + checkSort("+@id"); + return 0; } -- cgit v1.2.3