ReactOS  0.4.15-dev-494-g1d8c567
RopeTest Class Reference
Inheritance diagram for RopeTest:
Collaboration diagram for RopeTest:

Protected Member Functions

void io ()
 
void find1 ()
 
void find2 ()
 
void construct_from_char ()
 
void bug_report ()
 
void test_saved_rope_iterators ()
 

Private Member Functions

 CPPUNIT_TEST_SUITE (RopeTest)
 
 CPPUNIT_TEST (io)
 
 CPPUNIT_TEST (find1)
 
 CPPUNIT_TEST (find2)
 
 CPPUNIT_TEST (construct_from_char)
 
 CPPUNIT_TEST (bug_report)
 
 CPPUNIT_TEST (test_saved_rope_iterators)
 
 CPPUNIT_TEST_SUITE_END ()
 

Private Attributes

 CPPUNIT_IGNORE
 

Detailed Description

Definition at line 23 of file rope_test.cpp.

Member Function Documentation

◆ bug_report()

void RopeTest::bug_report ( )
protected

Definition at line 105 of file rope_test.cpp.

106 {
107 #if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
108  //first create a rope bigger than crope::_S_copy_max = 23
109  // so that any string addition is added to a new leaf
110  crope evilRope("12345678901234567890123_");
111  //crope* pSevenCharRope( new TRope("1234567") );
112  crope sevenCharRope0("12345678");
113  crope sevenCharRope1("1234567");
114  // add _Rope_RopeRep<c,a>::_S_alloc_granularity-1 = 7 characters
115  evilRope += "1234567"; // creates a new leaf
116  crope sevenCharRope2("1234567");
117  // add one more character to the leaf
118  evilRope += '8'; // here is the write beyond the allocated memory
119  CPPUNIT_ASSERT( strcmp(sevenCharRope2.c_str(), "1234567") == 0 );
120 #endif
121 }
Definition: _rope.h:91
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

◆ construct_from_char()

void RopeTest::construct_from_char ( )
protected

Definition at line 95 of file rope_test.cpp.

96 {
97 #if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
98  crope r('1');
99  char const* s = r.c_str();
100  CPPUNIT_ASSERT( '1' == s[0] && '\0' == s[1] );
101 #endif
102 }
Definition: _rope.h:91
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble s
Definition: gl.h:2039
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200

◆ CPPUNIT_TEST() [1/6]

RopeTest::CPPUNIT_TEST ( io  )
private

◆ CPPUNIT_TEST() [2/6]

RopeTest::CPPUNIT_TEST ( find1  )
private

◆ CPPUNIT_TEST() [3/6]

RopeTest::CPPUNIT_TEST ( find2  )
private

◆ CPPUNIT_TEST() [4/6]

RopeTest::CPPUNIT_TEST ( construct_from_char  )
private

◆ CPPUNIT_TEST() [5/6]

RopeTest::CPPUNIT_TEST ( bug_report  )
private

◆ CPPUNIT_TEST() [6/6]

RopeTest::CPPUNIT_TEST ( test_saved_rope_iterators  )
private

◆ CPPUNIT_TEST_SUITE()

RopeTest::CPPUNIT_TEST_SUITE ( RopeTest  )
private

◆ CPPUNIT_TEST_SUITE_END()

RopeTest::CPPUNIT_TEST_SUITE_END ( )
private

◆ find1()

void RopeTest::find1 ( )
protected

Definition at line 73 of file rope_test.cpp.

74 {
75 #if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
76  crope r("Fuzzy Wuzzy was a bear");
77  crope::size_type n = r.find( "hair" );
79 
80  n = r.find("ear");
81 
82  CPPUNIT_ASSERT( n == (r.size() - 3) );
83 #endif
84 }
Definition: _rope.h:91
size_t size_type
Definition: _rope.h:1092
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static const size_t npos
Definition: _string_npos.h:26
GLdouble n
Definition: glext.h:7729
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200

◆ find2()

void RopeTest::find2 ( )
protected

Definition at line 86 of file rope_test.cpp.

87 {
88 #if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
89  crope r("Fuzzy Wuzzy was a bear");
90  crope::size_type n = r.find( 'e' );
91  CPPUNIT_ASSERT( n == (r.size() - 3) );
92 #endif
93 }
Definition: _rope.h:91
size_t size_type
Definition: _rope.h:1092
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble n
Definition: glext.h:7729
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200

◆ io()

void RopeTest::io ( )
protected

Definition at line 57 of file rope_test.cpp.

58 {
59 #if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) && !defined (_STLP_USE_NO_IOSTREAMS)
60  char const* cstr = "rope test string";
61  crope rstr(cstr);
62 
63  {
64  ostringstream ostr;
65  ostr << rstr;
66 
67  CPPUNIT_ASSERT( ostr );
68  CPPUNIT_ASSERT( ostr.str() == cstr );
69  }
70 #endif
71 }
Definition: _rope.h:91
basic_ostringstream< char, char_traits< char >, allocator< char > > ostringstream
Definition: _iosfwd.h:127
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
LOCAL char * rstr(char *s1, char *s2)
Definition: tree.c:165

◆ test_saved_rope_iterators()

void RopeTest::test_saved_rope_iterators ( )
protected

Definition at line 155 of file rope_test.cpp.

156 {
157 #if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) && \
158  defined (_STLP_MEMBER_TEMPLATES)
159  //
160  // Try and create a rope with a complex tree structure:
161  //
162  // srand(0);
163  crope r = create_rope(300);
164  string expected(r.begin(), r.end());
165  CPPUNIT_ASSERT(expected.size() == r.size());
166  CPPUNIT_ASSERT(equal(expected.begin(), expected.end(), r.begin()));
167  crope::const_iterator i(r.begin()), j(r.end());
168  int pos = 0;
169  while(i != j)
170  {
172  // This initial read triggers the bug:
173  CPPUNIT_ASSERT(*i);
174  k = i;
175  int newpos = pos;
176  // Now make sure that i is incremented into the next leaf:
177  while(i != j)
178  {
179  CPPUNIT_ASSERT(*i == expected[newpos]);
180  ++i;
181  ++newpos;
182  }
183  // Back up from stored value and continue:
184  i = k;
185  ++i;
186  ++pos;
187  }
188 #endif
189 }
Definition: _rope.h:91
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define equal(x, y)
Definition: reader.cc:56
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
int k
Definition: mpi.c:3369
BOOL expected
Definition: store.c:2063

Member Data Documentation

◆ CPPUNIT_IGNORE

RopeTest::CPPUNIT_IGNORE
private

Definition at line 27 of file rope_test.cpp.


The documentation for this class was generated from the following file: