Skip to content
Browse files

more tests

  • Loading branch information...
1 parent 8db1d9a commit 7eb20c835705b97820a6327605d0dbf8c57d655f @tabish121 tabish121 committed Nov 4, 2013
Showing with 36 additions and 0 deletions.
  1. +31 −0 activemq-cpp/src/test/decaf/net/URLTest.cpp
  2. +5 −0 activemq-cpp/src/test/decaf/net/URLTest.h
View
31 activemq-cpp/src/test/decaf/net/URLTest.cpp
@@ -585,3 +585,34 @@ void URLTest::testFileEqualsWithEmptyHost() {
URL b("file:/a/");
CPPUNIT_ASSERT(a.equals(b));
}
+
+////////////////////////////////////////////////////////////////////////////////
+void URLTest::testOmittedHost() {
+ URL url("http:///path");
+ CPPUNIT_ASSERT_EQUAL(String(""), url.getHost());
+ CPPUNIT_ASSERT_EQUAL(String("/path"), url.getFile());
+ CPPUNIT_ASSERT_EQUAL(String("/path"), url.getPath());
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void URLTest::testNoHost() {
+ URL url("http:/path");
+ CPPUNIT_ASSERT_EQUAL(String("http"), url.getProtocol());
+ CPPUNIT_ASSERT_EQUAL(String(), url.getAuthority());
+ CPPUNIT_ASSERT_EQUAL(String(), url.getUserInfo());
+ CPPUNIT_ASSERT_EQUAL(String(), url.getHost());
+ CPPUNIT_ASSERT_EQUAL(-1, url.getPort());
+ CPPUNIT_ASSERT_EQUAL(80, url.getDefaultPort());
+ CPPUNIT_ASSERT_EQUAL(String("/path"), url.getFile());
+ CPPUNIT_ASSERT_EQUAL(String("/path"), url.getPath());
+ CPPUNIT_ASSERT_EQUAL(String(), url.getQuery());
+ CPPUNIT_ASSERT_EQUAL(String(), url.getRef());
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void URLTest::testNoPath() {
+ URL url("http://host");
+ CPPUNIT_ASSERT_EQUAL(String("host"), url.getHost());
+ CPPUNIT_ASSERT_EQUAL(String(), url.getFile());
+ CPPUNIT_ASSERT_EQUAL(String(), url.getPath());
+}
View
5 activemq-cpp/src/test/decaf/net/URLTest.h
@@ -46,6 +46,8 @@ namespace net {
CPPUNIT_TEST( testURLStreamHandlerParseURL );
CPPUNIT_TEST( testUrlParts );
CPPUNIT_TEST( testFileEqualsWithEmptyHost );
+ CPPUNIT_TEST( testNoHost );
+ CPPUNIT_TEST( testNoPath );
CPPUNIT_TEST_SUITE_END();
public:
@@ -72,6 +74,9 @@ namespace net {
void testURLStreamHandlerParseURL();
void testUrlParts();
void testFileEqualsWithEmptyHost();
+ void testOmittedHost();
+ void testNoHost();
+ void testNoPath();
};

0 comments on commit 7eb20c8

Please sign in to comment.
Something went wrong with that request. Please try again.