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"
20 run_main (int, ACE_TCHAR
*[])
22 ACE_START_TEST (ACE_TEXT ("Arg_Shifter_Test"));
23 const int test_argc_size1
= 5;
24 int argl (test_argc_size1
);
25 const ACE_TCHAR
*args1
[test_argc_size1
] = {
33 ACE_Arg_Shifter
shifter1 (argl
, args1
);
35 if (!shifter1
.is_anything_left ())
36 ACE_ERROR ((LM_ERROR
, "is_anything_left() returned 0 at start.\n"));
38 const int test_argc_size2
= 4;
39 int arg2
= test_argc_size2
;
40 const ACE_TCHAR
*args2
[test_argc_size2
] = {
41 ACE_TEXT ("-ORBDebugLevel"),
44 ACE_TEXT ("server.ior")
46 bool found_ORBDebug
= false;
48 ACE_Arg_Shifter
arg_shifter2 (arg2
, args2
);
49 while (arg_shifter2
.is_anything_left ())
51 if (0 == arg_shifter2
.cur_arg_strncasecmp (ACE_TEXT ("-ORBDebug")))
53 found_ORBDebug
= true;
54 arg_shifter2
.consume_arg ();
56 else if (0 == arg_shifter2
.cur_arg_strncasecmp (ACE_TEXT ("-ORBDaemon")))
58 arg_shifter2
.consume_arg ();
62 arg_shifter2
.ignore_arg ();
68 ACE_ERROR_RETURN ((LM_ERROR
, ACE_TEXT ("argshifter 2 test failed\n")), -1);
72 const char *args3
[] = {
77 int argc3
= sizeof args3
/ sizeof args3
[0];
78 ACE_Arg_Shifter_T
<char> arg_shifter_char (argc3
, args3
);
79 if (15 != arg_shifter_char
.cur_arg_strncasecmp ("-ORBDebugLevel"))
81 ACE_ERROR_RETURN ((LM_ERROR
, ACE_TEXT ("argshifter<char> failed\n")), -1);