~ubuntu-branches/ubuntu/utopic/nordugrid-arc/utopic

« back to all changes in this revision

Viewing changes to src/hed/libs/common/test/URLTest.cpp

  • Committer: Package Import Robot
  • Author(s): Mattias Ellert
  • Date: 2014-05-01 20:51:02 UTC
  • mfrom: (1.1.11)
  • Revision ID: package-import@ubuntu.com-20140501205102-icy9t3348uxobyx7
Tags: 4.1.0-1
* 4.1.0 Release
* Call dh_autoreconf to support ppc64le (Closes: #744639)

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
  CPPUNIT_TEST(TestIP6Url2);
28
28
  CPPUNIT_TEST(TestIP6Url3);
29
29
  CPPUNIT_TEST(TestBadUrl);
 
30
  CPPUNIT_TEST(TestWithDefaults);
30
31
  CPPUNIT_TEST(TestStringMatchesURL);
31
32
  CPPUNIT_TEST(TestOptions);
32
33
  CPPUNIT_TEST_SUITE_END();
47
48
  void TestIP6Url2();
48
49
  void TestIP6Url3();
49
50
  void TestBadUrl();
 
51
  void TestWithDefaults();
50
52
  void TestStringMatchesURL();
51
53
  void TestOptions();
52
54
 
324
326
  delete url;
325
327
}
326
328
 
 
329
void URLTest::TestWithDefaults() {
 
330
  Arc::URL url("http://example.org", false, 123, "/test");
 
331
  CPPUNIT_ASSERT(url);
 
332
  CPPUNIT_ASSERT_EQUAL(123, url.Port());
 
333
  CPPUNIT_ASSERT_EQUAL((std::string)"/test", url.Path());
 
334
  
 
335
  url = Arc::URL("http://example.org:321", false, 123, "/test");
 
336
  CPPUNIT_ASSERT(url);
 
337
  CPPUNIT_ASSERT_EQUAL(321, url.Port());
 
338
  CPPUNIT_ASSERT_EQUAL((std::string)"/test", url.Path());
 
339
  
 
340
  url = Arc::URL("http://example.org/testing", false, 123, "/test");
 
341
  CPPUNIT_ASSERT(url);
 
342
  CPPUNIT_ASSERT_EQUAL(123, url.Port());
 
343
  CPPUNIT_ASSERT_EQUAL((std::string)"/testing", url.Path());
 
344
  
 
345
  url = Arc::URL("http://example.org:321/testing", false, 123, "/test");
 
346
  CPPUNIT_ASSERT(url);
 
347
  CPPUNIT_ASSERT_EQUAL(321, url.Port());
 
348
  CPPUNIT_ASSERT_EQUAL((std::string)"/testing", url.Path());
 
349
 
 
350
  url = Arc::URL("http://[::1]", false, 123, "/test");
 
351
  CPPUNIT_ASSERT(url);
 
352
  CPPUNIT_ASSERT_EQUAL(123, url.Port());
 
353
  CPPUNIT_ASSERT_EQUAL((std::string)"/test", url.Path());
 
354
  
 
355
  url = Arc::URL("http://[::1]:321", false, 123, "/test");
 
356
  CPPUNIT_ASSERT(url);
 
357
  CPPUNIT_ASSERT_EQUAL(321, url.Port());
 
358
  CPPUNIT_ASSERT_EQUAL((std::string)"/test", url.Path());
 
359
  
 
360
  url = Arc::URL("http://[::1]/testing", false, 123, "/test");
 
361
  CPPUNIT_ASSERT(url);
 
362
  CPPUNIT_ASSERT_EQUAL(123, url.Port());
 
363
  CPPUNIT_ASSERT_EQUAL((std::string)"/testing", url.Path());
 
364
  
 
365
  url = Arc::URL("http://[::1]:321/testing", false, 123, "/test");
 
366
  CPPUNIT_ASSERT(url);
 
367
  CPPUNIT_ASSERT_EQUAL(321, url.Port());
 
368
  CPPUNIT_ASSERT_EQUAL((std::string)"/testing", url.Path());
 
369
}
 
370
 
327
371
void URLTest::TestStringMatchesURL() {
328
372
  std::string str;
329
373
  Arc::URL url;