senfscons: Much improved install implementation
[senf.git] / Utils / singleton.test.cc
similarity index 61%
rename from Socket/Protocols/GenericSockAddr.cci
rename to Utils/singleton.test.cc
index 3aa05af..fb134af 100644 (file)
@@ -1,4 +1,6 @@
-// Copyright (C) 2007
+// $Id$
+//
+// Copyright (C) 2007 
 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
 //     Stefan Bund <g0dil@berlios.de>
 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 /** \file
-    \brief GenericSockAddr inline non-template implementation */
+    \brief singleton.test unit tests */
+
+//#include "singleton.test.hh"
+//#include "singleton.test.ih"
 
 // Custom includes
+#include "singleton.hh"
 
-#define prefix_ inline
-///////////////////////////////cci.p///////////////////////////////////////
+#include <boost/test/auto_unit_test.hpp>
+#include <boost/test/test_tools.hpp>
 
-prefix_ senf::GenericSockAddr::GenericSockAddr()
-{}
+#define prefix_
+///////////////////////////////cc.p////////////////////////////////////////
 
-prefix_ struct sockaddr * senf::GenericSockAddr::sockaddr_p()
-{
-    return reinterpret_cast<sockaddr *>(&addr_);
-}
+namespace {
+    
+    class Test : public senf::singleton<Test>
+    {
+        friend class senf::singleton<Test>;
+        
+        Test() : foo_(1234) {}
 
-prefix_ struct sockaddr const * senf::GenericSockAddr::sockaddr_p()
-    const
-{
-    return reinterpret_cast<sockaddr const *>(&addr_);
+        int foo_;
+
+    public:
+        using senf::singleton<Test>::instance;
+
+        int foo() { return foo_; }
+    };
 }
 
-prefix_ unsigned senf::GenericSockAddr::sockaddr_len()
-    const
+BOOST_AUTO_UNIT_TEST(sInGlEtOn)
 {
-    return sizeof(addr_);
+    BOOST_CHECK_EQUAL( Test::instance().foo(), 1234 );
 }
 
-///////////////////////////////cci.e///////////////////////////////////////
+///////////////////////////////cc.e////////////////////////////////////////
 #undef prefix_
 
 \f
 // Local Variables:
 // mode: c++
 // fill-column: 100
+// comment-column: 40
 // c-file-style: "senf"
 // indent-tabs-mode: nil
 // ispell-local-dictionary: "american"
 // compile-command: "scons -u test"
-// comment-column: 40
 // End: