******************************************************************************
* CTA++, C++ Test Aider, Version 3.0.2 *
* *
* TEST BED TRACE LISTING *
* *
* Copyright (c) 1998-2004 Testwell Oy *
******************************************************************************
CTA++ library, build Feb 5 2004 15:41:54, platform: Windows MSVC++ 6.0
Trace Name : CTA_vsList_trc.txt
Source : G:\Program Files\Testwell\CTA\Examples\vsList2\CTA_vsList_drv.cpp
Cmd Line Params: -o CTA_vsList_trc.txt
Trace Created : Mar 10 2004 11:38:40
Source Compiled: Mar 10 2004 11:19:30
Trace Level : VERBOSE
=== Test Cases ===============================================================
Case 1 : test empty list
89 : - This test case tests the functionality of 'List' methods when called
on an empty 'List' object.
89 :
91 : - Create a List
92 : List l
23 # STUB List_malloc called, BODY(1) active
25 # - Allocating some memory...
26 # Value of size : 64
27 # void* p = malloc(size)
28 # Value of p : 00912D90
29 # return p
94 :
94 : - The List should be initially empty.
95 : ASSERT(l.empty())
97 :
97 : - It means that item count should be 0
98 : ASSERT_EQ(l.itemCount(), 0)
100 :
101 : - An attempt to extract something from an empty list should cause an
exception to be thrown.
102 : int i
103 : ASSERT_EXCEPTION(i = l.extract(), ExceptionEmptyList)
105 :
106 : - Taking an iterator to the begin and end of the list should yield
iterators with the status 'end'
107 : ASSERT(l.begin().end())
*** assertion failure, line 107 in G:\Program Files\Testwell\CTA\Examples\vsList2\CTA_vsList_drv.cpp
108 : ASSERT(l.last().end())
109 : ASSERT(l.rbegin().rend())
111 :
112 : - Trying to access with '*' an item in empty list should cause
exception
113 : ASSERT_EXCEPTION(*l.begin(), ExceptionIteratorOutOfBounds)
*** assertion failure, line 113 in G:\Program Files\Testwell\CTA\Examples\vsList2\CTA_vsList_drv.cpp
actual : no exceptions
expected: exception ExceptionIteratorOutOfBounds
115 :
116 : - Trying to update an empty iterator with '++' should cause exception
117 : ASSERT_EXCEPTION(++(l.begin()), ExceptionIteratorOutOfBounds)
*** assertion failure, line 117 in G:\Program Files\Testwell\CTA\Examples\vsList2\CTA_vsList_drv.cpp
actual : no exceptions
expected: exception ExceptionIteratorOutOfBounds
119 :
119 : - Inserting an item (7) into the list.
120 : l.insert(7)
122 : - The list should no longer be empty.
123 : ASSERT(!l.empty())
125 : - The item count should be 1
126 : ASSERT_EQ(l.itemCount(), 1)
128 : - Extracting the item...
129 : ASSERT_EQ(l.extract(), 7)
131 : - Now the list should be empty again.
132 : ASSERT(l.empty())
133 : ASSERT_EQ(l.itemCount(), 0)
*** assertion failure, line 133 in G:\Program Files\Testwell\CTA\Examples\vsList2\CTA_vsList_drv.cpp
actual : 1
expected: 0
136 : - Now the stub 'List_free' should be invoked because 'l' goes out of
scope and its destructor calls 'List_free'.
137 :
42 # STUB List_free called, BODY(1) active
44 # - Freeing memory
45 # Value of ptr : 00912D90
46 # free(ptr)
Asserts: 13 (passed 9, failed 4)
End of case 1 : test empty list FAIL
------------------------------------------------------------------------------
Case 2/set 1 : test list
DataFile: CTA_vsList_drv.dat
148 : - This test case inserts integers into a 'List', and then extracts
them, asserting that correct items get extracted.
148 :
150 : - At this point we set the verbosity of the stubs to BRIEF.
150 :
152 : List_malloc_stub.beBrief()
153 : List_realloc_stub.beBrief()
154 : List_free_stub.beBrief()
156 :
156 : - Create some variables.
156 :
158 : List l
23 # STUB List_malloc called, BODY(1) active
159 : int i
160 : int n = 0
162 :
162 : - Insert integers read from a data file into List 'l'
165 : td >> i
166 : Value of i : 1
167 : l.insert(i); n++
165 : td >> i
166 : Value of i : 1
167 : l.insert(i); n++
165 : td >> i
166 : Value of i : 2
167 : l.insert(i); n++
165 : td >> i
166 : Value of i : 6
167 : l.insert(i); n++
165 : td >> i
166 : Value of i : -234789
167 : l.insert(i); n++
165 : td >> i
166 : Value of i : 42
167 : l.insert(i); n++
165 : td >> i
166 : Value of i : 64
167 : l.insert(i); n++
170 :
171 : - Assert that item count equals the number of items inserted into the
List
172 : ASSERT_EQ(l.itemCount(), n)
174 :
176 : - Assert that the List contains correct items, i.e. those that were
just inserted there; a List_iterator is created for scanning through
the List
178 : td.rewind()
179 : List_iterator iter = l.begin()
182 : td >> i
183 : Value of i : 1
184 : ASSERT_EQ(*iter, i)
42 # STUB List_free called, BODY(1) active
*** Caught exception ExceptionIteratorOutOfBounds : "operator *"
Asserts: 1 (passed 1, failed 0)
End of case 2/set 1 : test list FAIL
------------------------------------------------------------------------------
Case 2/set 2 : test list
DataFile: CTA_vsList_drv.dat
148 : - This test case inserts integers into a 'List', and then extracts
them, asserting that correct items get extracted.
148 :
150 : - At this point we set the verbosity of the stubs to BRIEF.
150 :
152 : List_malloc_stub.beBrief()
153 : List_realloc_stub.beBrief()
154 : List_free_stub.beBrief()
156 :
156 : - Create some variables.
156 :
158 : List l
23 # STUB List_malloc called, BODY(1) active
159 : int i
160 : int n = 0
162 :
162 : - Insert integers read from a data file into List 'l'
165 : td >> i
166 : Value of i : 2
167 : l.insert(i); n++
165 : td >> i
166 : Value of i : 18
167 : l.insert(i); n++
165 : td >> i
166 : Value of i : 2
167 : l.insert(i); n++
165 : td >> i
166 : Value of i : 5
167 : l.insert(i); n++
165 : td >> i
166 : Value of i : 344
167 : l.insert(i); n++
165 : td >> i
166 : Value of i : 12
167 : l.insert(i); n++
165 : td >> i
166 : Value of i : 32
167 : l.insert(i); n++
165 : td >> i
166 : Value of i : 3
167 : l.insert(i); n++
165 : td >> i
166 : Value of i : 1
167 : l.insert(i); n++
165 : td >> i
166 : Value of i : 2
167 : l.insert(i); n++
165 : td >> i
166 : Value of i : 4
167 : l.insert(i); n++
165 : td >> i
166 : Value of i : -234789
167 : l.insert(i); n++
165 : td >> i
166 : Value of i : 42
167 : l.insert(i); n++
165 : td >> i
166 : Value of i : 64
167 : l.insert(i); n++
170 :
171 : - Assert that item count equals the number of items inserted into the
List
172 : ASSERT_EQ(l.itemCount(), n)
174 :
176 : - Assert that the List contains correct items, i.e. those that were
just inserted there; a List_iterator is created for scanning through
the List
178 : td.rewind()
179 : List_iterator iter = l.begin()
182 : td >> i
183 : Value of i : 2
184 : ASSERT_EQ(*iter, i)
42 # STUB List_free called, BODY(1) active
*** Caught exception ExceptionIteratorOutOfBounds : "operator *"
Asserts: 1 (passed 1, failed 0)
End of case 2/set 2 : test list FAIL
------------------------------------------------------------------------------
Case 2/set 3 : test list
DataFile: CTA_vsList_drv.dat
148 : - This test case inserts integers into a 'List', and then extracts
them, asserting that correct items get extracted.
148 :
150 : - At this point we set the verbosity of the stubs to BRIEF.
150 :
152 : List_malloc_stub.beBrief()
153 : List_realloc_stub.beBrief()
154 : List_free_stub.beBrief()
156 :
156 : - Create some variables.
156 :
158 : List l
23 # STUB List_malloc called, BODY(1) active
159 : int i
160 : int n = 0
162 :
162 : - Insert integers read from a data file into List 'l'
165 : td >> i
166 : Value of i : 4
167 : l.insert(i); n++
165 : td >> i
166 : Value of i : 1
167 : l.insert(i); n++
165 : td >> i
166 : Value of i : 2
167 : l.insert(i); n++
165 : td >> i
166 : Value of i : 0
167 : l.insert(i); n++
165 : td >> i
166 : Value of i : -234789
167 : l.insert(i); n++
165 : td >> i
166 : Value of i : 42
167 : l.insert(i); n++
165 : td >> i
166 : Value of i : 16
167 : l.insert(i); n++
170 :
171 : - Assert that item count equals the number of items inserted into the
List
172 : ASSERT_EQ(l.itemCount(), n)
174 :
176 : - Assert that the List contains correct items, i.e. those that were
just inserted there; a List_iterator is created for scanning through
the List
178 : td.rewind()
179 : List_iterator iter = l.begin()
182 : td >> i
183 : Value of i : 4
184 : ASSERT_EQ(*iter, i)
42 # STUB List_free called, BODY(1) active
*** Caught exception ExceptionIteratorOutOfBounds : "operator *"
Asserts: 1 (passed 1, failed 0)
End of case 2/set 3 : test list FAIL
------------------------------------------------------------------------------
Case 3 : test 'List::remove'
200 : - Test the List method 'remove'
200 :
202 : List l
23 # STUB List_malloc called, BODY(1) active
204 :
204 : - Insert some int's into the List l
204 :
206 : l.insert(3)
207 : l.insert(1)
208 : l.insert(2)
209 : l.insert(0)
210 : l.insert(123)
212 :
213 : - Remove the int's from the list one by one; assert that item count has
decreased accordingly
213 :
215 : ASSERT_EQ(l.itemCount(), 5)
216 : l.remove(2)
217 : ASSERT_EQ(l.itemCount(), 4)
218 : l.remove(3)
219 : ASSERT_EQ(l.itemCount(), 3)
220 : l.remove(123)
221 : ASSERT_EQ(l.itemCount(), 2)
*** assertion failure, line 221 in G:\Program Files\Testwell\CTA\Examples\vsList2\CTA_vsList_drv.cpp
actual : 3
expected: 2
222 : l.remove(0)
223 : ASSERT_EQ(l.itemCount(), 1)
*** assertion failure, line 223 in G:\Program Files\Testwell\CTA\Examples\vsList2\CTA_vsList_drv.cpp
actual : 2
expected: 1
224 : l.remove(1)
225 : ASSERT_EQ(l.itemCount(), 0)
*** assertion failure, line 225 in G:\Program Files\Testwell\CTA\Examples\vsList2\CTA_vsList_drv.cpp
actual : 1
expected: 0
226 : ASSERT(l.empty())
*** assertion failure, line 226 in G:\Program Files\Testwell\CTA\Examples\vsList2\CTA_vsList_drv.cpp
227 : ASSERT_EXCEPTION(l.extract(), ExceptionEmptyList)
*** assertion failure, line 227 in G:\Program Files\Testwell\CTA\Examples\vsList2\CTA_vsList_drv.cpp
actual : no exceptions
expected: exception ExceptionEmptyList
42 # STUB List_free called, BODY(1) active
Asserts: 8 (passed 3, failed 5)
End of case 3 : test 'List::remove' FAIL
------------------------------------------------------------------------------
Case 4 : stress test
238 : - Do a little stress test. Insert a lot of integers!
238 :
240 : Value of stress : 132
242 : List l2
23 # STUB List_malloc called, BODY(1) active
33 # STUB List_realloc called, BODY(1) active
33 # STUB List_realloc called, BODY(1) active
33 # STUB List_realloc called, BODY(1) active
33 # STUB List_realloc called, BODY(1) active
248 : ASSERT_EQ(l2.itemCount(), stress)
250 :
252 : - Now doing so many assertions that BRIEF mode is entered for the time
of the assertions in order to avoid unreasonably long trace...
254 : CTA_TestDriver::whichDriver()->beBrief()
262 : - Assertions done
42 # STUB List_free called, BODY(1) active
Asserts: 133 (passed 133, failed 0)
End of case 4 : stress test PASS
------------------------------------------------------------------------------
Case 5 : out of memory-test
274 : - This test case tests the class 'List' in out-of-memory condition. The
condition is achieved by setting the stubs List_malloc and
List_realloc to return 0 when called. This is done via the
corresponding stub objects List_malloc_stub and List_realloc_stub.
274 :
278 : - Set the stub List_realloc to return 0 when called to simulate the out
of memory condition
279 : List_realloc_stub << (void*)0
281 : List l
23 # STUB List_malloc called, BODY(1) active
283 :
284 : - The statement block below should throw exception at the point where
'insert' finally calls 'List_realloc'!
286 : ASSERT_TRY
288 : l.insert(i*i)
288 : l.insert(i*i)
288 : l.insert(i*i)
288 : l.insert(i*i)
288 : l.insert(i*i)
288 : l.insert(i*i)
288 : l.insert(i*i)
288 : l.insert(i*i)
288 : l.insert(i*i)
288 : l.insert(i*i)
288 : l.insert(i*i)
288 : l.insert(i*i)
288 : l.insert(i*i)
288 : l.insert(i*i)
288 : l.insert(i*i)
288 : l.insert(i*i)
288 : l.insert(i*i)
33 # STUB List_realloc called, return value 00000000
290 : ASSERT_CATCH(ExceptionOutOfMemory)
292 :
293 : - Set the stub List_malloc to return 0 when called to simulate the out
of memory condition
294 : List_malloc_stub << (void*)0
296 : - Try to create a 'List', should throw exception!
297 : ASSERT_EXCEPTION(DECL(List l2), ExceptionOutOfMemory)
297 : List l2
23 # STUB List_malloc called, return value 00000000
42 # STUB List_free called, BODY(1) active
Asserts: 2 (passed 2, failed 0)
End of case 5 : out of memory-test PASS
------------------------------------------------------------------------------
Case 6 : test List_reverse_iterator
305 : - This test case tests the List_reverse_iterator
315 : List l
317 : l.insert(i)
317 : l.insert(i)
317 : l.insert(i)
317 : l.insert(i)
317 : l.insert(i)
317 : l.insert(i)
317 : l.insert(i)
317 : l.insert(i)
317 : l.insert(i)
317 : l.insert(i)
317 : l.insert(i)
319 : List_reverse_iterator riter = l.rbegin()
320 : List l2
322 : l2.insert(*riter)
323 : --riter
322 : l2.insert(*riter)
323 : --riter
322 : l2.insert(*riter)
323 : --riter
322 : l2.insert(*riter)
323 : --riter
322 : l2.insert(*riter)
323 : --riter
322 : l2.insert(*riter)
323 : --riter
322 : l2.insert(*riter)
323 : --riter
322 : l2.insert(*riter)
323 : --riter
322 : l2.insert(*riter)
323 : --riter
322 : l2.insert(*riter)
323 : --riter
326 : List_iterator iter = l2.begin()
327 : riter = l.rbegin()
42 # STUB List_free called, BODY(1) active
42 # STUB List_free called, BODY(1) active
Asserts: 0 (passed 0, failed 0)
End of case 6 : test List_reverse_iterator PASS
------------------------------------------------------------------------------
=== End of Test Cases ========================================================
Test Driver Summary
Assertions: 159 (passed 150, failed 9)
Test Cases: 8 (passed 3, failed 5)
Unexpected Exceptions: 3
Overall: F A I L