aboutsummaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorLajos Koszti <ajnasz@ajnasz.hu>2012-04-06 12:10:24 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2012-04-06 12:11:16 (GMT)
commit7b6dc2ad72a4c4ecd20eddbfb6f1b4c3bd2a7024 (patch)
treec2a8f4aa658783c6454b7643ce2717acaa744101 /src/tests
parent5d56046b68635cea2c187e59a9d8c514e2d6bdb2 (diff)
downloadfluxbox_paul-7b6dc2ad72a4c4ecd20eddbfb6f1b4c3bd2a7024.zip
fluxbox_paul-7b6dc2ad72a4c4ecd20eddbfb6f1b4c3bd2a7024.tar.bz2
Allow percentage values for some Window commands
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/StringUtiltest.cc26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/tests/StringUtiltest.cc b/src/tests/StringUtiltest.cc
index b723eef..e5e8419 100644
--- a/src/tests/StringUtiltest.cc
+++ b/src/tests/StringUtiltest.cc
@@ -33,9 +33,9 @@
33using namespace std; 33using namespace std;
34using namespace FbTk; 34using namespace FbTk;
35 35
36void testStringtok() { 36void testStringtok() {
37 vector<string> ls; 37 vector<string> ls;
38 StringUtil::stringtok(ls, " arg1 arg2 \targ3\n arg4 arg5\t\t\t\targ6\n\n \n\n \t\t\narg7"); 38 StringUtil::stringtok(ls, " arg1 arg2 \targ3\n arg4 arg5\t\t\t\targ6\n\n \n\n \t\t\narg7");
39 cerr<<"Size: "<<ls.size()<<". Should be: 7."<<endl; 39 cerr<<"Size: "<<ls.size()<<". Should be: 7."<<endl;
40 for (vector<string>::const_iterator i = ls.begin(); 40 for (vector<string>::const_iterator i = ls.begin();
41 i != ls.end(); ++i) { 41 i != ls.end(); ++i) {
@@ -66,7 +66,7 @@ void testStrcasestr() {
66 cerr<<"ok."<<endl; 66 cerr<<"ok."<<endl;
67 else 67 else
68 cerr<<"faild."<<endl; 68 cerr<<"faild."<<endl;
69 69
70 cerr<<"test3 "; 70 cerr<<"test3 ";
71 if (StringUtil::strcasestr("TeSt", "abcTEStabc") == strcasestr("TeSt", "abcTEStabc")) 71 if (StringUtil::strcasestr("TeSt", "abcTEStabc") == strcasestr("TeSt", "abcTEStabc"))
72 cerr<<"ok."<<endl; 72 cerr<<"ok."<<endl;
@@ -82,7 +82,7 @@ void testStrcasestr() {
82} 82}
83 83
84void showError(int line, int pos, string& instr) { 84void showError(int line, int pos, string& instr) {
85 85
86 cerr<<"Error on line: "<<line<<endl; 86 cerr<<"Error on line: "<<line<<endl;
87 cerr<<instr<<endl; 87 cerr<<instr<<endl;
88 for (int c=0; c<pos; c++) { 88 for (int c=0; c<pos; c++) {
@@ -91,8 +91,8 @@ void showError(int line, int pos, string& instr) {
91 else 91 else
92 cerr<<" "; 92 cerr<<" ";
93 } 93 }
94 cerr<<"^ here"<<endl; 94 cerr<<"^ here"<<endl;
95 95
96} 96}
97 97
98void testGetStringBetween() { 98void testGetStringBetween() {
@@ -101,7 +101,7 @@ void testGetStringBetween() {
101 stringlist.push_back(" \t\t\t \t[(in \\)\t haha )] \t\t "); 101 stringlist.push_back(" \t\t\t \t[(in \\)\t haha )] \t\t ");
102 stringlist.push_back("(in\\)) {_ _ my_ _}"); 102 stringlist.push_back("(in\\)) {_ _ my_ _}");
103 stringlist.push_back("(in) {_ _ my_ _}"); 103 stringlist.push_back("(in) {_ _ my_ _}");
104 stringlist.push_back("(in){_ _ my_ _}"); 104 stringlist.push_back("(in){_ _ my_ _}");
105 stringlist.push_back("\t \t \t ( in ) {haha}"); 105 stringlist.push_back("\t \t \t ( in ) {haha}");
106 stringlist.push_back("\t \t \t (( in \\) ) {haha}"); 106 stringlist.push_back("\t \t \t (( in \\) ) {haha}");
107 stringlist.push_back("\t \t \t (( in \\) ){hihi}"); 107 stringlist.push_back("\t \t \t (( in \\) ){hihi}");
@@ -116,17 +116,18 @@ void testGetStringBetween() {
116 cerr<<"string="<<stringlist[i]<<endl; 116 cerr<<"string="<<stringlist[i]<<endl;
117 cerr<<"pos="<<pos<<" ::"<<out; 117 cerr<<"pos="<<pos<<" ::"<<out;
118 total_pos += pos; 118 total_pos += pos;
119 pos = StringUtil::getStringBetween(out, stringlist[i].c_str()+total_pos, '{', '}'); 119 pos = StringUtil::getStringBetween(out, stringlist[i].c_str()+total_pos, '{', '}');
120 if (pos<=0) { 120 if (pos<=0) {
121 pos=-pos; 121 pos=-pos;
122 showError(i+1, total_pos+pos, stringlist[i]); 122 showError(i+1, total_pos+pos, stringlist[i]);
123 continue; 123 continue;
124 } 124 }
125 cerr<<"::"<<out<<"::"<<endl; 125 cerr<<"::"<<out<<"::"<<endl;
126 total_pos += pos; 126 total_pos += pos;
127 } 127 }
128} 128}
129int main() { 129
130int main() {
130 try { 131 try {
131 string replaceme = "something((((otherthanthis)could[be]changed"; 132 string replaceme = "something((((otherthanthis)could[be]changed";
132 133
@@ -140,13 +141,10 @@ int main() {
140 } catch (std::exception & e) { 141 } catch (std::exception & e) {
141 cerr<<"exception: "<<e.what()<<endl; 142 cerr<<"exception: "<<e.what()<<endl;
142 } 143 }
143 cerr<<"Testing stringtok."<<endl; 144 cerr<<"Testing stringtok."<<endl;
144 testStringtok(); 145 testStringtok();
145 cerr<<"Testing expandFilename."<<endl; 146 cerr<<"Testing expandFilename."<<endl;
146 testExpandFilename(); 147 testExpandFilename();
147 cerr<<"Testing strcasestr."<<endl; 148 cerr<<"Testing strcasestr."<<endl;
148 testStrcasestr(); 149 testStrcasestr();
149
150
151
152} 150}