diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2003-01-29 08:28:28 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2003-01-29 08:28:28 +0000 |
commit | 8211cbb274297ee36f87090ad82a037f10d9543b (patch) | |
tree | 540c0d3cc22d667efd161cac94895286d9bf7cfb | |
parent | e6ab763e2ff8d9611a3e1545d5c0899199ef7dca (diff) | |
download | ATCD-8211cbb274297ee36f87090ad82a037f10d9543b.tar.gz |
ChangeLogTag: Wed Jan 29 08:27:12 UTC 2002 Johnny Willemsen <jwillemsen@remedy.nl>
-rw-r--r-- | ace/Vector_T.cpp | 2 | ||||
-rw-r--r-- | tests/Vector_Test.cpp | 29 |
2 files changed, 29 insertions, 2 deletions
diff --git a/ace/Vector_T.cpp b/ace/Vector_T.cpp index d6f997a966c..734eab8a2fb 100644 --- a/ace/Vector_T.cpp +++ b/ace/Vector_T.cpp @@ -23,7 +23,7 @@ void ACE_Vector<T, DEFAULT_SIZE>::resize (const size_t new_size, { ACE_Array<T>::size (new_size); if (new_size > length_) - for (size_t i = length_ - 1; i < new_size; ++i) + for (size_t i = length_; i < new_size; ++i) (*this)[i]=t; curr_max_size_ = this->max_size (); diff --git a/tests/Vector_Test.cpp b/tests/Vector_Test.cpp index 69ac40a4b25..4aa410eded8 100644 --- a/tests/Vector_Test.cpp +++ b/tests/Vector_Test.cpp @@ -28,6 +28,7 @@ typedef ACE_Vector<DATA>::Iterator ITERATOR; const size_t TOP = 100; const size_t LEFT = 10; +const size_t RESIZE = 20; int ACE_TMAIN (int, ACE_TCHAR *[]) { @@ -56,7 +57,33 @@ int ACE_TMAIN (int, ACE_TCHAR *[]) vector.size ())); for (i = 0; i < LEFT; ++i) - ACE_ASSERT (vector[i] == i); + { + ACE_ASSERT (vector[i] == i); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("vector[%d]:%d\n"), + i, vector[i])); + } + + vector.resize(RESIZE, 0); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("After resize\n"))); + + for (i = 0; i < RESIZE ; ++i) + { + // The original vector of size LEFT must have the same original contents + // the new elements should have the value 0 (this value is passed as + // second argument of the resize() call. + if (i < LEFT) + { + ACE_ASSERT (vector[i] == i); + } + else + { + ACE_ASSERT (vector[i] == 0); + } + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("vector[%d]:%d\n"), + i, vector[i])); + } vector.clear (); ACE_ASSERT (vector.size () == 0); |