void MEDLoaderBase::strip(std::string& s)
{
std::string::size_type f1=s.find_first_not_of(' ');
+ if(f1==std::string::npos)
+ {
+ s="";
+ return ;
+ }
std::string::size_type f2=s.find_last_not_of(' ');
s=s.substr(f1,f2-f1+1);
}
CPPUNIT_ASSERT(s=="azertty");
}
+void MEDLoaderTest::testSplitIntoNameAndUnit1()
+{
+ std::string s(" []");
+ std::string c,u;
+ MEDLoaderBase::splitIntoNameAndUnit(s,c,u);
+ CPPUNIT_ASSERT(c.empty());
+ CPPUNIT_ASSERT(u.empty());
+ s=" lmmm kki jjj ";
+ MEDLoaderBase::strip(s);
+ CPPUNIT_ASSERT(s=="lmmm kki jjj");
+ s=" ";
+ MEDLoaderBase::strip(s);
+ CPPUNIT_ASSERT(s.empty());
+ s="";
+ MEDLoaderBase::strip(s);
+ CPPUNIT_ASSERT(s.empty());
+ s=" ";
+ MEDLoaderBase::strip(s);
+ CPPUNIT_ASSERT(s.empty());
+ s=" pp";
+ MEDLoaderBase::strip(s);
+ CPPUNIT_ASSERT(s=="pp");
+}
+
void MEDLoaderTest::testMesh3DSurfShuffleRW()
{
const char fileName[]="file15.med";
CPPUNIT_TEST( testFieldGaussRW1 );
CPPUNIT_TEST( testFieldGaussNERW1 );
CPPUNIT_TEST( testLittleStrings1 );
+ CPPUNIT_TEST( testSplitIntoNameAndUnit1 );
CPPUNIT_TEST( testMesh3DSurfShuffleRW );
CPPUNIT_TEST( testFieldShuffleRW1 );
CPPUNIT_TEST( testMultiFieldShuffleRW1 );
void testFieldGaussRW1();
void testFieldGaussNERW1();
void testLittleStrings1();
+ void testSplitIntoNameAndUnit1();
void testMesh3DSurfShuffleRW();
void testFieldShuffleRW1();
void testMultiFieldShuffleRW1();