From f13bf276f3313520f76b7719f2a2df01e10468d8 Mon Sep 17 00:00:00 2001 From: Kirill Andreev Date: Wed, 14 Dec 2011 18:50:28 +0300 Subject: [PATCH] Bug 1059 - Unable to load trace files created from SUMO and TraNS Lite: fixed --- src/mobility/helper/ns2-mobility-helper.cc | 4 ++++ src/mobility/test/ns2-mobility-helper-test-suite.cc | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/src/mobility/helper/ns2-mobility-helper.cc b/src/mobility/helper/ns2-mobility-helper.cc index bc1bdc5c4..13a56f09b 100644 --- a/src/mobility/helper/ns2-mobility-helper.cc +++ b/src/mobility/helper/ns2-mobility-helper.cc @@ -353,6 +353,10 @@ ParseNs2Line (const string& str) { string x; s >> x; + if (x.length () == 0) + { + continue; + } ret.tokens.push_back (x); int ii (0); double d (0); diff --git a/src/mobility/test/ns2-mobility-helper-test-suite.cc b/src/mobility/test/ns2-mobility-helper-test-suite.cc index 598a88821..8baa78f0c 100644 --- a/src/mobility/test/ns2-mobility-helper-test-suite.cc +++ b/src/mobility/test/ns2-mobility-helper-test-suite.cc @@ -432,6 +432,13 @@ public: t->AddReferencePoint ("0", 6, Vector (0, 5, 0), Vector (0, -1, 0)); t->AddReferencePoint ("0", 16, Vector (0, -10, 0), Vector (0, 0, 0)); AddTestCase (t); + t = new Ns2MobilityHelperTest ("Bug 1059 testcase", Seconds (16)); + t->SetTrace ("$node_(0) set X_ 10.0\r\n" + "$node_(0) set Y_ 0.0\r\n" + ); + // id t position velocity + t->AddReferencePoint ("0", 0, Vector (10, 0, 0), Vector (0, 0, 0)); + AddTestCase (t); } } g_ns2TransmobilityHelperTestSuite;