summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjhoffert <jhoffert@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2008-01-10 15:56:38 +0000
committerjhoffert <jhoffert@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2008-01-10 15:56:38 +0000
commitf7a4ec3244ab2754b9953496358d31f567df2288 (patch)
tree1656f782570b7237a79b3f3ddbf0608db8ae9a62
parent4d7819d8a93bdefa24c0685d25ab42a687ca10cc (diff)
downloadATCD-f7a4ec3244ab2754b9953496358d31f567df2288.tar.gz
Fixed use of bracket operator with iterator. The number in the bracket is additive - not absolute.
-rw-r--r--TAO/tests/Sequence_Iterators/StringSeq.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/TAO/tests/Sequence_Iterators/StringSeq.cpp b/TAO/tests/Sequence_Iterators/StringSeq.cpp
index 4441737011d..965a2b4e728 100644
--- a/TAO/tests/Sequence_Iterators/StringSeq.cpp
+++ b/TAO/tests/Sequence_Iterators/StringSeq.cpp
@@ -127,8 +127,13 @@ int test_sequence ()
FAIL_RETURN_IF (ACE_OS::strcmp (a_it[0],a[2]) != 0);
// test operator[] write
- a_it[0] = CORBA::string_dup (elem0_cstr);
- FAIL_RETURN_IF (ACE_OS::strcmp (a[1],elem0_cstr) != 0);
+ // NOTE: This assignment actually modifies the third element
+ // in the sequence since the iterator was previously positioned
+ // at the third element. I believe these are the proper semantics
+ // for using the bracket operator with an iterator. The number
+ // in the brackets is additive - not absolute.
+ a_it[0] = CORBA::string_dup (elem2_cstr);
+ FAIL_RETURN_IF (ACE_OS::strcmp (a[2], elem2_cstr) != 0);
// reset content of sequence a
a[1] = CORBA::string_dup (elem1_cstr);
@@ -149,7 +154,6 @@ int test_sequence ()
// Memory is leaked here from
// TAO::details::string_traits_base<char>::default_initializer()
-
std::copy (a.begin (),
a.end (),
test.begin ());
@@ -165,13 +169,15 @@ int test_sequence ()
}
/// Testing - using ostream_iterator
-
std::ostringstream ostream;
std::copy (a.begin (),
a.end (),
std::ostream_iterator<CORBA::StringSeq::const_value_type> (ostream,
"\n"));
+ // The third sequence element has been modified. Either we need to restore
+ // the original sequence values or modify the test here. I modified the
+ // test since it's easier.
FAIL_RETURN_IF (
ostream.str ().compare ("elem0\nelem1\nelem2\nelem3\n") != 0);