fixed some file headers to the new format
[senf.git] / Socket / SocketPolicy.test.cc
index 534f40d..78f9297 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 //
 // Copyright (C) 2006
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
-//     Stefan Bund <stefan.bund@fokus.fraunhofer.de>
+// Fraunhofer Institute for Open Communication Systems (FOKUS) 
+// Competence Center NETwork research (NET), St. Augustin, GERMANY 
+//     Stefan Bund <g0dil@berlios.de>
 //
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@
 #include "SocketPolicy.hh"
 #include "SocketPolicy.test.hh"
 
-#include <boost/test/auto_unit_test.hpp>
+#include "../Utils/auto_unit_test.hh"
 #include <boost/test/test_tools.hpp>
 #include <boost/mpl/assert.hpp>
 #include <boost/concept_check.hpp>
@@ -83,7 +83,7 @@ namespace {
 
 BOOST_AUTO_UNIT_TEST(socketPolicy)
 {
-    // All these checks are really compile-time checks ...
+    // Most of these checks are really compile-time checks ...
 
     typedef MakeSocketPolicy<
         UnixAddressingPolicy,
@@ -122,12 +122,22 @@ BOOST_AUTO_UNIT_TEST(socketPolicy)
     // The following should fail at compile time
     // BOOST_MPL_ASSERT(( SocketPolicyIsBaseOf<Policy1,Policy3> ));
 
-    ConvertibleValue<Policy1> p1;
-    ConvertibleValue<Policy3> p3(p1);
+    {
+        ConvertibleValue<Policy1> p1;
+        ConvertibleValue<Policy3> p3(p1);
+
+        p3 = p1;
+        // The following should fail at compile time
+        // p1 = p3;
+    }
+    
+    {
+        Policy1 p1;
+        Policy3 p3;
 
-    p3 = p1;
-    // The following should fail at compile time
-    // p1 = p3;
+        BOOST_CHECK_THROW( Policy1::checkBaseOf(p3), std::bad_cast );
+        BOOST_CHECK_NO_THROW( Policy3::checkBaseOf(p1) );
+    }
 }
 
 ///////////////////////////////cc.e////////////////////////////////////////
@@ -140,4 +150,6 @@ BOOST_AUTO_UNIT_TEST(socketPolicy)
 // c-file-style: "senf"
 // indent-tabs-mode: nil
 // ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// comment-column: 40
 // End: