]> granicus.if.org Git - pdns/commitdiff
add tests for our port override feature in ComboAddress
authorbert hubert <bert.hubert@netherlabs.nl>
Tue, 27 Jan 2015 12:26:21 +0000 (13:26 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Tue, 27 Jan 2015 12:26:54 +0000 (13:26 +0100)
pdns/test-iputils_hh.cc

index 4e81de0ccaebe993f32395c211f0532553b8fa14..43a0b67d5741a64bedc19dcab7b8bcbfd09db20b 100644 (file)
@@ -16,6 +16,19 @@ BOOST_AUTO_TEST_CASE(test_ComboAddress) {
 
   ComboAddress remote("130.161.33.15", 53);
   BOOST_CHECK(!(local == remote));
+  BOOST_CHECK_EQUAL(remote.sin4.sin_port, htons(53));
+  
+  ComboAddress withport("213.244.168.210:53");
+  BOOST_CHECK_EQUAL(withport.sin4.sin_port, htons(53));
+  
+  ComboAddress withportO("213.244.168.210:53", 5300);
+  BOOST_CHECK_EQUAL(withportO.sin4.sin_port, htons(53));
+  withport = ComboAddress("[::]:53");
+  BOOST_CHECK_EQUAL(withport.sin4.sin_port, htons(53));
+  
+  withport = ComboAddress("[::]:5300", 53);
+  BOOST_CHECK_EQUAL(withport.sin4.sin_port, htons(5300));
 }
 
 BOOST_AUTO_TEST_CASE(test_Netmask) {