Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members  

GlobalsTest.cpp

00001 //============================================================================
00002 // Project:       Jabber Universal Document Objects (Judo)
00003 // Filename:      GlobalsTest.cpp
00004 // Description:   judo global function tests
00005 // Created at:    Tue Jul  3 13:06:11 2001
00006 // Modified at:   Mon Jul 30 18:10:54 2001
00007 //
00008 //   License:
00009 // 
00010 // The contents of this file are subject to the Jabber Open Source License
00011 // Version 1.0 (the "License").  You may not copy or use this file, in either
00012 // source code or executable form, except in compliance with the License.  You
00013 // may obtain a copy of the License at http://www.jabber.com/license/ or at
00014 // http://www.opensource.org/.  
00015 //
00016 // Software distributed under the License is distributed on an "AS IS" basis,
00017 // WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the License
00018 // for the specific language governing rights and limitations under the
00019 // License.
00020 //
00021 //   Copyrights
00022 //
00023 // Portions created by or assigned to Jabber.com, Inc. are 
00024 // Copyright (c) 1999-2001 Jabber.com, Inc.  All Rights Reserved.  
00025 // 
00026 // $Id: GlobalsTest.cpp,v 1.2 2002/07/13 19:30:22 temas Exp $
00027 //============================================================================
00028 
00029 #include "judo.hpp"
00030 #include "judo_test.hpp"
00031 using namespace judo;
00032 using namespace std;
00033 
00034 Test* GlobalsTest::getTestSuite()
00035 {
00036     TestSuite* s = new TestSuite();
00037     s->addTest(new TestCaller<GlobalsTest>("testing XML escaping",
00038                                            &GlobalsTest::escape));
00039     s->addTest(new TestCaller<GlobalsTest>("testing XML unescape",
00040                                            &GlobalsTest::unescape));
00041     return s;
00042 }
00043 
00044 const string G_escaped = "&amp; me &apos; you &quot; &lt; 23 &gt; 5";
00045 const string G_unescaped = "& me ' you \" < 23 > 5";
00046 
00047 void GlobalsTest::escape()
00048 {
00049     Assert(G_escaped == judo::escape(G_unescaped));
00050 }
00051 
00052 void GlobalsTest::unescape()
00053 {
00054     string target;
00055 
00056     judo::unescape(G_escaped.c_str(), G_escaped.size(), target);
00057 
00058     Assert(G_unescaped == target);
00059 }

Generated on Thu Jul 24 13:31:50 2003 for jabberoo by doxygen1.3-rc3