00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "judo.hpp"
00030 #include "judo_test.hpp"
00031 using namespace judo;
00032
00033 #include <iostream>
00034 using namespace std;
00035
00036 Test* CDATATest::getTestSuite()
00037 {
00038 TestSuite* s = new TestSuite();
00039 s->addTest(new TestCaller<CDATATest>("testing construction",
00040 &CDATATest::construct));
00041 s->addTest(new TestCaller<CDATATest>("testing setText",
00042 &CDATATest::setText));
00043 s->addTest(new TestCaller<CDATATest>("testing appendText",
00044 &CDATATest::appendText));
00045 s->addTest(new TestCaller<CDATATest>("testing getText",
00046 &CDATATest::getText));
00047 s->addTest(new TestCaller<CDATATest>("testing toString",
00048 &CDATATest::CDATAtoString));
00049
00050
00051 return s;
00052 }
00053
00054 void CDATATest::construct()
00055 {
00056 {
00057 CDATA c("Hello, world!", strlen("Hello, world!"));
00058 Assert(c._text == "Hello, world!");
00059 }
00060
00061 {
00062 CDATA c("& ' " < >",strlen("& ' " < >"), true);
00063 cerr << c._text << endl;
00064 Assert(c._text == "& ' \" < >");
00065 }
00066
00067 }
00068
00069
00070 void CDATATest::setText()
00071 {
00072 CDATA c("Hello, world!", strlen("Hello, world!"));
00073
00074 c.setText("Yo buddy!", 9);
00075
00076 Assert(c._text == "Yo buddy!");
00077 }
00078
00079 void CDATATest::appendText()
00080 {
00081 CDATA c("Hello, world!", strlen("Hello, world!"));
00082
00083 c.appendText(" Goodbye world!", 15);
00084
00085 Assert(c._text == "Hello, world! Goodbye world!");
00086 }
00087
00088 void CDATATest::getText()
00089 {
00090 CDATA c("Hello, world!", strlen("Hello, world!"));
00091
00092 Assert(c.getText() == "Hello, world!");
00093 }
00094
00095 void CDATATest::CDATAtoString()
00096 {
00097 CDATA c("Hello, world!", strlen("Hello, world!"));
00098
00099 string s = c.toString();
00100
00101 Assert(s == "Hello, world!");
00102 }
00103