TrimSequence.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "TrimSequence.h"
00019
00020 #include <assert.h>
00021 #include <iostream>
00022 #include <stdlib.h>
00023 #include <string>
00024
00025 int main(int argc, const char **argv)
00026 {
00027 std::string test;
00028 std::string::iterator result;
00029
00030
00031
00032
00033 test = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
00034 result = trimSequence(test, 'A', true);
00035 assert(result == test.begin());
00036
00037 test = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
00038 result = trimSequence(test, '~', true);
00039 assert(result == test.end());
00040
00041 test = "AAAAABCDEFGHIJKLMNOPQRSTUVWXYZ";
00042 result = trimSequence(test, 'B', true);
00043 assert(result == (test.begin() + 5));
00044
00045 test = "AAAAAAAABCDEFGHIJKLMNOPQRSTUVWXYZ";
00046 result = trimSequence(test, 'B', true);
00047 assert(result == (test.begin() + 8));
00048
00049 test = "AAAAAAAABCDEFGHIJKLMNOPQRSTUVWXYZ";
00050 result = trimSequence(test, 'F', true);
00051 assert(result == (test.begin() + 12));
00052
00053 test = "AAAAAAAABCDEFGHIJKLMNOPQRSTUVWXYZ";
00054 result = trimSequence(test, '@', true);
00055 assert(result == (test.begin() + 0));
00056
00057 test = "AAAAAAAABCDEFGHIJKLMNOPQRSTUVWXYZ";
00058 result = trimSequence(test, '@', true);
00059 assert(result == (test.begin() + 0));
00060
00061 test = "AAAFAAAABCDEFGHIJKLMNOPQRSTUVWXYZ";
00062 result = trimSequence(test, 'F', true);
00063 assert(result == (test.begin() + 12));
00064
00065
00066 test = "AAAFAAAABCDEFG";
00067 result = trimSequence(test, 'F', true);
00068 assert(result == (test.begin() + 12));
00069
00070
00071
00072
00073 test = "ZYXWVUTSRQPONMLKJIHGFEDCBA";
00074 result = trimSequence(test, 'A', false);
00075 assert(result == test.end());
00076
00077 test = "ZYXWVUTSRQPONMLKJIHGFEDCBA";
00078 result = trimSequence(test, '~', false);
00079 assert(result == test.begin());
00080
00081 test = "ZYXWVUTSRQPONMLKJIHGFEDCBAAAAA";
00082 result = trimSequence(test, 'B', false);
00083 assert(result == (test.end() - 5));
00084
00085 test = "ZYXWVUTSRQPONMLKJIHGFEDCBAAAAAAA";
00086 result = trimSequence(test, 'B', false);
00087 assert(result == (test.end() - 7));
00088
00089 test = "ZYXWVUTSRQPONMLKJIHGFEDCBAAAAAAAA";
00090 result = trimSequence(test, 'F', false);
00091 assert(result == (test.end() - 12));
00092
00093 test = "ZYXWVUTSRQPONMLKJIHGFEDCBAAAAAAAA";
00094 result = trimSequence(test, '@', false);
00095 assert(result == (test.end() + 0));
00096
00097 test = "ZYXWVUTSRQPONMLKJIHGFEDCBAAAAFAAA";
00098 result = trimSequence(test, 'F', false);
00099 assert(result == (test.end() - 12));
00100
00101 test = "#################################";
00102 result = trimSequence(test, 'F', false);
00103 assert(result == (test.begin()));
00104
00105 #if 0
00106
00107 test = ">BC@>28B==>=><?@=?>@8(>0309261/;6=@";
00108 result = trimSequence(test, '0', false);
00109 assert(result == (test.end())-5);
00110 #endif
00111
00112 exit(0);
00113 }