muSED_test.cxx
Go to the documentation of this file.00001 #include <cxxtls/muSED.h>
00002 #include <iostream>
00003 #include <stdlib.h>
00004
00005 using namespace cxxtls;
00006 using namespace std;
00007
00008 int main()
00009 {
00010
00011
00012
00013
00014 {
00015 std::list<std::string> input;
00016 std::list<std::string> output;
00017
00018 input.push_back("one");
00019
00020 std::list<std::string> script;
00021
00022 script.push_back("s/one/two/g;p");
00023
00024 muSED::apply(script, input, output);
00025
00026 if(output.size() != 1)
00027 {
00028 cerr << "muSED_test FAILED 'muSED::apply(scriptContainter, inputContainter, outputContainer)'" << endl;
00029 cerr << " expected output.size() to be 1, but found " << output.size() << endl;
00030 exit(1);
00031 }
00032
00033 if(*output.begin() != "two")
00034 {
00035 cerr << "muSED_test FAILED 'muSED::apply(scriptContainter, inputContainter, outputContainer)'" << endl;
00036 cerr << " expected 'two' but found " << *output.begin() << endl;
00037 exit(1);
00038 }
00039
00040
00041 }
00042
00043 {
00044 std::list<std::string> input;
00045 std::list<std::string> output;
00046
00047 input.push_back("one");
00048
00049
00050 muSED::oneLiner("s/one/two/1;p", input, output);
00051
00052 if(output.size() != 1)
00053 {
00054 cerr << "muSED_test FAILED 'muSED::apply(std::string, inputContainter, outputContainer)'" << endl;
00055 cerr << " expected output.size() to be 1, but found " << output.size() << endl;
00056 exit(1);
00057 }
00058
00059 if(*output.begin() != "two")
00060 {
00061 cerr << "muSED_test FAILED 'muSED::apply(std::string, inputContainter, outputContainer)'" << endl;
00062 cerr << " expected 'two' but found " << *output.begin() << endl;
00063 exit(1);
00064 }
00065
00066 }
00067
00068
00069 cerr << "muSED_test PASSED" << endl;
00070
00071 }