From 25e7c26ac857915e62232e461bf13473d5cb9713 Mon Sep 17 00:00:00 2001
From: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
Date: Wed, 8 Oct 2008 14:12:34 -0400
Subject: [PATCH] move the test directory to sflphone/test

---
 src/Makefile.am                | 10 ++-----
 src/test/Makefile.am           |  9 -------
 src/test/configurationTest.cpp | 49 ----------------------------------
 test/Makefile.am               | 25 +++++++++++++++++
 test/TestMain.cpp              | 13 +++++++++
 test/configurationTest.cpp     | 38 ++++++++++++++++++++++++++
 6 files changed, 78 insertions(+), 66 deletions(-)
 delete mode 100644 src/test/Makefile.am
 delete mode 100644 src/test/configurationTest.cpp
 create mode 100644 test/Makefile.am
 create mode 100644 test/TestMain.cpp
 create mode 100644 test/configurationTest.cpp

diff --git a/src/Makefile.am b/src/Makefile.am
index 25ea06f5d5..2d52f24bb0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,6 @@
 sflcodecdir = $(libdir)/sflphone/codecs
-bin_PROGRAMS = sflphoned
 
+bin_PROGRAMS = sflphoned
 
 if USE_ZEROCONF
 ZEROCONFDIR = zeroconf
@@ -33,7 +33,7 @@ PULSEAUDIO_LIBS=-lpulse
 
 SUBDIRS = audio config dbus $(ZEROCONFDIR) #contact memmanager video mixer
 
-sflphoned_SOURCES = eventthread.cpp 	main.cpp 	voiplink.cpp \
+sflphoned_SOURCES = eventthread.cpp main.cpp	voiplink.cpp \
 		managerimpl.cpp	observer.cpp  samplerateconverter.cpp \
 		account.cpp sipaccount.cpp accountcreator.cpp \
                 sipvoiplink.cpp call.cpp sipcall.cpp \
@@ -41,7 +41,6 @@ sflphoned_SOURCES = eventthread.cpp 	main.cpp 	voiplink.cpp \
 
 sflphoned_CXXFLAGS = -DPREFIX=\"$(prefix)\" -DPROGSHAREDIR=\"${datadir}/sflphone\" $(ZEROCONFFLAGS) $(IAX_FLAGS) $(SFLPHONE_CFLAGS) $(SIP_CFLAGS)
 
-#sflphoned_LDFLAGS = -static
 sflphoned_LDADD =  ./libsflphone.la $(SFLPHONE_LIBS) $(ZEROCONFLIB) $(LIB_DNSSD) $(IAX_LIBS) $(EXOSIP_LIBS) $(ALSAFLAG) $(PULSEAUDIO_LIBS)
 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/libs $(libccext2_CFLAGS) $(libccgnu2_CFLAGS) $(IAX_CFLAGS) $(USER_INCLUDES) $(libdbuscpp_CFLAGS) \
 	      -DCODECS_DIR=\""$(sflcodecdir)"\" 
@@ -65,8 +64,3 @@ noinst_HEADERS = managerimpl.h manager.h global.h observer.h eventthread.h user_
 		 account.h sipaccount.h accountcreator.h \
                  sipvoiplink.h  call.h  sipcall.h \
 		 $(IAXHEADERS)
