tizen 2.3 release
[framework/web/wearable/wrt-security.git] / tests / ace / TestSuite05.cpp
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16 /*
17  * @file    TestSuite05.cpp
18  * @author  unknown
19  * @version 1.0
20  * @brief   Test cases for Attribute class.
21  */
22
23 #include <iostream>
24 #include <list>
25 #include <set>
26 #include <string>
27 #include <memory>
28
29 #include <dpl/test/test_runner.h>
30
31 #include <ace/Attribute.h>
32 #include <ace-dao-ro/BaseAttribute.h>
33
34 #define TESTSUITE05(n) \
35 RUNNER_TEST(ts05_attr_tests_ ## n)
36
37 class AT : public Attribute {
38 public:
39     AT(std::string nm)
40       : Attribute(nm)
41     {}
42
43     static std::string* uriAuthorityStatic(const std::string *input) {
44         AT at("Micky");
45         return at.uriAuthority(input);
46     }
47
48     static std::string* uriHostStatic(const std::string *input) {
49         AT at("Pluto");
50         return at.uriHost(input);
51     }
52
53     static std::string* uriSchemeStatic(const std::string *input) {
54         AT at("Donald");
55         return at.uriScheme(input);
56     }
57
58     static std::string* uriSchemeAuthorityStatic(const std::string *input) {
59         AT at("Winnie the Pooh");
60         return at.uriSchemeAuthority(input);
61     }
62
63     static std::string* uriPathStatic(const std::string *input) {
64         AT at("Hannibal");
65         return at.uriPath(input);
66     }
67
68     static bool markTest(){
69         bool result = true;
70         for(int i =0; i<128; ++i){
71             if( i == '-' || i == '_' || i == '.'|| i == '!'|| i == '~' || i == '*' || i == '\'' || i == ')' || i == '(' ){
72                 if (!mark[i]){
73                     result = false;
74                     break;
75                 }
76             }
77             else{
78                 if(mark[i]){
79                     result =false;
80                     break;
81                 }
82             }
83         }
84         return result;
85     }
86
87     static bool digitTest(){
88         bool result = true;
89         for(int i =0; i<128; ++i){
90             if( i > 47 && i < 58 ){
91                 if (!digit[i]){
92                     result = false;
93                     break;
94                 }
95             }
96             else{
97                 if(digit[i]){
98                     result =false;
99                     break;
100                 }
101             }
102         }
103         return result;
104     }
105
106     static bool alphaTest(){
107         bool result = true;
108         for(int i =0; i<128; ++i){
109             if( ( i>64 && i<91 ) || ( i>96 && i<123  ) ) {
110                 if (!alpha[i]){
111                     result = false;
112                     break;
113                 }
114             }
115             else{
116                 if(alpha[i]){
117                     result =false;
118                     break;
119                 }
120             }
121         }
122         return result;
123     }
124
125     static bool isEscapedStatic(const char esc[3]) {
126         AT at("Swinka");
127         return at.isEscaped(esc);
128     }
129 };
130
131 bool assertEqual(const std::string * actual, const char * intended) {
132     if (actual == NULL || intended == NULL) {
133         if (intended == NULL && actual == NULL) {
134             return true;
135         }
136         else {
137             return false;
138         }
139     }
140
141     std::string temp(intended);
142
143     if (temp == *actual) {
144         return true;
145     }
146     else {
147         return false;
148     }
149 }
150
151 bool assertTrue(bool condition){
152     return condition;
153 }
154
155 bool assertFalse(bool condition){
156     return !condition;
157 }
158
159 RUNNER_TEST_GROUP_INIT(ACE_TEST_SUITE_05)
160
161 /*
162  * author: unknown
163  * test: ACE Engine
164  * description: testing uriAuthority method of Attribute class on
165  * "http://www.wp.pl" argument
166  * expect: "www.wp.pl"
167  */
168 TESTSUITE05(01_uriAuthority){
169     std::unique_ptr<std::string> outcome;
170     std::string query("http://www.wp.pl");
171     outcome.reset(AT::uriAuthorityStatic(&query));
172     RUNNER_ASSERT(assertEqual(outcome.get(), "www.wp.pl"));
173
174 }
175
176 /*
177  * author: unknown
178  * test: ACE Engine
179  * description: testing uriAuthority method of Attribute class on
180  * "http://authority?path/asdf" argument
181  * expect: "authority"
182  */
183 TESTSUITE05(02_uriAuthority){
184     std::unique_ptr<std::string> outcome;
185     std::string query("http://authority?path/asdf");
186     outcome.reset(AT::uriAuthorityStatic(&query));
187     RUNNER_ASSERT(assertEqual(outcome.get(), "authority"));
188
189 }
190
191 /*
192  * author: unknown
193  * test: ACE Engine
194  * description: testing uriAuthority method of Attribute class on
195  * "abcd" argument
196  * expect: ""
197  */
198 TESTSUITE05(03_uriAuthority){
199     std::unique_ptr<std::string> outcome;
200     std::string query("abcd"); //This should be interpreted as schema
201     outcome.reset(AT::uriAuthorityStatic(&query));
202     RUNNER_ASSERT(assertEqual(outcome.get(), ""));
203
204 }
205
206 /*
207  * author: unknown
208  * test: ACE Engine
209  * description: testing uriAuthority method of Attribute class on
210  * "http://authority/asdf" argument
211  * expect: "authority"
212  */
213 TESTSUITE05(04_uriAuthority){
214     std::unique_ptr<std::string> outcome;
215     std::string query("http://authority/asdf");
216     outcome.reset(AT::uriAuthorityStatic(&query));
217     RUNNER_ASSERT(assertEqual(outcome.get(), "authority"));
218
219 }
220
221 /*
222  * author: unknown
223  * test: ACE Engine
224  * description: testing uriAuthority method of Attribute class on
225  * "http://user@host:20?ds" argument
226  * expect: "user@host:20"
227  */
228 TESTSUITE05(05_uriAuthority){
229     std::unique_ptr<std::string> outcome;
230     std::string query("http://user@host:20?ds");
231     outcome.reset(AT::uriAuthorityStatic(&query));
232     RUNNER_ASSERT(assertEqual(outcome.get(), "user@host:20"));
233
234 }
235
236 /*
237  * author: unknown
238  * test: ACE Engine
239  * description: testing uriAuthority method of Attribute class on
240  * "http://hostname:23" argument
241  * expect: "hostname:23"
242  */
243 TESTSUITE05(06_uriAuthority){
244     std::unique_ptr<std::string> outcome;
245     std::string query("http://hostname:23");
246     outcome.reset(AT::uriAuthorityStatic(&query));
247     RUNNER_ASSERT(assertEqual(outcome.get(), "hostname:23"));
248
249 }
250
251 /*
252  * author: unknown
253  * test: ACE Engine
254  * description: testing uriAuthority method of Attribute class on
255  * "http://hostname:23" argument
256  * expect: "hostname:23"
257  */
258 TESTSUITE05(07_uriAuthority){
259     std::unique_ptr<std::string> outcome;
260     std::string query("http://user@host:port");
261     outcome.reset(AT::uriAuthorityStatic(&query));
262     RUNNER_ASSERT(assertEqual(outcome.get(), "user@host:port"));
263
264 }
265
266 /*
267  * author: unknown
268  * test: ACE Engine
269  * description: testing uriAuthority method of Attribute class on
270  * "http://1user@host:port" argument
271  * expect: "1user@host:port"
272  */
273 TESTSUITE05(08_uriAuthority){
274     std::unique_ptr<std::string> outcome;
275     std::string query("http://1user@host:port"); //This is a VALID URI
276     outcome.reset(AT::uriAuthorityStatic(&query));
277     RUNNER_ASSERT(assertEqual(outcome.get(), "1user@host:port"));
278
279 }
280
281 /*
282  * author: unknown
283  * test: ACE Engine
284  * description: testing uriAuthority method of Attribute class on
285  * "http://abc%30" argument
286  * expect: "abc%30"
287  */
288 TESTSUITE05(09_uriAuthority){
289     std::unique_ptr<std::string> outcome;
290     std::string query("http://abc%30"); //This is not a valid uri
291     outcome.reset(AT::uriAuthorityStatic(&query));
292     RUNNER_ASSERT(assertEqual(outcome.get(), "abc%30"));
293
294 }
295
296 /*
297  * author: unknown
298  * test: ACE Engine
299  * description: testing uriAuthority method of Attribute class on
300  * "http:///asd" argument (not a valid URI)
301  * expect: ""
302  */
303 TESTSUITE05(10_uriAuthority){
304     std::unique_ptr<std::string> outcome;
305     std::string query("http:///asd"); //This is not a valid uri
306     outcome.reset(AT::uriAuthorityStatic(&query));
307     RUNNER_ASSERT(assertEqual(outcome.get(), ""));
308
309 }
310
311 /*
312  * author: unknown
313  * test: ACE Engine
314  * description: testing uriAuthority method of Attribute class on
315  * "http://?asd" argument (not a valid URI)
316  * expect: ""
317  */
318 TESTSUITE05(11_uriAuthority){
319     std::unique_ptr<std::string> outcome;
320     std::string query("http://?asd"); //This is not a valid uri
321     outcome.reset(AT::uriAuthorityStatic(&query));
322     RUNNER_ASSERT(assertEqual(outcome.get(), ""));
323
324 }
325
326 /*
327  * author: unknown
328  * test: ACE Engine
329  * description: testing uriAuthority method of Attribute class on
330  * "http://%34%56%67%ab" argument
331  * expect: "%34%56%67%ab"
332  */
333 TESTSUITE05(12_uriAuthority){
334     std::unique_ptr<std::string> outcome;
335     std::string query("http://%34%56%67%ab");
336     outcome.reset(AT::uriAuthorityStatic(&query));
337     RUNNER_ASSERT(assertEqual(outcome.get(), "%34%56%67%ab"));
338
339 }
340
341 /*
342  * author: unknown
343  * test: ACE Engine
344  * description: testing uriAuthority method of Attribute class on
345  * "http://<>" argument (not a valid URI)
346  * expect: NULL
347  */
348 TESTSUITE05(13_uriAuthority){
349     std::unique_ptr<std::string> outcome;
350     std::string query("http://<>"); //This is not a valid uri
351     outcome.reset(AT::uriAuthorityStatic(&query));
352     RUNNER_ASSERT(assertEqual(outcome.get(), NULL));
353
354 }
355
356 /*
357  * author: unknown
358  * test: ACE Engine
359  * description: testing uriAuthority method of Attribute class on
360  * "http://\\/" argument (not a valid URI)
361  * expect: NULL
362  */
363 TESTSUITE05(14_uriAuthority){
364     std::unique_ptr<std::string> outcome;
365     std::string query("http://\\/"); //This is not a valid uri
366     outcome.reset(AT::uriAuthorityStatic(&query));
367     RUNNER_ASSERT(assertEqual(outcome.get(), NULL));
368
369 }
370
371 /*
372  * author: unknown
373  * test: ACE Engine
374  * description: testing uriHost method of Attribute class on
375  * "http://user@host:23" argument
376  * expect: "host"
377  */
378 TESTSUITE05(15_uriHost){
379     std::unique_ptr<std::string> outcome;
380     std::string query("http://user@host:23");
381     outcome.reset(AT::uriHostStatic(&query));
382     RUNNER_ASSERT(assertEqual(outcome.get(), "host"));
383
384 }
385
386 /*
387  * author: unknown
388  * test: ACE Engine
389  * description: testing uriHost method of Attribute class on
390  * "http://user@host:name" argument (not a valid URI)
391  * expect: ""
392  */
393 TESTSUITE05(16_uriHost){
394     std::unique_ptr<std::string> outcome;
395     std::string query("http://user@host:name"); //This is not a valid uri
396     outcome.reset(AT::uriHostStatic(&query));
397     RUNNER_ASSERT(assertEqual(outcome.get(), ""));
398
399 }
400
401 /*
402  * author: unknown
403  * test: ACE Engine
404  * description: testing uriHost method of Attribute class on
405  * "http::::" argument (not a valid URI)
406  * expect: ""
407  */
408 TESTSUITE05(17_uriHost){
409     std::unique_ptr<std::string> outcome;
410     std::string query("http::::"); //This is a valid uri
411     outcome.reset(AT::uriHostStatic(&query));
412     RUNNER_ASSERT(assertEqual(outcome.get(), ""));
413
414 }
415
416 /*
417  * author: unknown
418  * test: ACE Engine
419  * description: testing uriHost method of Attribute class on
420  * "..%%%." argument (not a valid URI)
421  * expect: NULL
422  */
423 TESTSUITE05(18_uriHost){
424     std::unique_ptr<std::string> outcome;
425     std::string query("..%%%."); //This is not a valid uri
426     outcome.reset(AT::uriHostStatic(&query));
427     RUNNER_ASSERT(assertEqual(outcome.get(), NULL));
428
429 }
430
431 /*
432  * author: unknown
433  * test: ACE Engine
434  * description: testing uriHost method of Attribute class on
435  * "ftp://abds.eu/fda" argument
436  * expect: "abds.eu"
437  */
438 TESTSUITE05(19_uriHost){
439     std::unique_ptr<std::string> outcome;
440     std::string query("ftp://abds.eu/fda");
441     outcome.reset(AT::uriHostStatic(&query));
442     RUNNER_ASSERT(assertEqual(outcome.get(), "abds.eu"));
443
444 }
445
446 /*
447  * author: unknown
448  * test: ACE Engine
449  * description: testing uriHost method of Attribute class on
450  * "abs%14ccc" argument
451  * expect: ""
452  */
453 TESTSUITE05(20_uriHost){
454     std::unique_ptr<std::string> outcome;
455     std::string query("abs%14ccc");
456     //This is a valid uri because it's interpreted as a path not a host
457     outcome.reset(AT::uriHostStatic(&query));
458     RUNNER_ASSERT(assertEqual(outcome.get(), ""));
459
460 }
461
462 /*
463  * author: unknown
464  * test: ACE Engine
465  * description: testing uriHost method of Attribute class on
466  * "http://abc@123.2.23.213:982" argument
467  * expect: "123.2.23.213"
468  */
469 TESTSUITE05(21_uriHost){
470     std::unique_ptr<std::string> outcome;
471     std::string query("http://abc@123.2.23.213:982");
472     outcome.reset(AT::uriHostStatic(&query));
473     RUNNER_ASSERT(assertEqual(outcome.get(), "123.2.23.213"));
474
475 }
476
477 /*
478  * author: unknown
479  * test: ACE Engine
480  * description: testing uriHost method of Attribute class on
481  * "http://abc@1233.2.23.213:982" argument
482  * expect: ""
483  */
484 TESTSUITE05(22_uriHost){
485     std::unique_ptr<std::string> outcome;
486     std::string query("http://abc@1233.2.23.213:982");
487     //Hostname is invalid, but uri is valid
488     outcome.reset(AT::uriHostStatic(&query));
489     RUNNER_ASSERT(assertEqual(outcome.get(), ""));
490
491 }
492
493 /*
494  * author: unknown
495  * test: ACE Engine
496  * description: testing uriHost method of Attribute class on
497  * "http://ab%23c@host" argument
498  * expect: "host"
499  */
500 TESTSUITE05(23_uriHost){
501     std::unique_ptr<std::string> outcome;
502     std::string query("http://ab%23c@host"); //Valid escaped characters
503     outcome.reset(AT::uriHostStatic(&query));
504     RUNNER_ASSERT(assertEqual(outcome.get(), "host"));
505
506 }
507
508 /*
509  * author: unknown
510  * test: ACE Engine
511  * description: testing uriHost method of Attribute class on
512  * "http://ab%23c@host%34" argument
513  * expect: ""
514  */
515 TESTSUITE05(24_uriHost){
516     std::unique_ptr<std::string> outcome;
517     std::string query("http://ab%23c@host%34"); //Invalid escaped characters in hostname
518     outcome.reset(AT::uriHostStatic(&query));
519     RUNNER_ASSERT(assertEqual(outcome.get(), ""));
520
521 }
522
523 /*
524  * author: unknown
525  * test: ACE Engine
526  * description: testing uriHost method of Attribute class on
527  * "http://ab%GGc@host" argument
528  * expect: NULL
529  */
530 TESTSUITE05(25_uriHost){
531     std::unique_ptr<std::string> outcome;
532     std::string query("http://ab%GGc@host"); //Wrong character %
533     outcome.reset(AT::uriHostStatic(&query));
534     RUNNER_ASSERT(assertEqual(outcome.get(), NULL));
535
536 }
537
538 /*
539  * author: unknown
540  * test: ACE Engine
541  * description: testing uriHost method of Attribute class on
542  * "http://www.example.pl" argument
543  * expect: "www.example.pl"
544  */
545 TESTSUITE05(26_uriHost){
546     std::unique_ptr<std::string> outcome;
547     std::string query("http://www.example.pl");
548     outcome.reset(AT::uriHostStatic(&query));
549     RUNNER_ASSERT(assertEqual(outcome.get(), "www.example.pl"));
550
551 }
552
553 /*
554  * author: unknown
555  * test: ACE Engine
556  * description: testing uriScheme method of Attribute class on
557  * "http://host" argument
558  * expect: "http"
559  */
560 TESTSUITE05(27_uriScheme){
561     std::unique_ptr<std::string> outcome;
562     std::string query("http://host");
563     outcome.reset(AT::uriSchemeStatic(&query));
564     RUNNER_ASSERT(assertEqual(outcome.get(), "http"));
565
566 }
567
568 /*
569  * author: unknown
570  * test: ACE Engine
571  * description: testing uriScheme method of Attribute class on
572  * "1http://host" argument
573  * expect: NULL
574  */
575 TESTSUITE05(28_uriScheme){
576     std::unique_ptr<std::string> outcome;
577     //Wrong character '1' in scheme , it's not an URI because two slashes are not acceptable
578     //in any other place than in separation between scheme and pat
579     std::string query("1http://host");
580     outcome.reset(AT::uriSchemeStatic(&query));
581     RUNNER_ASSERT(assertEqual(outcome.get(), NULL));
582
583 }
584
585 /*
586  * author: unknown
587  * test: ACE Engine
588  * description: testing uriScheme method of Attribute class on
589  * "ftp+a-fdf.ads://host" argument
590  * expect: "ftp+a-fdf.ads"
591  */
592 TESTSUITE05(29_uriScheme){
593     std::unique_ptr<std::string> outcome;
594     std::string query("ftp+a-fdf.ads://host");
595     outcome.reset(AT::uriSchemeStatic(&query));
596     RUNNER_ASSERT(assertEqual(outcome.get(), "ftp+a-fdf.ads"));
597
598 }
599
600 /*
601  * author: unknown
602  * test: ACE Engine
603  * description: testing uriScheme method of Attribute class on
604  * "+++://host" argument
605  * expect: NULL
606  */
607 TESTSUITE05(30_uriScheme){
608     std::unique_ptr<std::string> outcome;
609     //Scheme cannot start with plus, it's not an URI because two slashes are not acceptable
610     //in any other place than in separation between scheme and path
611     std::string query("+++://host");
612     outcome.reset(AT::uriSchemeStatic(&query));
613     RUNNER_ASSERT(assertEqual(outcome.get(), NULL));
614
615 }
616
617 /*
618  * author: unknown
619  * test: ACE Engine
620  * description: testing uriScheme method of Attribute class on
621  * "aaaac" argument
622  * expect: ""
623  */
624 TESTSUITE05(31_uriScheme){
625     std::unique_ptr<std::string> outcome;
626     std::string query("aaaac"); //It's a path not a scheme'a
627     outcome.reset(AT::uriSchemeStatic(&query));
628     RUNNER_ASSERT(assertEqual(outcome.get(), ""));
629
630 }
631
632 /*
633  * author: unknown
634  * test: ACE Engine
635  * description: testing uriScheme method of Attribute class on
636  * "ftpa%34fdfads://host" argument
637  * expect: NULL
638  */
639 TESTSUITE05(32_uriScheme){
640     std::unique_ptr<std::string> outcome;
641     //no escaped characters in schema, it's not an URI because two slashes are not acceptable
642     //in any other place than in separation between scheme and path
643     std::string query("ftpa%34fdfads://host");
644     outcome.reset(AT::uriSchemeStatic(&query));
645     RUNNER_ASSERT(assertEqual(outcome.get(), NULL));
646
647 }
648
649 /*
650  * author: unknown
651  * test: ACE Engine
652  * description: testing uriScheme method of Attribute class on
653  * "meaninglessstring://host%34" argument
654  * expect: "meaninglessstring"
655  */
656 TESTSUITE05(33_uriScheme){
657     std::unique_ptr<std::string> outcome;
658     //no escaped characters in schema, it's not an URI because two slashes are not acceptable
659     //in any other place than in separation between scheme and path
660     std::string query("meaninglessstring://host%34");
661     outcome.reset(AT::uriSchemeStatic(&query));
662     RUNNER_ASSERT(assertEqual(outcome.get(), "meaninglessstring"));
663
664 }
665
666 /*
667  * author: unknown
668  * test: ACE Engine
669  * description: testing uriScheme method of Attribute class on
670  * "meaninglessstring2://" argument
671  * expect: "meaninglessstring2"
672  */
673 TESTSUITE05(34_uriScheme){
674     std::unique_ptr<std::string> outcome;
675     std::string query("meaninglessstring2://");
676     outcome.reset(AT::uriSchemeStatic(&query));
677     RUNNER_ASSERT(assertEqual(outcome.get(), "meaninglessstring2"));
678
679 }
680
681 /*
682  * author: unknown
683  * test: ACE Engine
684  * description: testing uriScheme method of Attribute class on
685  * "http://www.samsung.com/ace/bondi#5" argument
686  * expect: "http"
687  */
688 TESTSUITE05(35_uriScheme){
689     std::unique_ptr<std::string> outcome;
690     std::string query("http://www.samsung.com/ace/bondi#5");
691     outcome.reset(AT::uriSchemeStatic(&query));
692     RUNNER_ASSERT(assertEqual(outcome.get(), "http"));
693
694 }
695
696 /*
697  * author: unknown
698  * test: ACE Engine
699  * description: testing uriScheme method of Attribute class on
700  * "www.samsung.com" argument
701  * expect: ""
702  */
703 TESTSUITE05(36_uriScheme){
704     std::unique_ptr<std::string> outcome;
705     std::string query("www.samsung.com");
706     outcome.reset(AT::uriSchemeStatic(&query));
707     RUNNER_ASSERT(assertEqual(outcome.get(), ""));
708
709 }
710
711 /*
712  * author: unknown
713  * test: ACE Engine
714  * description: testing uriSchemeAuthority method of Attribute class on
715  * "http://www.samsung.com" argument
716  * expect: "http://www.samsung.com"
717  */
718 TESTSUITE05(37_uriSchemeAuthority){
719     std::unique_ptr<std::string> outcome;
720     std::string query("http://www.samsung.com");
721     outcome.reset(AT::uriSchemeAuthorityStatic(&query));
722     RUNNER_ASSERT(assertEqual(outcome.get(), "http://www.samsung.com"));
723
724 }
725
726 /*
727  * author: unknown
728  * test: ACE Engine
729  * description: testing uriSchemeAuthority method of Attribute class on
730  * "ftp23://www.samsung.com/avc%23" argument
731  * expect: "ftp23://www.samsung.com"
732  */
733 TESTSUITE05(38_uriSchemeAuthority){
734     std::unique_ptr<std::string> outcome;
735     std::string query("ftp23://www.samsung.com/avc%23");
736     outcome.reset(AT::uriSchemeAuthorityStatic(&query));
737     RUNNER_ASSERT(assertEqual(outcome.get(), "ftp23://www.samsung.com"));
738
739 }
740
741 /*
742  * author: unknown
743  * test: ACE Engine
744  * description: testing uriSchemeAuthority method of Attribute class on
745  * "ftp++://anonymous@hostname:12/avc%23" argument
746  * expect: "ftp++://anonymous@hostname:12"
747  */
748 TESTSUITE05(39_uriSchemeAuthority){
749     std::unique_ptr<std::string> outcome;
750     std::string query("ftp++://anonymous@hostname:12/avc%23");
751     outcome.reset(AT::uriSchemeAuthorityStatic(&query));
752     RUNNER_ASSERT(assertEqual(outcome.get(), "ftp++://anonymous@hostname:12"));
753
754 }
755
756 /*
757  * author: unknown
758  * test: ACE Engine
759  * description: testing uriSchemeAuthority method of Attribute class on
760  * "32ftp://anonymous@hostname:12/avc%23" argument
761  * expect: NULL
762  */
763 TESTSUITE05(40_uriSchemeAuthority){
764     std::unique_ptr<std::string> outcome;
765     std::string query("32ftp://anonymous@hostname:12/avc%23");
766     outcome.reset(AT::uriSchemeAuthorityStatic(&query));
767     RUNNER_ASSERT(assertEqual(outcome.get(), NULL));
768
769 }
770
771 /*
772  * author: unknown
773  * test: ACE Engine
774  * description: testing uriSchemeAuthority method of Attribute class on
775  * "http://aaabbb?acd" argument
776  * expect: "http://aaabbb"
777  */
778 TESTSUITE05(41_uriSchemeAuthority){
779     std::unique_ptr<std::string> outcome;
780     std::string query("http://aaabbb?acd");
781     outcome.reset(AT::uriSchemeAuthorityStatic(&query));
782     RUNNER_ASSERT(assertEqual(outcome.get(), "http://aaabbb"));
783
784 }
785
786 /*
787  * author: unknown
788  * test: ACE Engine
789  * description: testing uriSchemeAuthority method of Attribute class on
790  * "http://aaabbb/acd;sdf;sdf" argument
791  * expect: "http://aaabbb"
792  */
793 TESTSUITE05(42_uriSchemeAuthority){
794     std::unique_ptr<std::string> outcome;
795     std::string query("http://aaabbb/acd;sdf;sdf");
796     outcome.reset(AT::uriSchemeAuthorityStatic(&query));
797     RUNNER_ASSERT(assertEqual(outcome.get(), "http://aaabbb"));
798
799 }
800
801 /*
802  * author: unknown
803  * test: ACE Engine
804  * description: testing uriPath method of Attribute class on
805  * "ftp://authority//invalidpath" argument
806  * expect: NULL
807  */
808 TESTSUITE05(43_uriPath){
809     std::unique_ptr<std::string> outcome;
810     std::string query("ftp://authority//invalidpath");
811     outcome.reset(AT::uriPathStatic(&query));
812     RUNNER_ASSERT(assertEqual(outcome.get(), NULL));
813
814 }
815
816 /*
817  * author: unknown
818  * test: ACE Engine
819  * description: testing uriPath method of Attribute class on
820  * "ftp://authority/validpath" argument
821  * expect: "validpath"
822  */
823 TESTSUITE05(44_uriPath){
824     std::unique_ptr<std::string> outcome;
825     std::string query("ftp://authority/validpath");
826     outcome.reset(AT::uriPathStatic(&query));
827     RUNNER_ASSERT(assertEqual(outcome.get(), "validpath"));
828
829 }
830
831 /*
832  * author: unknown
833  * test: ACE Engine
834  * description: testing uriPath method of Attribute class on
835  * "ftp://authority/validpath;param;param" argument
836  * expect: "validpath;param;param"
837  */
838 TESTSUITE05(45_uriPath){
839     std::unique_ptr<std::string> outcome;
840     std::string query("ftp://authority/validpath;param;param");
841     outcome.reset(AT::uriPathStatic(&query));
842     RUNNER_ASSERT(assertEqual(outcome.get(), "validpath;param;param"));
843
844 }
845
846 /*
847  * author: unknown
848  * test: ACE Engine
849  * description: testing uriPath method of Attribute class on
850  * "ftp://authority/validpath;param;param?query" argument
851  * expect: "validpath;param;param"
852  */
853 TESTSUITE05(46_uriPath){
854     std::unique_ptr<std::string> outcome;
855     std::string query("ftp://authority/validpath;param;param?query");
856     outcome.reset(AT::uriPathStatic(&query));
857     RUNNER_ASSERT(assertEqual(outcome.get(), "validpath;param;param"));
858
859 }
860
861 /*
862  * author: unknown
863  * test: ACE Engine
864  * description: testing uriPath method of Attribute class on
865  * "ftp://authority/validpath;?param;param?query" argument
866  * expect: "validpath;"
867  */
868 TESTSUITE05(47_uriPath){
869     std::unique_ptr<std::string> outcome;
870     std::string query("ftp://authority/validpath;?param;param?query");
871     outcome.reset(AT::uriPathStatic(&query));
872     RUNNER_ASSERT(assertEqual(outcome.get(), "validpath;"));
873
874 }
875
876 /*
877  * author: unknown
878  * test: ACE Engine
879  * description: testing uriPath method of Attribute class on
880  * "ftp://authority/validpath;param?;param?query" argument
881  * expect: "validpath;param"
882  */
883 TESTSUITE05(48_uriPath){
884     std::unique_ptr<std::string> outcome;
885     std::string query("ftp://authority/validpath;param?;param?query");
886     outcome.reset(AT::uriPathStatic(&query));
887     RUNNER_ASSERT(assertEqual(outcome.get(), "validpath;param"));
888
889 }
890
891 /*
892  * author: unknown
893  * test: ACE Engine
894  * description: testing uriPath method of Attribute class on
895  * "ftp://authority/valid:path?query" argument
896  * expect: "valid:path"
897  */
898 TESTSUITE05(49_uriPath){
899     std::unique_ptr<std::string> outcome;
900     std::string query("ftp://authority/valid:path?query");
901     outcome.reset(AT::uriPathStatic(&query));
902     RUNNER_ASSERT(assertEqual(outcome.get(), "valid:path"));
903
904 }
905
906 /*
907  * author: unknown
908  * test: ACE Engine
909  * description: testing uriPath method of Attribute class on
910  * "ftp://authority/:::" argument
911  * expect: ":::"
912  */
913 TESTSUITE05(50_uriPath){
914     std::unique_ptr<std::string> outcome;
915     std::string query("ftp://authority/:::");
916     outcome.reset(AT::uriPathStatic(&query));
917     RUNNER_ASSERT(assertEqual(outcome.get(), ":::"));
918
919 }
920
921 /*
922  * author: unknown
923  * test: ACE Engine
924  * description: testing uriPath method of Attribute class on
925  * "/path1/path2?abc#fragment" argument
926  * expect: "path1/path2"
927  */
928 TESTSUITE05(51_uriPath){
929     std::unique_ptr<std::string> outcome;
930     std::string query("/path1/path2?abc#fragment");
931     outcome.reset(AT::uriPathStatic(&query));
932     RUNNER_ASSERT(assertEqual(outcome.get(), "path1/path2"));
933
934 }
935
936 /*
937  * author: unknown
938  * test: ACE Engine
939  * description: testing uriPath method of Attribute class on
940  * "http://www.samsung.com/normalpath/path2?query" argument
941  * expect: "normalpath/path2"
942  */
943 TESTSUITE05(52_uriPath){
944     std::unique_ptr<std::string> outcome;
945     std::string query("http://www.samsung.com/normalpath/path2?query");
946     outcome.reset(AT::uriPathStatic(&query));
947     RUNNER_ASSERT(assertEqual(outcome.get(), "normalpath/path2"));
948
949 }
950
951 /*
952  * author: unknown
953  * test: ACE Engine
954  * description: testing if "mark" static table in Attribute class contains
955  * "true" on indices for characters -_.!~*')(
956  * expect: true
957  */
958 TESTSUITE05(53_markTest){
959     RUNNER_ASSERT(AT::markTest());
960 }
961
962 /*
963  * author: unknown
964  * test: ACE Engine
965  * description: testing if "digit" static table in Attribute class contains
966  * "true" on indices for characters that are digits
967  * expect: true
968  */
969 TESTSUITE05(54_digitTest){
970     RUNNER_ASSERT(AT::digitTest());
971 }
972
973 /*
974  * author: unknown
975  * test: ACE Engine
976  * description: testing if "digit" static table in Attribute class contains
977  * "true" on indices for characters that are real characters (letters)
978  * expect: true
979  */
980 TESTSUITE05(55_alphaTest){
981     RUNNER_ASSERT(AT::alphaTest());
982 }
983
984 /*
985  * author: unknown
986  * test: ACE Engine
987  * description: checking Attribute isEscapedStatic method of Attribute class
988  * expect: true, true, false, false, false, false, true, true
989  */
990 TESTSUITE05(56_escapedTest){
991     const char * query = "%23";
992     RUNNER_ASSERT(assertTrue(AT::isEscapedStatic(query)));
993     query = "%ab";
994     RUNNER_ASSERT(assertTrue(AT::isEscapedStatic(query)));
995
996     query = "%a";
997     RUNNER_ASSERT(assertFalse(AT::isEscapedStatic(query)));
998
999     query = "%rw";
1000     RUNNER_ASSERT(assertFalse(AT::isEscapedStatic(query)));
1001
1002     query = NULL;
1003     RUNNER_ASSERT(assertFalse(AT::isEscapedStatic(query)));
1004
1005     query = "abc";
1006     RUNNER_ASSERT(assertFalse(AT::isEscapedStatic(query)));
1007
1008     query = "%bc";
1009     RUNNER_ASSERT(assertTrue(AT::isEscapedStatic(query)));
1010
1011     query = "%DF";
1012     RUNNER_ASSERT(assertTrue(AT::isEscapedStatic(query)));
1013 }
1014