Remove uses of std::endl, which imply a flush

This commit is contained in:
Jason Turner
2014-11-13 10:13:51 -07:00
parent 8a30581eaf
commit 63a083b47b
15 changed files with 75 additions and 79 deletions

View File

@@ -15,16 +15,16 @@ bool run_test_type_conversion(const Boxed_Value &bv, bool expectedpass)
use(ret);
} catch (const chaiscript::exception::bad_boxed_cast &/*e*/) {
if (expectedpass) {
// std::cerr << "Failure in run_test_type_conversion: " << e.what() << std::endl;
// std::cerr << "Failure in run_test_type_conversion: " << e.what() << '\n';
return false;
} else {
return true;
}
} catch (const std::exception &e) {
std::cerr << "Unexpected standard exception when attempting cast_conversion: " << e.what() << std::endl;
std::cerr << "Unexpected standard exception when attempting cast_conversion: " << e.what() << '\n';
return false;
} catch (...) {
std::cerr << "Unexpected unknown exception when attempting cast_conversion." << std::endl;
std::cerr << "Unexpected unknown exception when attempting cast_conversion.\n";
return false;
}
@@ -47,7 +47,7 @@ bool test_type_conversion(const Boxed_Value &bv, bool expectedpass)
<< (bv.is_const()?(std::string("const ")):(std::string())) << bv.get_type_info().name()
<< " To: "
<< (std::is_const<To>::value?(std::string("const ")):(std::string())) << typeid(To).name()
<< " test was expected to " << ((expectedpass)?(std::string("succeed")):(std::string("fail"))) << " but did not" << std::endl;
<< " test was expected to " << ((expectedpass)?(std::string("succeed")):(std::string("fail"))) << " but did not\n";
}
return ret;
@@ -264,21 +264,21 @@ bool pointer_test(const T& default_value, const T& new_value)
if (p != (*result) ) {
std::cerr << "Pointer passed in different than one returned" << std::endl;
std::cerr << "Pointer passed in different than one returned\n";
return false;
}
if (*p != *(*result) ) {
std::cerr << "Somehow dereferenced pointer values are not the same?" << std::endl;
std::cerr << "Somehow dereferenced pointer values are not the same?\n";
return false;
}
return true;
} catch (const exception::bad_boxed_cast &) {
std::cerr << "Bad boxed cast performing ** to ** test" << std::endl;
std::cerr << "Bad boxed cast performing ** to ** test\n";
return false;
} catch (...) {
std::cerr << "Unknown exception performing ** to ** test" << std::endl;
std::cerr << "Unknown exception performing ** to ** test\n";
return false;
}

View File

@@ -8,7 +8,7 @@ void assert_equal(const LHS &lhs, const RHS &rhs)
{
return;
} else {
std::cout << "Got: " << lhs << " expected " << rhs << std::endl;
std::cout << "Got: " << lhs << " expected " << rhs << '\n';
exit(EXIT_FAILURE);
}
}

View File

@@ -16,7 +16,7 @@ int test_generic()
}
}
std::cout << "test_generic failed" << std::endl;
std::cout << "test_generic failed\n";
return EXIT_FAILURE;
}
@@ -33,7 +33,7 @@ int test_1()
}
}
std::cout << "test_1 failed" << std::endl;
std::cout << "test_1 failed\n";
return EXIT_FAILURE;
}
@@ -50,7 +50,7 @@ int test_2()
}
}
std::cout << "test_2 failed" << std::endl;
std::cout << "test_2 failed\n";
return EXIT_FAILURE;
}
@@ -61,22 +61,22 @@ int test_5()
try {
chai.eval("throw(runtime_error(\"error\"))", chaiscript::exception_specification<int, double, float, const std::string &, const std::exception &>());
} catch (const double) {
std::cout << "test_5 failed with double" << std::endl;
std::cout << "test_5 failed with double\n";
return EXIT_FAILURE;
} catch (int) {
std::cout << "test_5 failed with int" << std::endl;
std::cout << "test_5 failed with int\n";
return EXIT_FAILURE;
} catch (float) {
std::cout << "test_5 failed with float" << std::endl;
std::cout << "test_5 failed with float\n";
return EXIT_FAILURE;
} catch (const std::string &) {
std::cout << "test_5 failed with string" << std::endl;
std::cout << "test_5 failed with string\n";
return EXIT_FAILURE;
} catch (const std::exception &) {
return EXIT_SUCCESS;
}
std::cout << "test_5 failed" << std::endl;
std::cout << "test_5 failed\n";
return EXIT_FAILURE;
}
@@ -87,22 +87,22 @@ int test_unhandled()
try {
chai.eval("throw(\"error\")", chaiscript::exception_specification<int, double, float, const std::exception &>());
} catch (double) {
std::cout << "test_unhandled failed with double" << std::endl;
std::cout << "test_unhandled failed with double\n";
return EXIT_FAILURE;
} catch (int) {
std::cout << "test_unhandled failed with int" << std::endl;
std::cout << "test_unhandled failed with int\n";
return EXIT_FAILURE;
} catch (float) {
std::cout << "test_unhandled failed with float" << std::endl;
std::cout << "test_unhandled failed with float\n";
return EXIT_FAILURE;
} catch (const std::exception &) {
std::cout << "test_unhandled failed with std::exception" << std::endl;
std::cout << "test_unhandled failed with std::exception\n";
return EXIT_FAILURE;
} catch (const chaiscript::Boxed_Value &) {
return EXIT_SUCCESS;
}
std::cout << "test_unhandled failed" << std::endl;
std::cout << "test_unhandled failed\n";
return EXIT_FAILURE;
}

View File

@@ -7,7 +7,7 @@ bool test_literal(T val, const std::string &str)
{
chaiscript::ChaiScript chai;
T val2 = chai.eval<T>(str);
std::cout << "Comparing : " << val << " " << val2 << std::endl;
std::cout << "Comparing : " << val << " " << val2 << '\n';
return val == val2;
}

View File

@@ -31,7 +31,7 @@ int main()
test_type(chaiscript::user_type<const int *>(), true, true, false, false, false);
test_type(chaiscript::Type_Info(), false, false, false, false, true);
std::cout << "Size of Type_Info " << sizeof(chaiscript::Type_Info) << std::endl;
std::cout << "Size of Type_Info " << sizeof(chaiscript::Type_Info) << '\n';
return EXIT_SUCCESS;
}