From 0fc30571a28d5eb0bb1153a4f827069a15508ca8 Mon Sep 17 00:00:00 2001 From: Fred Hornsey Date: Wed, 26 Dec 2018 15:46:46 -0600 Subject: Add std iterator subtest to Vector_Test --- ACE/tests/.gitignore | 4 ++++ ACE/tests/Vector_Test.cpp | 31 +++++++++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/ACE/tests/.gitignore b/ACE/tests/.gitignore index c2402c11670..8da5ea9d5fd 100644 --- a/ACE/tests/.gitignore +++ b/ACE/tests/.gitignore @@ -272,3 +272,7 @@ /XtAthenaReactor_Test /XtMotifReactor_Test /XtReactor_Test +/Compiler_Features_36_Test +/Compiler_Features_37_Test +/Compiler_Features_38_Test +/SOCK_Acceptor_Test diff --git a/ACE/tests/Vector_Test.cpp b/ACE/tests/Vector_Test.cpp index 5470166b176..cac2f398faa 100644 --- a/ACE/tests/Vector_Test.cpp +++ b/ACE/tests/Vector_Test.cpp @@ -9,11 +9,10 @@ */ //============================================================================= +#include #include "test_config.h" - - #include "ace/Vector_T.h" typedef size_t DATA; @@ -157,6 +156,34 @@ int run_main (int, ACE_TCHAR *[]) if (v2.size () != 3) ACE_ERROR ((LM_ERROR, ACE_TEXT ("v2's size should be 3\n"))); + // Assert that vector standard iterators work + { + VECTOR vector; + const size_t size = 200; + const size_t offset = 5; + + ACE_TEST_ASSERT (vector.begin () == vector.end ()); + + size_t i; + for (i = 0; i < size; i++) + { + vector.push_back (i + offset); + } + + i = 0; + for (VECTOR::iterator it = vector.begin (); it != vector.end (); ++it) + { + ACE_TEST_ASSERT (*it == i++ + offset); + } + + std::reverse (vector.begin (), vector.end()); + i = size - 1; + for (VECTOR::iterator it = vector.begin (); it != vector.end (); ++it) + { + ACE_TEST_ASSERT (*it == i-- + offset); + } + } + ACE_END_TEST; return 0; -- cgit v1.2.1