diff options
author | hillj <hillj@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2008-01-14 04:45:44 +0000 |
---|---|---|
committer | hillj <hillj@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2008-01-14 04:45:44 +0000 |
commit | a534914c4a38ccff9df087795e345e3719571f72 (patch) | |
tree | 9527f39318795ec12975ee5a1a1b4334636cb319 /ACE/tests/STL_algorithm_Test_T.cpp | |
parent | 147263fc16f4bcf1511e2c9d446e93289b19d9d9 (diff) | |
download | ATCD-a534914c4a38ccff9df087795e345e3719571f72.tar.gz |
Mon Jan 14 04:41:29 UTC 2008 James H. Hill <hillj@isis.vanderbilt.edu>
Diffstat (limited to 'ACE/tests/STL_algorithm_Test_T.cpp')
-rw-r--r-- | ACE/tests/STL_algorithm_Test_T.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/ACE/tests/STL_algorithm_Test_T.cpp b/ACE/tests/STL_algorithm_Test_T.cpp new file mode 100644 index 00000000000..f12c0aba93b --- /dev/null +++ b/ACE/tests/STL_algorithm_Test_T.cpp @@ -0,0 +1,41 @@ +// $Id$ + +#ifndef ACE_TESTS_STL_ALGORITHM_TEST_T_CPP +#define ACE_TESTS_STL_ALGORITHM_TEST_T_CPP + +#include "test_config.h" +#include <algorithm> +#include <typeinfo> + +template <typename ITEM> +static void +for_each_callback (ITEM & item) +{ + // do nothing; just testing compilation and execution + + ACE_DEBUG ((LM_DEBUG, + "algorithm test: for_each_callback\n")); +} + +template <typename T> +int test_STL_algorithm (T & container) +{ + // We are only validating that the container's iterators compile with + // the <algorithm> header. + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("running STL algorithm test for `%s'\n"), + typeid (T).name ())); + + // Test the (reverse) iterator using std::for_each. + std::for_each (container.begin (), + container.end (), + &for_each_callback <typename T::value_type>); + + std::for_each (container.rbegin (), + container.rend (), + &for_each_callback <typename T::value_type>); + + return 0; +} + +#endif /* ACE_TESTS_STL_ALGORITHM_TEST_T_CPP */ |