MultiTech / MTS-Utils

Dependents:   mtsas mtsas thermostat_fan_demo--fan mtsas ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TestMTSText.h Source File

TestMTSText.h

00001 #ifndef TESTMTSTEXT_H
00002 #define TESTMTSTEXT_H
00003 
00004 #include <string>
00005 #include <vector>
00006 
00007 #include "MTSText.h"
00008 
00009 using namespace mts;
00010 
00011 class TestMTSText : public TestCollection
00012 {
00013 public:
00014     TestMTSText();
00015     ~TestMTSText();
00016 
00017     virtual void run();
00018 };
00019 
00020 TestMTSText::TestMTSText() : TestCollection("MTSText") {}
00021 
00022 TestMTSText::~TestMTSText() {}
00023 
00024 void TestMTSText::run() {
00025     //Testing split method (char delimeter)
00026     Test::start("split method (char delimeter)");
00027     std::string source = "ABC,,456";
00028     std::vector<std::string> split = Text::split(source, ',');
00029     Test::assertTrue(split.size() == 3);
00030     Test::assertTrue(split[0].compare("ABC") == 0);
00031     Test::assertTrue(split[1].compare("") == 0);
00032     Test::assertTrue(split[2].compare("456") == 0);
00033     Test::end();
00034 }
00035 
00036 #endif /* TESTMTSTEXT_H */