-
-#./contact/libcontact.la \
-#	./memmanager/libmemmanager.la \
-#	./mixer/libmixer.la \
-#	./video/libvideo.la
diff --git a/src/test/Makefile.am b/src/test/Makefile.am
deleted file mode 100644
index ad11b5d5ec..0000000000
--- a/src/test/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-bin_PROGRAMS = configurationTester
-
-CPPUNIT_LDFLAG = `pkg-config --libs cppunit`
-
-configurationTester_SOURCES = configurationTest.cpp
-configurationTester_LDADD = ../.libs/libsflphone.a ../config/.libs/libconfig.a
-configurationTester_LDFLAGS = $(CPPUNIT_LDFLAG) 
-configurationTester_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/libs $(libccext2_CFLAGS) $(libccgnu2_CFLAGS) $(IAX_CFLAGS) $(USER_INCLUDES) $(libdbuscpp_CFLAGS)
-
diff --git a/src/test/configurationTest.cpp b/src/test/configurationTest.cpp
deleted file mode 100644
index c7e8a09187..0000000000
--- a/src/test/configurationTest.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-#include "../manager.h"
-#include "../global.h"
-
-// Cppunit import
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/ui/text/TestRunner.h>
-#include <cppunit/CompilerOutputter.h>
-
-class ConfigurationTest : public CppUnit::TestFixture {
-
-    CPPUNIT_TEST_SUITE( ConfigurationTest );
-    CPPUNIT_TEST( testDefaultValueAudio );
-    CPPUNIT_TEST_SUITE_END();
-
-    public:
-    void setUp(){
-        Manager::instance().initConfigFile();
-    }
-
-    void tearDown(){
-
-    }
-
-    void testDefaultValueAudio(){
-        CPPUNIT_ASSERT( Manager::instance().getConfigString( AUDIO, ALSA_PLUGIN ) == "default" );
-    }
-
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION( ConfigurationTest );
-
-int main(){
-
-    CppUnit::TextUi::TestRunner runner;
-    CppUnit::TestFactoryRegistry &registry =
-        CppUnit::TestFactoryRegistry::getRegistry() ;
-    runner.addTest( registry.makeTest() ) ;
-    runner.setOutputter( CppUnit::CompilerOutputter::defaultOutputter(
-                &runner.result(),
-                std::cerr ) );
-    bool wasSuccessful = runner.run( "", false ) ;
-    return wasSuccessful ? 0 : 1;
-
-
-
-    return 0;
-
-
-}
diff --git a/test/Makefile.am b/test/Makefile.am
new file mode 100644
index 0000000000..07edd58774
--- /dev/null
+++ b/test/Makefile.am
@@ -0,0 +1,25 @@
+include ../globals.mak
+
+bin_PROGRAMS = configurationTester
+
+#ALSAFLAG= -lasound
+PULSEAUDIO_LIBS=-lpulse
+
+configurationTester_SOURCES =  configurationTest.cpp  \
+				TestMain.cpp
+
+configurationTester_LDADD =  ../src/libsflphone.la  \
+				$(SFLPHONE_LIBS) $(ZEROCONFLIB) $(LIB_DNSSD) $(IAX_LIBS) $(EXOSIP_LIBS) @ALSA_LIBS@ $(PULSEAUDIO_LIBS) @CPPUNIT_LIBS@ \
+				../src/sflphoned-managerimpl.o \
+				../src/sflphoned-accountcreator.o \
+				../src/sflphoned-call.o \
+				../src/sflphoned-sipcall.o \
+				../src/sflphoned-iaxcall.o \
+				../src/sflphoned-voiplink.o \
+				../src/sflphoned-sipvoiplink.o \
+				../src/sflphoned-iaxvoiplink.o \
+				../src/sflphoned-account.o \
+				../src/sflphoned-sipaccount.o \
+				../src/sflphoned-iaxaccount.o \
+				../src/sflphoned-eventthread.o \
+				../src/sflphoned-samplerateconverter.o
diff --git a/test/TestMain.cpp b/test/TestMain.cpp
new file mode 100644
index 0000000000..310732ac59
--- /dev/null
+++ b/test/TestMain.cpp
@@ -0,0 +1,13 @@
+#include <cppunit/TextTestRunner.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+
+int main(int argc, const char* argv[])
+{
+    CppUnit::TextTestRunner runner;
+    runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
+
+    runner.run();
+
+    return 0;
+}
+
diff --git a/test/configurationTest.cpp b/test/configurationTest.cpp
new file mode 100644
index 0000000000..02225a54aa
--- /dev/null
+++ b/test/configurationTest.cpp
@@ -0,0 +1,38 @@
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCaller.h>
+#include <cppunit/TestCase.h>
+#include <cppunit/TestSuite.h>
+#include <assert.h>
+
+#include "manager.h"
+#include "global.h"
+
+// Cppunit import
+
+class ConfigurationTest : public CppUnit::TestCase {
+
+    CPPUNIT_TEST_SUITE( ConfigurationTest );
+        CPPUNIT_TEST( testDefaultValueAudio );
+        CPPUNIT_TEST( testTheTest );
+    CPPUNIT_TEST_SUITE_END();
+
+    public:
+        ConfigurationTest() : CppUnit::TestCase("Configuration Tests") {}
+ 
+        void testDefaultValueAudio(){
+                CPPUNIT_ASSERT( Manager::instance().getConfigString( AUDIO, ALSA_PLUGIN ) == "default" );
+        }
+
+        void testTheTest(){
+                CPPUNIT_ASSERT( 3 == 2 ); 
+        }
+
+        void setUp(){
+        }
+
+        void tearDown(){
+        }
+
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION( ConfigurationTest );
-- 
GitLab