summaryrefslogtreecommitdiffstats
path: root/tdeui/tests/kaccelgentest.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-06 15:56:40 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-06 15:56:40 -0600
commite16866e072f94410321d70daedbcb855ea878cac (patch)
treeee3f52eabde7da1a0e6ca845fb9c2813cf1558cf /tdeui/tests/kaccelgentest.cpp
parenta58c20c1a7593631a1b50213c805507ebc16adaf (diff)
downloadtdelibs-e16866e072f94410321d70daedbcb855ea878cac.tar.gz
tdelibs-e16866e072f94410321d70daedbcb855ea878cac.zip
Actually move the kde files that were renamed in the last commit
Diffstat (limited to 'tdeui/tests/kaccelgentest.cpp')
-rw-r--r--tdeui/tests/kaccelgentest.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/tdeui/tests/kaccelgentest.cpp b/tdeui/tests/kaccelgentest.cpp
new file mode 100644
index 000000000..f5f95ac57
--- /dev/null
+++ b/tdeui/tests/kaccelgentest.cpp
@@ -0,0 +1,51 @@
+#include "kaccelgen.h"
+
+#include <tqstringlist.h>
+
+#include <iostream>
+
+using std::cout;
+using std::endl;
+
+void check( const TQString &what, const TQStringList &expected, const TQStringList &received )
+{
+ cout << "Testing " << what.latin1() << ": ";
+ if ( expected == received ) {
+ cout << "ok" << endl;
+ } else {
+ cout << "ERROR!" << endl;
+ cout << "Expected: " << expected.join( "," ).latin1() << endl;
+ cout << "Received: " << received.join( "," ).latin1() << endl;
+ }
+}
+
+int main()
+{
+ TQStringList input;
+ input << "foo" << "bar item" << "&baz" << "bif" << "boz" << "boz 2"
+ << "yoyo && dyne";
+
+ TQStringList expected;
+ expected << "&foo" << "bar &item" << "&baz" << "bif" << "b&oz" << "boz &2"
+ << "&yoyo && dyne";
+
+ TQStringList output;
+ KAccelGen::generate( input, output );
+ check( "TQStringList value generation", expected, output );
+
+ TQMap<TQString,TQString> map;
+ for (TQStringList::ConstIterator it = input.begin(); it != input.end(); ++it) {
+ map.insert(*it, *it);
+ }
+ input.sort();
+ expected.clear();
+ KAccelGen::generate( input, expected );
+
+ output.clear();
+ KAccelGen::generateFromValues( map, output );
+ check( "map value generation", expected, output );
+
+ output.clear();
+ KAccelGen::generateFromKeys( map, output );
+ check( "map key generation", expected, output );
+}