summaryrefslogtreecommitdiff
path: root/i/simulotron/src/gs/test_gs.cc
diff options
context:
space:
mode:
Diffstat (limited to 'i/simulotron/src/gs/test_gs.cc')
-rw-r--r--i/simulotron/src/gs/test_gs.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/i/simulotron/src/gs/test_gs.cc b/i/simulotron/src/gs/test_gs.cc
index 7416949..acf47f9 100644
--- a/i/simulotron/src/gs/test_gs.cc
+++ b/i/simulotron/src/gs/test_gs.cc
@@ -90,7 +90,8 @@ int testGSServer(SocketServer & sockServ)
// une string
GSMessage gsm;
while (gst.getGS(gsm) != 0);
- if (strDepart != gsm.getGS())
+ gsm.getString(strDest);
+ if (strDepart != strDest)
{
std::cout << "CHIER String altéré\n"
<< "Message d'origine: " << strDepart << "\n"
@@ -163,6 +164,7 @@ int testGSServer(SocketServer & sockServ)
while (gst.getGS(gsm) != 0);
gsm.readGS(&s2,sizeof(short));
gsm.readGS(&l2,sizeof(long));
+ gsm.getString(strDest);
gsm.readGS(&i4,sizeof(int));
if ( s1 != s2)
{
@@ -180,6 +182,15 @@ int testGSServer(SocketServer & sockServ)
<< std::endl;
return 1;
}
+ if ( strDepart != strDest)
+ {
+ std::cout << "CHIER String altéré\n"
+ << "Message d'origine: " << strDepart << "\n"
+ << "Message d'arrivé: " << gsm.getGS()
+ << std::endl;
+ return 1;
+ }
+
if ( i3 != i4)
{
std::cout << "CHIER int negatif altéré\n"
@@ -200,7 +211,7 @@ void testGSClient(int pauseMode)
// Création du transmitter
GSTransmitter gst(std::string("127.0.0.1"), 4242);
GSMessage g1,g2,g3,g4,g5,g6,g7;
- g1.appendGS(strDepart.data(), strDepart.size());
+ g1.appendGS(strDepart.c_str(), strDepart.size() + 1);
gst.putGS(g1);
g2.appendGS(&a, sizeof(char));
gst.putGS(g2);
@@ -215,6 +226,7 @@ void testGSClient(int pauseMode)
g7.appendGS(&l1, sizeof(long));
g7.insertFrontGS(&s1, sizeof(short));
+ g7.appendGS(strDepart.c_str(), strDepart.size() + 1);
g7.appendGS(&i3, sizeof(int));
gst.putGS(g7);
}