From a8609189954e4708b0aec010e336a9994aee3a44 Mon Sep 17 00:00:00 2001 From: galmes Date: Fri, 23 Jan 2004 18:52:59 +0000 Subject: Ajout des tests des classes message_asservissement_get_info et message_asservissement_info --- i/siroco/src/interface_deplacement.h | 38 +++++++++++++++++++ i/siroco/src/message_asservissement_get_info.cc | 2 +- i/siroco/src/message_asservissement_info.h | 3 +- i/siroco/src/pg_test/Makefile | 22 ++++++++--- .../message_asservissement_get_info_test.cc | 42 +++++++++++++++++++++ .../pg_test/message_asservissement_info_test.cc | 43 ++++++++++++++++++++++ 6 files changed, 143 insertions(+), 7 deletions(-) create mode 100644 i/siroco/src/interface_deplacement.h create mode 100644 i/siroco/src/pg_test/message_asservissement_get_info_test.cc create mode 100644 i/siroco/src/pg_test/message_asservissement_info_test.cc (limited to 'i') diff --git a/i/siroco/src/interface_deplacement.h b/i/siroco/src/interface_deplacement.h new file mode 100644 index 0000000..274b5e3 --- /dev/null +++ b/i/siroco/src/interface_deplacement.h @@ -0,0 +1,38 @@ +#ifndef interface_deplacement_h +#define interface_deplacement_h +// interface_deplacement.h +// {{{ +// +// Copyright (C) 2003 Nicolas Schodet et Pierre-André Galmes +// +// Robot APB Team/Efrei 2004. +// Web: http://assos.efrei.fr/robot/ +// Email: robot AT efrei DOT fr +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +// }}} +#include "interface_widget.h" + +class InterfaceDeplacement : public InterfaceWidget +{ + public: + // Destructeur. + ~InterfaceDeplacement (void); + // Récupère le widget qui correspond à cet InterfaceWidget. + Gtk::Widget &getGtkWidget (void); +}; + +#endif // interface_deplacement_h diff --git a/i/siroco/src/message_asservissement_get_info.cc b/i/siroco/src/message_asservissement_get_info.cc index 2649706..92b27d9 100644 --- a/i/siroco/src/message_asservissement_get_info.cc +++ b/i/siroco/src/message_asservissement_get_info.cc @@ -29,7 +29,7 @@ namespace Siroco // Constructor. MessageAsservissementGetInfo::MessageAsservissementGetInfo (void) - : Message (typeAsservissementGetInfo) + : Message (Message::typeAsservissementGetInfo) { } diff --git a/i/siroco/src/message_asservissement_info.h b/i/siroco/src/message_asservissement_info.h index 75ce36d..732f6ce 100644 --- a/i/siroco/src/message_asservissement_info.h +++ b/i/siroco/src/message_asservissement_info.h @@ -39,7 +39,8 @@ class MessageAsservissementInfo : public Message int consignMax_, pwmMax_, measureMax_; public: // Constructeur. - MessageAsservissementInfo (int p = 1, int i = 1, int d = 1, + MessageAsservissementInfo (Type type, + int p = 1, int i = 1, int d = 1, int consignMin = 1, int pwmMin = 1, int measureMin = 1, int consignMax = 1, int pwmMax = 1, int measureMax = 1); diff --git a/i/siroco/src/pg_test/Makefile b/i/siroco/src/pg_test/Makefile index 4198f3b..e9575fd 100755 --- a/i/siroco/src/pg_test/Makefile +++ b/i/siroco/src/pg_test/Makefile @@ -2,8 +2,12 @@ TARGET_A = message_test OBJECTS_A = message_test.o ../message.o -# TARGET_B = message -# OBJECTS_B = +TARGET_B = message_asservissement_info_test +OBJECTS_B = message_asservissement_info_test.o ../message_asservissement_info.o ../message.o + +TARGET_MAGI = message_asservissement_get_info_test +OBJECTS_MAGI = message_asservissement_get_info_test.o \ + ../message_asservissement_get_info.o ../message.o # LIB = -lccgnu2 -ldl -pthread @@ -11,17 +15,25 @@ CFLAGS = -O2 -Wall -g CC = g++ -all: $(TARGET_A) -#$(TARGET_B) +all: $(TARGET_A) + $(TARGET_A): $(OBJECTS_A) $(CC) $(CFLAGS) -o $@ $^ +mai: $(TARGET_B) + +$(TARGET_B): $(OBJECTS_B) + $(CC) $(CFLAGS) -o $@ $^ + +magi: $(TARGET_MAGI) +$(TARGET_MAGI): $(OBJECTS_MAGI) + $(CC) $(CFLAGS) -o $@ $^ #$(LIB) # $(TARGET_B): $(OBJECTS_B) # $(CC) $(CFLAGS) -o $@ $^ $(LIB) clean: - rm -f *.o tar rmt testpad testpad.h core + rm -f *.o message_test core diff --git a/i/siroco/src/pg_test/message_asservissement_get_info_test.cc b/i/siroco/src/pg_test/message_asservissement_get_info_test.cc new file mode 100644 index 0000000..8e1662a --- /dev/null +++ b/i/siroco/src/pg_test/message_asservissement_get_info_test.cc @@ -0,0 +1,42 @@ +// message_asservissement_get_info_test.cc +// {{{ +// +// Copyright (C) 2004 Pierre-André Galmes +// +// Robot APB Team/Efrei 2004. +// Web: http://assos.efrei.fr/robot/ +// Email: robot AT efrei DOT fr +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +// }}} +#include +#include "../message_asservissement_get_info.h" + +using namespace std; +using namespace Siroco; + +int +main (void) +{ + Message::Type type = Message::typeAsservissementData; + MessageAsservissementGetInfo m; + + //MessageAsservissementInfo m (type); + // MessageAsservissementInfo m (p, i, d, cMin, pMin, mMin, cMax, pMax, mMax); + + + cout << "type du message" << m.getType () << endl; +} diff --git a/i/siroco/src/pg_test/message_asservissement_info_test.cc b/i/siroco/src/pg_test/message_asservissement_info_test.cc new file mode 100644 index 0000000..e2badc7 --- /dev/null +++ b/i/siroco/src/pg_test/message_asservissement_info_test.cc @@ -0,0 +1,43 @@ +// message_asservissement_info_test.cc +// {{{ +// +// Copyright (C) 2004 Pierre-André Galmes +// +// Robot APB Team/Efrei 2004. +// Web: http://assos.efrei.fr/robot/ +// Email: robot AT efrei DOT fr +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +// }}} +#include +#include "../message_asservissement_info.h" + +using namespace std; +using namespace Siroco; + +int +main (void) +{ + int p = 10, i = 10, d = 10, cMin, pMin, mMin, cMax, pMax, mMax; + Message::Type type = Message::typeAsservissementData; + MessageAsservissementInfo m (type); + + //MessageAsservissementInfo m (type); + // MessageAsservissementInfo m (p, i, d, cMin, pMin, mMin, cMax, pMax, mMax); + + m.getPID (p, i, d); + cout << "pid : " << p << " " << i << " " << d << endl; +} -- cgit v1.2.3