View | Details | Raw Unified | Return to bug 121
Collapse All | Expand All

(-)a/src/core/command-line.cc (-8 / +8 lines)
 Lines 188-232   public: Link Here 
188
    std::ostringstream nullout;
188
    std::ostringstream nullout;
189
    std::streambuf *origcerr = std::cerr.rdbuf (nullout.rdbuf ());
189
    std::streambuf *origcerr = std::cerr.rdbuf (nullout.rdbuf ());
190
    {
190
    {
191
      char *argv[] = {"run-tests", "--loops", "bad-value", NULL};
191
      const char *argv[] = {"run-tests", "--loops", "bad-value", NULL};
192
      int argc = sizeof (argv) / sizeof (argv[0]) - 1;
192
      int argc = sizeof (argv) / sizeof (argv[0]) - 1;
193
      
193
      
194
      uint32_t loops = 123;
194
      uint32_t loops = 123;
195
      CommandLine::AddArgValue ("loops","a test of the command line", loops);
195
      CommandLine::AddArgValue ("loops","a test of the command line", loops);
196
      CommandLine::Parse (argc, argv);
196
      CommandLine::Parse (argc, const_cast<char **> (argv));
197
      
197
      
198
      NS_TEST_ASSERT_EQUAL (loops, 123);
198
      NS_TEST_ASSERT_EQUAL (loops, 123);
199
    }
199
    }
200
200
201
    {
201
    {
202
      char *argv[] = {"run-tests", "--loops=bad-value", NULL};
202
      const char *argv[] = {"run-tests", "--loops=bad-value", NULL};
203
      int argc = sizeof (argv) / sizeof (argv[0]) - 1;
203
      int argc = sizeof (argv) / sizeof (argv[0]) - 1;
204
      
204
      
205
      uint32_t loops = 123;
205
      uint32_t loops = 123;
206
      CommandLine::AddArgValue ("loops","a test of the command line", loops);
206
      CommandLine::AddArgValue ("loops","a test of the command line", loops);
207
      CommandLine::Parse (argc, argv);
207
      CommandLine::Parse (argc, const_cast<char **> (argv));
208
      
208
      
209
      NS_TEST_ASSERT_EQUAL (loops, 123);
209
      NS_TEST_ASSERT_EQUAL (loops, 123);
210
    }
210
    }
211
211
212
    {
212
    {
213
      char *argv[] = {"run-tests", "--loops", "456", NULL};
213
      const char *argv[] = {"run-tests", "--loops", "456", NULL};
214
      int argc = sizeof (argv) / sizeof (argv[0]) - 1;
214
      int argc = sizeof (argv) / sizeof (argv[0]) - 1;
215
      
215
      
216
      uint32_t loops = 123;
216
      uint32_t loops = 123;
217
      CommandLine::AddArgValue ("loops","a test of the command line", loops);
217
      CommandLine::AddArgValue ("loops","a test of the command line", loops);
218
      CommandLine::Parse (argc, argv);
218
      CommandLine::Parse (argc, const_cast<char **> (argv));
219
      
219
      
220
      NS_TEST_ASSERT_EQUAL (loops, 456);
220
      NS_TEST_ASSERT_EQUAL (loops, 456);
221
    }
221
    }
222
222
223
    {
223
    {
224
      char *argv[] = {"run-tests", "--loops=456", NULL};
224
      const char *argv[] = {"run-tests", "--loops=456", NULL};
225
      int argc = sizeof (argv) / sizeof (argv[0]) - 1;
225
      int argc = sizeof (argv) / sizeof (argv[0]) - 1;
226
      
226
      
227
      uint32_t loops = 123;
227
      uint32_t loops = 123;
228
      CommandLine::AddArgValue ("loops","a test of the command line", loops);
228
      CommandLine::AddArgValue ("loops","a test of the command line", loops);
229
      CommandLine::Parse (argc, argv);
229
      CommandLine::Parse (argc, const_cast<char **> (argv));
230
      
230
      
231
      NS_TEST_ASSERT_EQUAL (loops, 456);
231
      NS_TEST_ASSERT_EQUAL (loops, 456);
232
    }
232
    }

Return to bug 121