1 // ============================================================================
7 // This program exercises the ACE_Arg_Shifter class.
10 // Steve Huston <shuston@riverace.com>
12 // ============================================================================
14 #include "ace/Arg_Shifter.h"
15 #include "test_config.h"
19 run_main (int, ACE_TCHAR
*[])
21 ACE_START_TEST (ACE_TEXT ("Arg_Shifter_Test"));
22 const int test_argc_size1
= 5;
23 int argl (test_argc_size1
);
24 const ACE_TCHAR
*args1
[test_argc_size1
] = {
32 ACE_Arg_Shifter
shifter1 (argl
, args1
);
34 if (!shifter1
.is_anything_left ())
35 ACE_ERROR ((LM_ERROR
, "is_anything_left() returned 0 at start.\n"));
37 const int test_argc_size2
= 4;
38 int arg2
= test_argc_size2
;
39 const ACE_TCHAR
*args2
[test_argc_size2
] = {
40 ACE_TEXT ("-ORBDebugLevel"),
43 ACE_TEXT ("server.ior")
45 bool found_ORBDebug
= false;
47 ACE_Arg_Shifter
arg_shifter2 (arg2
, args2
);
48 while (arg_shifter2
.is_anything_left ())
50 if (0 == arg_shifter2
.cur_arg_strncasecmp (ACE_TEXT ("-ORBDebug")))
52 found_ORBDebug
= true;
53 arg_shifter2
.consume_arg ();
55 else if (0 == arg_shifter2
.cur_arg_strncasecmp (ACE_TEXT ("-ORBDaemon")))
57 arg_shifter2
.consume_arg ();
61 arg_shifter2
.ignore_arg ();
67 ACE_ERROR_RETURN ((LM_ERROR
, ACE_TEXT ("argshifter 2 test failed\n")), -1);
71 const char *args3
[] = {
76 int argc3
= sizeof args3
/ sizeof args3
[0];
77 ACE_Arg_Shifter_T
<char> arg_shifter_char (argc3
, args3
);
78 if (15 != arg_shifter_char
.cur_arg_strncasecmp ("-ORBDebugLevel"))
80 ACE_ERROR_RETURN ((LM_ERROR
, ACE_TEXT ("argshifter<char> failed\n")), -1);