Remove code duplication in test fixtures
[libt2n] / test / hello.cpp
index d53a312..6bce679 100644 (file)
@@ -49,43 +49,8 @@ on this file might be covered by the GNU General Public License.
 using namespace std;
 using namespace libt2n;
 
-// this is an evil hack to get access to real_write, don't ever do this in an app!!!
-class real_write_connection: public socket_server_connection
-{
-    public:
-        void real_write(const std::string& data)
-            { socket_write(data); }
-};
-
-class test_helloFixture : public KillChildOnShutdownFixture
-{
-protected:
-    void send_hello(string hello_string, socket_server* ss, int conn_id)
-    {
-        server_connection *sc=ss->get_connection(conn_id);
-        sc->write(hello_string);
-    }
-
-    void send_raw_socket(string hello_string, socket_server* ss, int conn_id)
-    {
-        socket_server_connection *ssc=dynamic_cast<socket_server_connection*>(ss->get_connection(conn_id));
-
-        // this is an evil hack to get access to real_write, don't ever do this in an app!!!
-        real_write_connection *rwc=(real_write_connection*)ssc;
-        rwc->real_write(hello_string);
-    }
-
-public:
-    test_helloFixture()
-    {
-    }
-
-    ~test_helloFixture()
-    {
-    }
-};
 
-BOOST_FIXTURE_TEST_SUITE(test_hello, test_helloFixture)
+BOOST_FIXTURE_TEST_SUITE(test_hello, KillChildOnShutdownFixture)
 
 BOOST_AUTO_TEST_CASE(HelloOk)
 {