static void fe_tests (void) { /* clear all exceptions and test if all are cleared */ feclearexcept (FE_ALL_EXCEPT); test_exceptions ("feclearexcept (FE_ALL_EXCEPT) clears all exceptions", NO_EXC, 0); /* raise all exceptions and test if all are raised */ feraiseexcept (FE_ALL_EXCEPT); test_exceptions ("feraiseexcept (FE_ALL_EXCEPT) raises all exceptions", ALL_EXC, 0); feclearexcept (FE_ALL_EXCEPT); #ifdef FE_DIVBYZERO set_single_exc ("Set/Clear FE_DIVBYZERO", DIVBYZERO_EXC, FE_DIVBYZERO); #endif #ifdef FE_INVALID set_single_exc ("Set/Clear FE_INVALID", INVALID_EXC, FE_INVALID); #endif #ifdef FE_INEXACT set_single_exc ("Set/Clear FE_INEXACT", INEXACT_EXC, FE_INEXACT); #endif #ifdef FE_UNDERFLOW set_single_exc ("Set/Clear FE_UNDERFLOW", UNDERFLOW_EXC, FE_UNDERFLOW); #endif #ifdef FE_OVERFLOW set_single_exc ("Set/Clear FE_OVERFLOW", OVERFLOW_EXC, FE_OVERFLOW); #endif }
static int do_test (void) { /* clear all exceptions and test if all are cleared */ feclearexcept (FE_ALL_EXCEPT); test_exceptions ("feclearexcept (FE_ALL_EXCEPT) clears all exceptions", NO_EXC); /* raise all exceptions and test if all are raised */ feraiseexcept (FE_ALL_EXCEPT); if (EXCEPTION_TESTS (float)) test_exceptions ("feraiseexcept (FE_ALL_EXCEPT) raises all exceptions", ALL_EXC); /* Same test, but using double as argument */ feclearexcept ((double)FE_ALL_EXCEPT); test_exceptions ("feclearexcept ((double)FE_ALL_EXCEPT) clears all exceptions", NO_EXC); feraiseexcept ((double)FE_ALL_EXCEPT); if (EXCEPTION_TESTS (float)) test_exceptions ("feraiseexcept ((double)FE_ALL_EXCEPT) raises all exceptions", ALL_EXC); if (EXCEPTION_TESTS (float)) test_exceptionflag (); test_fesetround (); test_feenabledisable (); return count_errors; }
static void set_single_exc (const char *test_name, int fe_exc, fexcept_t exception) { char str[200]; /* The standard allows the inexact exception to be set together with the underflow and overflow exceptions. So ignore the inexact flag if the others are raised. */ int ignore_inexact = (fe_exc & (UNDERFLOW_EXC | OVERFLOW_EXC)) != 0; strcpy (str, test_name); strcat (str, ": set flag, with rest not set"); feclearexcept (FE_ALL_EXCEPT); feraiseexcept (exception); test_exceptions (str, fe_exc, ignore_inexact); strcpy (str, test_name); strcat (str, ": clear flag, rest also unset"); feclearexcept (exception); test_exceptions (str, NO_EXC, ignore_inexact); strcpy (str, test_name); strcat (str, ": set flag, with rest set"); feraiseexcept (FE_ALL_EXCEPT ^ exception); feraiseexcept (exception); test_exceptions (str, ALL_EXC, 0); strcpy (str, test_name); strcat (str, ": clear flag, leave rest set"); feclearexcept (exception); test_exceptions (str, ALL_EXC ^ fe_exc, 0); }
/* IEC 559 and ISO C99 define a default startup environment */ static void initial_tests (void) { test_exceptions ("Initially all exceptions should be cleared", NO_EXC, 0); #ifdef FE_TONEAREST test_rounding ("Rounding direction should be initalized to nearest", FE_TONEAREST); #endif }
int test_parameters( int, char*[] ) { test_simple(); test_braces(); test_conditionals(); test_escapes(); test_exceptions(); cout << failures << " test(s) failed\n"; return failures ? 1 : 0; }
int main(int argc, char *argv[]) { trivial(); test_gaps(); test_exceptions(); test_rehashing_items_placed_beyond_nitems(); test_iterating(); test_fill_with_deleted_items(); (void)argc; (void)argv; return 0; }
int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { int status = 0; try { CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); ::Test::vtp_init *vtp_factory = 0; ACE_NEW_THROW_EX (vtp_factory, ::Test::vtp_init, CORBA::NO_MEMORY ()); CORBA::ValueFactoryBase_var vtp_factory_owner = vtp_factory; orb->register_value_factory (vtp_factory->tao_repository_id (), vtp_factory); if (parse_args (argc, argv) != 0) return 1; CORBA::Object_var object = orb->string_to_object (ior); Test::A_var server = Test::A::_narrow (object.in ()); if (CORBA::is_nil (server.in ())) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Object reference <%s> is nil\n"), ior), 1); } status |= test_strings (server.in ()); status |= test_sequences (server.in ()); status |= test_arrays (server.in ()); status |= test_structs (server.in ()); status |= test_unions (server.in ()); status |= test_valueboxes (server.in ()); status |= test_valuetypes (server.in (), vtp_factory); status |= test_exceptions (server.in ()); server->shutdown (); orb->destroy (); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Caught exception in client:"); return 1; } return status; }
int Test::all() { clock_t begin = clock(); exeTime = 0; test_general(); test_types(); test_booleans(); test_numbers(); test_strings(); test_arrays(); test_intervals(); test_map(); test_set(); test_objects(); test_functions(); test_classes(); test_loops(); test_operators(); test_references(); test_exceptions(); test_operations(); test_system(); test_json(); test_files(); test_doc(); test_utils(); double elapsed_secs = double(clock() - begin) / CLOCKS_PER_SEC; int errors = (total - success_count); int leaks = (obj_created - obj_deleted); int mpz_leaks = (mpz_obj_created - mpz_obj_deleted); std::ostringstream line1, line2, line3, line4; line1 << "Total : " << total << ", success : " << success_count << ", errors : " << errors; line2 << "Total time : " << elapsed_secs * 1000 << " ms"; line3 << "Objects destroyed : " << obj_deleted << " / " << obj_created << " (" << leaks << " leaked)"; line4 << "MPZ objects destroyed : " << mpz_obj_deleted << " / " << mpz_obj_created << " (" << mpz_leaks << " leaked)"; unsigned w = std::max(line1.str().size(), std::max(line2.str().size(), std::max(line3.str().size(), line4.str().size()))); auto pad = [](std::string s, int l) { l -= s.size(); while (l-- > 0) s += " "; return s; }; std::cout << "┌"; for (unsigned i = 0; i < w + 2; ++i) std::cout << "─"; std::cout << "┐" << std::endl; std::cout << "│ " << pad(line1.str(), w) << " │" << std::endl; std::cout << "│ " << pad(line2.str(), w) << " │" << std::endl; std::cout << "│ " << pad(line3.str(), w) << " │" << std::endl; std::cout << "│ " << pad(line4.str(), w) << " │" << std::endl; std::cout << "├"; for (unsigned i = 0; i < w + 2; ++i) std::cout << "─"; std::cout << "┤"; std::cout << std::endl; int result = abs(errors) + abs(leaks) + abs(mpz_leaks); if (result == 0) { std::cout << "│ " << pad("GOOD! ✔", w + 2) << " │" << std::endl; } else { std::cout << "│ " << pad("BAD! : " + std::to_string(result) + " error(s) ✘", w + 2) << " │" << std::endl; } std::cout << "└"; for (unsigned i = 0; i < w + 2; ++i) std::cout << "─"; std::cout << "┘" << std::endl; for (const auto& error : failed_tests) { std::cout << " " << error << std::endl; } if (failed_tests.size()) { std::cout << std::endl; } return result; }
static void feholdexcept_tests (void) { fenv_t saved, saved2; int res; feclearexcept (FE_ALL_EXCEPT); fedisableexcept (FE_ALL_EXCEPT); #ifdef FE_DIVBYZERO feraiseexcept (FE_DIVBYZERO); #endif test_exceptions ("feholdexcept_tests FE_DIVBYZERO test", DIVBYZERO_EXC, 0); res = feholdexcept (&saved); if (res != 0) { printf ("feholdexcept failed: %d\n", res); ++count_errors; } #if defined FE_TONEAREST && defined FE_TOWARDZERO res = fesetround (FE_TOWARDZERO); if (res != 0) { printf ("fesetround failed: %d\n", res); ++count_errors; } #endif test_exceptions ("feholdexcept_tests 0 test", NO_EXC, 0); #ifdef FE_INVALID feraiseexcept (FE_INVALID); test_exceptions ("feholdexcept_tests FE_INVALID test", INVALID_EXC, 0); #endif res = feupdateenv (&saved); if (res != 0) { printf ("feupdateenv failed: %d\n", res); ++count_errors; } #if defined FE_TONEAREST && defined FE_TOWARDZERO res = fegetround (); if (res != FE_TONEAREST) { printf ("feupdateenv didn't restore rounding mode: %d\n", res); ++count_errors; } #endif test_exceptions ("feholdexcept_tests FE_DIVBYZERO|FE_INVALID test", DIVBYZERO_EXC | INVALID_EXC, 0); feclearexcept (FE_ALL_EXCEPT); #ifdef FE_INVALID feraiseexcept (FE_INVALID); #endif #if defined FE_TONEAREST && defined FE_UPWARD res = fesetround (FE_UPWARD); if (res != 0) { printf ("fesetround failed: %d\n", res); ++count_errors; } #endif res = feholdexcept (&saved2); if (res != 0) { printf ("feholdexcept failed: %d\n", res); ++count_errors; } #if defined FE_TONEAREST && defined FE_UPWARD res = fesetround (FE_TONEAREST); if (res != 0) { printf ("fesetround failed: %d\n", res); ++count_errors; } #endif test_exceptions ("feholdexcept_tests 0 2nd test", NO_EXC, 0); #ifdef FE_INEXACT feraiseexcept (FE_INEXACT); test_exceptions ("feholdexcept_tests FE_INEXACT test", INEXACT_EXC, 0); #endif res = feupdateenv (&saved2); if (res != 0) { printf ("feupdateenv failed: %d\n", res); ++count_errors; } #if defined FE_TONEAREST && defined FE_UPWARD res = fegetround (); if (res != FE_UPWARD) { printf ("feupdateenv didn't restore rounding mode: %d\n", res); ++count_errors; } fesetround (FE_TONEAREST); #endif test_exceptions ("feholdexcept_tests FE_INEXACT|FE_INVALID test", INVALID_EXC | INEXACT_EXC, 0); feclearexcept (FE_ALL_EXCEPT); }
void test_main(void) { test_to_json(); test_from_json(); test_exceptions(); test_utf8(); }
int main() { { typedef std::string S; const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; test(S(), s, s, S()); test(S(), s, s+1, S("A")); test(S(), s, s+10, S("ABCDEFGHIJ")); test(S(), s, s+52, S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); test(S("12345"), s, s, S()); test(S("12345"), s, s+1, S("A")); test(S("12345"), s, s+10, S("ABCDEFGHIJ")); test(S("12345"), s, s+52, S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); test(S("1234567890"), s, s, S()); test(S("1234567890"), s, s+1, S("A")); test(S("1234567890"), s, s+10, S("ABCDEFGHIJ")); test(S("1234567890"), s, s+52, S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); test(S("12345678901234567890"), s, s, S()); test(S("12345678901234567890"), s, s+1, S("A")); test(S("12345678901234567890"), s, s+10, S("ABCDEFGHIJ")); test(S("12345678901234567890"), s, s+52, S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); test(S(), input_iterator<const char*>(s), input_iterator<const char*>(s), S()); test(S(), input_iterator<const char*>(s), input_iterator<const char*>(s+1), S("A")); test(S(), input_iterator<const char*>(s), input_iterator<const char*>(s+10), S("ABCDEFGHIJ")); test(S(), input_iterator<const char*>(s), input_iterator<const char*>(s+52), S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); test(S("12345"), input_iterator<const char*>(s), input_iterator<const char*>(s), S()); test(S("12345"), input_iterator<const char*>(s), input_iterator<const char*>(s+1), S("A")); test(S("12345"), input_iterator<const char*>(s), input_iterator<const char*>(s+10), S("ABCDEFGHIJ")); test(S("12345"), input_iterator<const char*>(s), input_iterator<const char*>(s+52), S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); test(S("1234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s), S()); test(S("1234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s+1), S("A")); test(S("1234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s+10), S("ABCDEFGHIJ")); test(S("1234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s+52), S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); test(S("12345678901234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s), S()); test(S("12345678901234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s+1), S("A")); test(S("12345678901234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s+10), S("ABCDEFGHIJ")); test(S("12345678901234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s+52), S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); } #if TEST_STD_VER >= 11 { typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; test(S(), s, s, S()); test(S(), s, s+1, S("A")); test(S(), s, s+10, S("ABCDEFGHIJ")); test(S(), s, s+52, S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); test(S("12345"), s, s, S()); test(S("12345"), s, s+1, S("A")); test(S("12345"), s, s+10, S("ABCDEFGHIJ")); test(S("12345"), s, s+52, S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); test(S("1234567890"), s, s, S()); test(S("1234567890"), s, s+1, S("A")); test(S("1234567890"), s, s+10, S("ABCDEFGHIJ")); test(S("1234567890"), s, s+52, S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); test(S("12345678901234567890"), s, s, S()); test(S("12345678901234567890"), s, s+1, S("A")); test(S("12345678901234567890"), s, s+10, S("ABCDEFGHIJ")); test(S("12345678901234567890"), s, s+52, S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); test(S(), input_iterator<const char*>(s), input_iterator<const char*>(s), S()); test(S(), input_iterator<const char*>(s), input_iterator<const char*>(s+1), S("A")); test(S(), input_iterator<const char*>(s), input_iterator<const char*>(s+10), S("ABCDEFGHIJ")); test(S(), input_iterator<const char*>(s), input_iterator<const char*>(s+52), S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); test(S("12345"), input_iterator<const char*>(s), input_iterator<const char*>(s), S()); test(S("12345"), input_iterator<const char*>(s), input_iterator<const char*>(s+1), S("A")); test(S("12345"), input_iterator<const char*>(s), input_iterator<const char*>(s+10), S("ABCDEFGHIJ")); test(S("12345"), input_iterator<const char*>(s), input_iterator<const char*>(s+52), S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); test(S("1234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s), S()); test(S("1234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s+1), S("A")); test(S("1234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s+10), S("ABCDEFGHIJ")); test(S("1234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s+52), S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); test(S("12345678901234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s), S()); test(S("12345678901234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s+1), S("A")); test(S("12345678901234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s+10), S("ABCDEFGHIJ")); test(S("12345678901234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s+52), S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); } #endif #ifndef TEST_HAS_NO_EXCEPTIONS { // test iterator operations that throw typedef std::string S; typedef ThrowingIterator<char> TIter; typedef input_iterator<TIter> IIter; const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; test_exceptions(S(), IIter(TIter(s, s+10, 4, TIter::TAIncrement)), IIter()); test_exceptions(S(), IIter(TIter(s, s+10, 5, TIter::TADereference)), IIter()); test_exceptions(S(), IIter(TIter(s, s+10, 6, TIter::TAComparison)), IIter()); test_exceptions(S(), TIter(s, s+10, 4, TIter::TAIncrement), TIter()); test_exceptions(S(), TIter(s, s+10, 5, TIter::TADereference), TIter()); test_exceptions(S(), TIter(s, s+10, 6, TIter::TAComparison), TIter()); } #endif { // test assigning to self typedef std::string S; S s_short = "123/"; S s_long = "Lorem ipsum dolor sit amet, consectetur/"; s_short.assign(s_short.begin(), s_short.end()); assert(s_short == "123/"); s_short.assign(s_short.begin() + 2, s_short.end()); assert(s_short == "3/"); s_long.assign(s_long.begin(), s_long.end()); assert(s_long == "Lorem ipsum dolor sit amet, consectetur/"); s_long.assign(s_long.begin() + 30, s_long.end()); assert(s_long == "nsectetur/"); } { // test assigning a different type typedef std::string S; const uint8_t p[] = "ABCD"; S s; s.assign(p, p + 4); assert(s == "ABCD"); } }
int main() { { typedef std::string S; const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; test(S(), s, s, S()); test(S(), s, s+1, S("A")); test(S(), s, s+10, S("ABCDEFGHIJ")); test(S(), s, s+52, S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); test(S("12345"), s, s, S("12345")); test(S("12345"), s, s+1, S("12345A")); test(S("12345"), s, s+10, S("12345ABCDEFGHIJ")); test(S("12345"), s, s+52, S("12345ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); test(S("1234567890"), s, s, S("1234567890")); test(S("1234567890"), s, s+1, S("1234567890A")); test(S("1234567890"), s, s+10, S("1234567890ABCDEFGHIJ")); test(S("1234567890"), s, s+52, S("1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); test(S("12345678901234567890"), s, s, S("12345678901234567890")); test(S("12345678901234567890"), s, s+1, S("12345678901234567890""A")); test(S("12345678901234567890"), s, s+10, S("12345678901234567890""ABCDEFGHIJ")); test(S("12345678901234567890"), s, s+52, S("12345678901234567890""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); test(S(), input_iterator<const char*>(s), input_iterator<const char*>(s), S()); test(S(), input_iterator<const char*>(s), input_iterator<const char*>(s+1), S("A")); test(S(), input_iterator<const char*>(s), input_iterator<const char*>(s+10), S("ABCDEFGHIJ")); test(S(), input_iterator<const char*>(s), input_iterator<const char*>(s+52), S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); test(S("12345"), input_iterator<const char*>(s), input_iterator<const char*>(s), S("12345")); test(S("12345"), input_iterator<const char*>(s), input_iterator<const char*>(s+1), S("12345A")); test(S("12345"), input_iterator<const char*>(s), input_iterator<const char*>(s+10), S("12345ABCDEFGHIJ")); test(S("12345"), input_iterator<const char*>(s), input_iterator<const char*>(s+52), S("12345ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); test(S("1234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s), S("1234567890")); test(S("1234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s+1), S("1234567890A")); test(S("1234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s+10), S("1234567890ABCDEFGHIJ")); test(S("1234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s+52), S("1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); test(S("12345678901234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s), S("12345678901234567890")); test(S("12345678901234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s+1), S("12345678901234567890""A")); test(S("12345678901234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s+10), S("12345678901234567890""ABCDEFGHIJ")); test(S("12345678901234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s+52), S("12345678901234567890""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); } #if TEST_STD_VER >= 11 { typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; test(S(), s, s, S()); test(S(), s, s+1, S("A")); test(S(), s, s+10, S("ABCDEFGHIJ")); test(S(), s, s+52, S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); test(S("12345"), s, s, S("12345")); test(S("12345"), s, s+1, S("12345A")); test(S("12345"), s, s+10, S("12345ABCDEFGHIJ")); test(S("12345"), s, s+52, S("12345ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); test(S("1234567890"), s, s, S("1234567890")); test(S("1234567890"), s, s+1, S("1234567890A")); test(S("1234567890"), s, s+10, S("1234567890ABCDEFGHIJ")); test(S("1234567890"), s, s+52, S("1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); test(S("12345678901234567890"), s, s, S("12345678901234567890")); test(S("12345678901234567890"), s, s+1, S("12345678901234567890""A")); test(S("12345678901234567890"), s, s+10, S("12345678901234567890""ABCDEFGHIJ")); test(S("12345678901234567890"), s, s+52, S("12345678901234567890""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); test(S(), input_iterator<const char*>(s), input_iterator<const char*>(s), S()); test(S(), input_iterator<const char*>(s), input_iterator<const char*>(s+1), S("A")); test(S(), input_iterator<const char*>(s), input_iterator<const char*>(s+10), S("ABCDEFGHIJ")); test(S(), input_iterator<const char*>(s), input_iterator<const char*>(s+52), S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); test(S("12345"), input_iterator<const char*>(s), input_iterator<const char*>(s), S("12345")); test(S("12345"), input_iterator<const char*>(s), input_iterator<const char*>(s+1), S("12345A")); test(S("12345"), input_iterator<const char*>(s), input_iterator<const char*>(s+10), S("12345ABCDEFGHIJ")); test(S("12345"), input_iterator<const char*>(s), input_iterator<const char*>(s+52), S("12345ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); test(S("1234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s), S("1234567890")); test(S("1234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s+1), S("1234567890A")); test(S("1234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s+10), S("1234567890ABCDEFGHIJ")); test(S("1234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s+52), S("1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); test(S("12345678901234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s), S("12345678901234567890")); test(S("12345678901234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s+1), S("12345678901234567890""A")); test(S("12345678901234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s+10), S("12345678901234567890""ABCDEFGHIJ")); test(S("12345678901234567890"), input_iterator<const char*>(s), input_iterator<const char*>(s+52), S("12345678901234567890""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); } #endif #ifndef TEST_HAS_NO_EXCEPTIONS { // test iterator operations that throw typedef std::string S; typedef ThrowingIterator<char> TIter; typedef input_iterator<TIter> IIter; const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; test_exceptions(S(), IIter(TIter(s, s+10, 4, TIter::TAIncrement)), IIter()); test_exceptions(S(), IIter(TIter(s, s+10, 5, TIter::TADereference)), IIter()); test_exceptions(S(), IIter(TIter(s, s+10, 6, TIter::TAComparison)), IIter()); test_exceptions(S(), TIter(s, s+10, 4, TIter::TAIncrement), TIter()); test_exceptions(S(), TIter(s, s+10, 5, TIter::TADereference), TIter()); test_exceptions(S(), TIter(s, s+10, 6, TIter::TAComparison), TIter()); } #endif }