OSDN Git Service

command_receiver test追加, l7vsd test修正
authortakamaru <takamaru@1ed66053-1c2d-0410-8867-f7571e6e31d3>
Wed, 21 Jan 2009 03:47:20 +0000 (03:47 +0000)
committertakamaru <takamaru@1ed66053-1c2d-0410-8867-f7571e6e31d3>
Wed, 21 Jan 2009 03:47:20 +0000 (03:47 +0000)
git-svn-id: http://10.144.169.20/repos/um/branches/l7vsd-3.x-shamshel@6166 1ed66053-1c2d-0410-8867-f7571e6e31d3

include/command_receiver.h
src/command_receiver.cpp
unit_tests/command_receiver_test/Makefile [new file with mode: 0644]
unit_tests/command_receiver_test/command_receiver_test.cpp [new file with mode: 0644]
unit_tests/command_receiver_test/command_session_stub.h [new file with mode: 0644]
unit_tests/command_receiver_test/l7vsd_stub.h [new file with mode: 0644]
unit_tests/l7vsd_test/Makefile
unit_tests/l7vsd_test/l7vsd_test.cpp

index 7f20c14..1673591 100644 (file)
@@ -11,6 +11,7 @@
 #ifndef        COMMAND_RECEIVER_H
 #define        COMMAND_RECEIVER_H
 
+#include <boost/asio.hpp>
 #include <boost/utility.hpp>
 #include "command_session.h"
 #include "l7vsd.h"
index c2e37aa..5439766 100644 (file)
@@ -18,13 +18,13 @@ namespace   l7vs{
 //!    @param[in]      l7vsd refernce
 command_receiver::command_receiver( boost::asio::io_service& io_service, const std::string& file, l7vsd& parent )
                :       dispatcher( io_service ),
-                       acceptor( io_service, boost::asio::local::stream_protocol::endpoint( file ) ),
+                       acceptor_( io_service, boost::asio::local::stream_protocol::endpoint( file ) ),
                        vsd( parent ){
 
 }
 
 //!    @brief          destructor
-~command_receiver(){
+command_receiver::~command_receiver(){
 }
 
 //!    @brief          accept handler
@@ -34,4 +34,4 @@ void  command_receiver::handle_accept( boost::shared_ptr< command_session > sessi
 
 }
 
-}      //namespace     l7vs
\ No newline at end of file
+}      //namespace     l7vs
diff --git a/unit_tests/command_receiver_test/Makefile b/unit_tests/command_receiver_test/Makefile
new file mode 100644 (file)
index 0000000..9612461
--- /dev/null
@@ -0,0 +1,33 @@
+#
+#
+#      Makefile for command_receiver unit test frameworks.
+#
+#
+TARGET         = command_receiver_ut
+CPP                    = g++
+CPPFLAGS       = -O0 -g -Werror -pthread
+INCLUDES       =       -I../../logger \
+                               -I../../parameter \
+                               -I../../include
+LIBS           =       -lboost_system-gcc41-mt \
+                               -lboost_thread-gcc41-mt \
+                               -lboost_unit_test_framework-gcc41-mt
+
+LDFLAGS                = -lrt -ldl
+
+SRCS           =       \
+                       command_receiver_test.cpp
+
+.SUFFIX:       .cpp .o
+.cpp.o:
+               $(CPP) $(CPPFLAGS) $(INCLUDES) -c $< -o $@
+
+OBJS           = $(SRCS:.cpp=.o)
+
+all:   $(TARGET)
+
+$(TARGET):     $(OBJS)
+       $(CPP) $(INCLUDES) -o $@ $(OBJS) $(LIBS)
+
+clean:
+       rm -f $(TARGET) $(OBJS)
diff --git a/unit_tests/command_receiver_test/command_receiver_test.cpp b/unit_tests/command_receiver_test/command_receiver_test.cpp
new file mode 100644 (file)
index 0000000..2952302
--- /dev/null
@@ -0,0 +1,32 @@
+#include <boost/test/included/unit_test.hpp>
+
+#include "l7vsd_stub.h"
+#include "command_session_stub.h"
+
+#include "../../src/command_receiver.cpp"
+
+using namespace boost::unit_test_framework;
+
+class  command_receiver_test   :public l7vs::command_receiver {
+public:
+       static void     constractor_test();
+
+};
+
+//--tests--
+
+void   command_receiver_test::constractor_test(){
+
+}
+
+
+test_suite*    init_unit_test_suite( int argc, char* argv[] ){
+
+       test_suite* ts = BOOST_TEST_SUITE( "command_receiver class test" );
+       ts->add( BOOST_TEST_CASE( &command_receiver_test::constractor_test ) );
+
+
+       framework::master_test_suite().add( ts );
+
+       return 0;
+}
diff --git a/unit_tests/command_receiver_test/command_session_stub.h b/unit_tests/command_receiver_test/command_session_stub.h
new file mode 100644 (file)
index 0000000..a0416db
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef        COMMAND_SESSION_H
+#define        COMMAND_SESSION_H
+namespace      l7vs{
+class  command_session{
+
+};
+}      //namespace     l7vs
+#endif //COMMAND_SESSION_H
diff --git a/unit_tests/command_receiver_test/l7vsd_stub.h b/unit_tests/command_receiver_test/l7vsd_stub.h
new file mode 100644 (file)
index 0000000..bb262c0
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef        L7VSD_H
+#define        L7VSD_H
+namespace      l7vs{
+class  l7vsd{
+
+};
+}      //namespace     l7vs
+#endif //L7VSD_H
index 7467def..f339ee3 100644 (file)
@@ -27,7 +27,7 @@ OBJS          = $(SRCS:.cpp=.o)
 all:   $(TARGET)
 
 $(TARGET):     $(OBJS)
-       $(CPP) $(INCLUDES) -o $@ $(OBJS) $(LIBS) /usr/lib64/libboost_unit_test_framework-gcc41-mt.a
+       $(CPP) $(INCLUDES) -o $@ $(OBJS) $(LIBS)
 
 clean:
        rm -f $(TARGET) $(OBJS)
index 4a3b7fd..b7cdb8d 100644 (file)
@@ -1,6 +1,6 @@
 #define        TEST_CASE
 
-#include <boost/test/unit_test.hpp>
+#include <boost/test/included/unit_test.hpp>
 
 #include "logger_enum.h"
 #include "logger_stub.h"