Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

TestCharsSeqBug.C

Go to the documentation of this file.
00001 // Copyright (C) 2001, Compaq Computer Corporation
00002 // 
00003 // This file is part of Vesta.
00004 // 
00005 // Vesta is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Lesser General Public
00007 // License as published by the Free Software Foundation; either
00008 // version 2.1 of the License, or (at your option) any later version.
00009 // 
00010 // Vesta is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // Lesser General Public License for more details.
00014 // 
00015 // You should have received a copy of the GNU Lesser General Public
00016 // License along with Vesta; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 
00019 #include <Basics.H>
00020 #include <chars_seq.H>
00021 
00022 using std::endl;
00023 using std::cerr;
00024 using std::cout;
00025 
00026 char *list1[] = {
00027   "PATH=/h/tJJ/McDdIbQ/bA_EeDylDwR/ola/UjN/v69l5IB60x/ITtc_QzMNM/EYzgZKlg/J65Am30j:/SoL:/lAO/QPg:/zAngR422585765Yad",
00028   "PERL5LIB=/G/VgE/MDJ/KWfdh/YyW/COKB/:/J/BqH/hXUiO/zMB/blJG:/OMi/vfqTA/53v3.3/hDQ/IilB0/iAeB_orDg",
00029   "MODEL_ROOT=/b/FjL/uUG/nlKMmc/PRCQCP/WyIFKA-ZNGa-gBs-uN0-51CW35v",
00030   "LM_LICENSE_FILE=/ZsU/Gjig/MBq/MUhWdVs/gtyg/bcX/yGOhFftM/RpI_rWL01:/DoK/MzBi/qKl/TNlXppe/FYNr/ZcV/ASwmjYe/UOH_JEn97:/LNt/LwwX/yFr/gKRJMiy/ohrt/ihI/FSvsOsfg/hef_Fqi04:/bRk/vibY/owb/TczkmNs/trYM/oeD/AiasBaxoDfPaa/mqC_Gig61:/VNF/IIvo/tpU/vkAHsCD/plnw/wyk/bOoSYBi/JiZ_UZp18:/bks/OIlk/eng/uicEsCR/Qskf/pCK/hhfxd/DEl_AQL88:/OAR/vFVC/vYL/VtDUtgC/YTqE/xgz/ohEhpA/KcN_euF97:/BUQ/CYPH/YTI/nXRGZAN/jTap/Snf/JcZLTvN/qZJ_vxA02:/AfV/dBuk/wOy/cwoJUnI/ztE/fFq/VEIohAjo/RwY_uSJ68:/QxQ/xrvn/xrb/rikCQcB/UA/ApR/IxvkizXE/mYe_Qam91:/vSk/gSGY/AqJ/NDahKjB/Wh/rhL/Xnfvsyau/VHZ_qbZ13:/Yuk/FTmS/Qbz/uPjAtvK/Fn/YKW/tCKFuadx/FXe-rEZ_pPN34:/Opw/IYQJ/hEB/mRHWtct/iy/xfl/fpTSVkUF/jWl-WeS_iLH55:/Fus/GEmq/pPK/Ljkjtyz/faB/eWV/kKMUpfPx/rXa_qDN99:0498@PZAAg480.LeG.paBND.lrh:0537@bOnv4173.UAk.DpNZH.wuJ:0160@MyESbOl226.mCU.PiEKA.kcY:1745@YxiD2404.AZ.SfJxm.Uba:8631@nGHE1603.iq.AoExd.lBC:0168@TAuV2367.SH.UxqoT.TVB",
00031   "CHEF_HOME=/m/teU/rgpeavd/Uj_JUnHEenj/AIg/FpZ/Vuhgr/hniE_CvaFa/QgCL/r64JN15x",
00032   "CAD_ROOT=/ZpJ/zZhF/FCD/DvDdH/hvywEGo/wYB",
00033   "SYSTEMSIM_ROOT=/Hwc/heDB/YBl/grGrp/fRJlmrI/nef/nPLwmTHG/PexsNXue/X9.6.8F"
00034 };
00035 
00036 char *list2[] = {
00037   "/usr/bin/ar",
00038   "-q",
00039   "-c",
00040   "libCommTalk",
00041   "CommunicationTower.o",
00042   "rotate_left__34AVLSet__T9GnuStringP12CommunicatorXPP38AVLSetNode__T9GnuStringP12C2e3q28f.o",
00043   "rotate_right__34AVLSet__T9GnuStringP12CommunicatorXPP38AVLSetNode__T9GnuStringP1235p46sc.o"
00044 };
00045 
00046 void Test(chars_seq &result, char *data[], unsigned int data_len)
00047 {
00048   for(unsigned int i = 0; i < data_len; i++)
00049     {
00050       result.append(data[i]);
00051     }
00052 
00053   for(unsigned int i = 0; i < data_len; i++)
00054     {
00055       if(strcmp(result[i], data[i]) != 0)
00056         {
00057           cerr << "Misconpare at " << i << ":" << endl
00058                << "  orig = " << data[i] << endl
00059                << "  copy = " << result[i] << endl;
00060           exit(1);
00061         }
00062     }
00063   
00064 }
00065 
00066 int main()
00067 {
00068   chars_seq *result = NEW_CONSTR(chars_seq, (10, 20));
00069 
00070   Test(*result, list1, sizeof(list1)/sizeof(list1[0]));
00071 
00072   delete result;
00073 
00074   result = NEW_CONSTR(chars_seq, (5, 100));
00075 
00076   Test(*result, list2, sizeof(list2)/sizeof(list2[0]));
00077 
00078   delete result;
00079 
00080   cout << "All tests succeeded!" << endl;
00081   return 0;
00082 }

Generated on Mon May 8 00:48:58 2006 for Vesta by  doxygen 1.4.2