Revision: 6890
http://playerstage.svn.sourceforge.net/playerstage/?rev=6890&view=rev
Author: jeremy_asher
Date: 2008-07-18 23:57:33 +0000 (Fri, 18 Jul 2008)
Log Message:
-----------
libstageproxy: updated test suites
Modified Paths:
--------------
code/stage/trunk/libstageplugin/test/CMakeLists.txt
code/stage/trunk/libstageplugin/test/lsp_test_laser.cc
code/stage/trunk/libstageplugin/test/lsp_test_laser.hh
Added Paths:
-----------
code/stage/trunk/libstageplugin/test/lsp_test_proxy.cc
code/stage/trunk/libstageplugin/test/lsp_test_proxy.hh
code/stage/trunk/libstageplugin/test/lsp_test_speech.cc
code/stage/trunk/libstageplugin/test/lsp_test_speech.hh
Modified: code/stage/trunk/libstageplugin/test/CMakeLists.txt
===================================================================
--- code/stage/trunk/libstageplugin/test/CMakeLists.txt 2008-07-18 20:58:47 UTC
(rev 6889)
+++ code/stage/trunk/libstageplugin/test/CMakeLists.txt 2008-07-18 23:57:33 UTC
(rev 6890)
@@ -13,8 +13,12 @@
SET( lspTestSrcs
lsp_test.cc
+ lsp_test_proxy.cc
+ lsp_test_proxy.hh
lsp_test_laser.cc
lsp_test_laser.hh
+ lsp_test_speech.cc
+ lsp_test_speech.hh
)
add_executable( lsp_test ${lspTestSrcs} )
Modified: code/stage/trunk/libstageplugin/test/lsp_test_laser.cc
===================================================================
--- code/stage/trunk/libstageplugin/test/lsp_test_laser.cc 2008-07-18
20:58:47 UTC (rev 6889)
+++ code/stage/trunk/libstageplugin/test/lsp_test_laser.cc 2008-07-18
23:57:33 UTC (rev 6890)
@@ -1,28 +1,21 @@
#include "lsp_test_laser.hh"
+using namespace lspTest;
-
-void LSPLaserTest::setUp() {
- client = playerc_client_create( NULL, "localhost", 6665 );
-
-// int connectError = playerc_client_connect( client );
- CPPUNIT_ASSERT( playerc_client_connect( client ) == 0 );
-
+void Laser::setUp() {
+ connect();
laserProxy = playerc_laser_create( client, 0 );
-
CPPUNIT_ASSERT( playerc_laser_subscribe( laserProxy, PLAYER_OPEN_MODE )
== 0 );
}
-void LSPLaserTest::tearDown() {
+void Laser::tearDown() {
CPPUNIT_ASSERT( playerc_laser_unsubscribe( laserProxy ) == 0 );
playerc_laser_destroy( laserProxy );
-
- CPPUNIT_ASSERT( playerc_client_disconnect( client ) == 0 );
- playerc_client_destroy( client );
+ disconnect();
}
-void LSPLaserTest::testConfig() {
+void Laser::testConfig() {
const double DELTA = 0.01;
double min = -M_PI/2;
@@ -38,14 +31,14 @@
unsigned char intensity2 = 1;
CPPUNIT_ASSERT( playerc_laser_get_config( laserProxy, &min2, &max2,
&res2, &range_res2, &intensity2, &freq2 ) == 0 );
- CPPUNIT_ASSERT_DOUBLES_EQUAL( min2, min, DELTA );
- CPPUNIT_ASSERT_DOUBLES_EQUAL( max2, max, DELTA );
- CPPUNIT_ASSERT_DOUBLES_EQUAL( res2, res, DELTA );
- CPPUNIT_ASSERT_DOUBLES_EQUAL( range_res2, range_res, DELTA );
- CPPUNIT_ASSERT_DOUBLES_EQUAL( freq2, freq, DELTA );
- CPPUNIT_ASSERT( intensity == intensity2 );
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "min scan angle", min, min2,
DELTA );
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "max scan angle", max, max2,
DELTA );
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "angular resolution", res, res2,
DELTA );
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "range resolution", range_res,
range_res2, DELTA );
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "scan freq", freq, freq2, DELTA );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "intensity", intensity, intensity2 );
}
-void LSPLaserTest::testData() {
+void Laser::testData() {
}
\ No newline at end of file
Modified: code/stage/trunk/libstageplugin/test/lsp_test_laser.hh
===================================================================
--- code/stage/trunk/libstageplugin/test/lsp_test_laser.hh 2008-07-18
20:58:47 UTC (rev 6889)
+++ code/stage/trunk/libstageplugin/test/lsp_test_laser.hh 2008-07-18
23:57:33 UTC (rev 6890)
@@ -4,25 +4,28 @@
#include <cppunit/extensions/HelperMacros.h>
#include <libplayerc/playerc.h>
-class LSPLaserTest : public CPPUNIT_NS::TestFixture
-{
- CPPUNIT_TEST_SUITE( LSPLaserTest );
- CPPUNIT_TEST( testConfig );
- CPPUNIT_TEST( testData );
- CPPUNIT_TEST_SUITE_END();
+#include "lsp_test_proxy.hh"
+
+namespace lspTest {
+ class Laser : public Proxy
+ {
+ CPPUNIT_TEST_SUITE( Laser );
+ CPPUNIT_TEST( testConfig );
+ CPPUNIT_TEST( testData );
+ CPPUNIT_TEST_SUITE_END();
+
+ protected:
+ playerc_laser_t* laserProxy;
+
+ void testConfig();
+ void testData();
+
+ public:
+ void setUp();
+ void tearDown();
+ };
+};
-protected:
- playerc_laser_t* laserProxy;
- playerc_client_t* client;
-
- void testConfig();
- void testData();
-
-public:
- void setUp();
- void tearDown();
-};
+CPPUNIT_TEST_SUITE_REGISTRATION( lspTest::Laser );
-CPPUNIT_TEST_SUITE_REGISTRATION( LSPLaserTest );
-
#endif
\ No newline at end of file
Added: code/stage/trunk/libstageplugin/test/lsp_test_proxy.cc
===================================================================
--- code/stage/trunk/libstageplugin/test/lsp_test_proxy.cc
(rev 0)
+++ code/stage/trunk/libstageplugin/test/lsp_test_proxy.cc 2008-07-18
23:57:33 UTC (rev 6890)
@@ -0,0 +1,15 @@
+#include "lsp_test_proxy.hh"
+
+#include <stdio.h>
+
+using namespace lspTest;
+
+void Proxy::connect() {
+ client = playerc_client_create( NULL, "localhost", 6665 );
+ CPPUNIT_ASSERT( playerc_client_connect( client ) == 0 );
+}
+
+void Proxy::disconnect() {
+ CPPUNIT_ASSERT( playerc_client_disconnect( client ) == 0 );
+ playerc_client_destroy( client );
+}
\ No newline at end of file
Added: code/stage/trunk/libstageplugin/test/lsp_test_proxy.hh
===================================================================
--- code/stage/trunk/libstageplugin/test/lsp_test_proxy.hh
(rev 0)
+++ code/stage/trunk/libstageplugin/test/lsp_test_proxy.hh 2008-07-18
23:57:33 UTC (rev 6890)
@@ -0,0 +1,21 @@
+#ifndef _LSP_PROXY_TEST_H_
+#define _LSP_PROXY_TEST_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <libplayerc/playerc.h>
+
+namespace lspTest {
+ class Proxy : public CppUnit::TestFixture
+ {
+ CPPUNIT_TEST_SUITE( Proxy );
+ CPPUNIT_TEST_SUITE_END_ABSTRACT();
+
+ protected:
+ playerc_client_t* client;
+
+ void connect();
+ void disconnect();
+ };
+};
+
+#endif
\ No newline at end of file
Added: code/stage/trunk/libstageplugin/test/lsp_test_speech.cc
===================================================================
--- code/stage/trunk/libstageplugin/test/lsp_test_speech.cc
(rev 0)
+++ code/stage/trunk/libstageplugin/test/lsp_test_speech.cc 2008-07-18
23:57:33 UTC (rev 6890)
@@ -0,0 +1,21 @@
+#include "lsp_test_speech.hh"
+
+#include <stdio.h>
+
+using namespace lspTest;
+
+void Speech::setUp() {
+ connect();
+ speechProxy = playerc_speech_create( client, 0 );
+ CPPUNIT_ASSERT( playerc_speech_subscribe( speechProxy, PLAYER_OPEN_MODE
) == 0 );
+}
+
+void Speech::tearDown() {
+ CPPUNIT_ASSERT( playerc_speech_unsubscribe( speechProxy ) == 0 );
+ playerc_speech_destroy( speechProxy );
+ disconnect();
+}
+
+void Speech::testSay1() {
+ CPPUNIT_ASSERT( playerc_speech_say( speechProxy, "Test" ) == 0 );
+}
Added: code/stage/trunk/libstageplugin/test/lsp_test_speech.hh
===================================================================
--- code/stage/trunk/libstageplugin/test/lsp_test_speech.hh
(rev 0)
+++ code/stage/trunk/libstageplugin/test/lsp_test_speech.hh 2008-07-18
23:57:33 UTC (rev 6890)
@@ -0,0 +1,29 @@
+#ifndef _LSP_SPEECH_TEST_H_
+#define _LSP_SPEECH_TEST_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <libplayerc/playerc.h>
+
+#include "lsp_test_proxy.hh"
+
+namespace lspTest {
+ class Speech : public Proxy
+ {
+ CPPUNIT_TEST_SUB_SUITE( Speech, Proxy );
+ CPPUNIT_TEST( testSay1 );
+ CPPUNIT_TEST_SUITE_END();
+
+ protected:
+ playerc_speech_t* speechProxy;
+
+ void testSay1();
+
+ public:
+ void setUp();
+ void tearDown();
+ };
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION( lspTest::Speech );
+
+#endif
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit