mirror of
https://github.com/boostorg/contract.git
synced 2026-02-26 16:42:19 +00:00
started advanced topics section in the docs
This commit is contained in:
@@ -53,7 +53,7 @@ test-suite call_if :
|
||||
test-suite cxx14 :
|
||||
[ subdir-run call_if : equal_to_cxx14 :
|
||||
<toolset>clang:<cxxflags>-std=c++1y ]
|
||||
[ subdir-run call_if : myadvance_cxx14 :
|
||||
[ subdir-run call_if : advance_cxx14 :
|
||||
<toolset>clang:<cxxflags>-std=c++1y ]
|
||||
;
|
||||
explicit cxx14 ;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
boost::contract::aux::test::oteststream out;
|
||||
|
||||
struct equal {
|
||||
struct eq {
|
||||
typedef bool result_type; // Test non-void result type.
|
||||
|
||||
template<typename L, typename R>
|
||||
@@ -28,7 +28,7 @@ int main() {
|
||||
out.str("");
|
||||
out <<
|
||||
boost::contract::call_if<boost::has_equal_to<x> >(
|
||||
boost::bind(equal(), x1, x1) // Compiler-error... but not called.
|
||||
boost::bind(eq(), x1, x1) // Compiler-error... but not called.
|
||||
).else_([] { return false; }) // Test else.
|
||||
<< std::endl;
|
||||
ok.str(""); ok << false << std::endl;
|
||||
@@ -37,7 +37,7 @@ int main() {
|
||||
out.str("");
|
||||
out <<
|
||||
boost::contract::call_if<boost::has_equal_to<x> >(
|
||||
boost::bind(equal(), x1, x2) // Compiler-error... but not called.
|
||||
boost::bind(eq(), x1, x2) // Compiler-error... but not called.
|
||||
).else_([] { return true; })
|
||||
<< std::endl;
|
||||
ok.str(""); ok << true << std::endl;
|
||||
@@ -46,7 +46,7 @@ int main() {
|
||||
out.str("");
|
||||
out << // Test "..._c".
|
||||
boost::contract::call_if_c<boost::has_equal_to<x>::value>(
|
||||
boost::bind(equal(), x1, x2) // Compiler-error...but not called.
|
||||
boost::bind(eq(), x1, x2) // Compiler-error...but not called.
|
||||
).else_([] { return true; })
|
||||
<< std::endl;
|
||||
ok.str(""); ok << true << std::endl;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
boost::contract::aux::test::oteststream out;
|
||||
|
||||
struct equal {
|
||||
struct eq {
|
||||
typedef void result_type; // Test void result type.
|
||||
|
||||
template<typename L, typename R>
|
||||
@@ -27,7 +27,7 @@ int main() {
|
||||
|
||||
out.str("");
|
||||
boost::contract::call_if<boost::has_equal_to<x> >(
|
||||
boost::bind(equal(), x1, x2) // Compiler-error... but not called.
|
||||
boost::bind(eq(), x1, x2) // Compiler-error... but not called.
|
||||
); // Test no else.
|
||||
ok.str("");
|
||||
BOOST_TEST(out.eq(ok.str()));
|
||||
@@ -35,7 +35,7 @@ int main() {
|
||||
out.str("");
|
||||
// Test "..._c".
|
||||
boost::contract::call_if_c<boost::has_equal_to<x>::value>(
|
||||
boost::bind(equal(), x1, x2) // Compiler-error...but not called.
|
||||
boost::bind(eq(), x1, x2) // Compiler-error...but not called.
|
||||
).else_(
|
||||
[] { out << true << std::endl; } // Test else.
|
||||
);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
boost::contract::aux::test::oteststream out;
|
||||
|
||||
struct equal {
|
||||
struct eq {
|
||||
typedef bool result_type; // Test non-void result type.
|
||||
|
||||
template<typename L, typename R>
|
||||
@@ -28,7 +28,7 @@ int main() {
|
||||
out.str("");
|
||||
out <<
|
||||
boost::contract::call_if<boost::has_equal_to<int> >(
|
||||
boost::bind(equal(), 123, 456) // False.
|
||||
boost::bind(eq(), 123, 456) // False.
|
||||
) // Test no else (not called).
|
||||
<< std::endl;
|
||||
ok.str(""); ok << false << std::endl;
|
||||
@@ -37,7 +37,7 @@ int main() {
|
||||
out.str("");
|
||||
out <<
|
||||
boost::contract::call_if<boost::has_equal_to<int> >(
|
||||
boost::bind(equal(), 123, 123) // True.
|
||||
boost::bind(eq(), 123, 123) // True.
|
||||
).else_([] { return false; }) // Test else not called.
|
||||
<< std::endl;
|
||||
ok.str(""); ok << true << std::endl;
|
||||
@@ -46,9 +46,9 @@ int main() {
|
||||
out.str("");
|
||||
out << // Test "..._c".
|
||||
boost::contract::call_if_c<boost::has_equal_to<int>::value>(
|
||||
boost::bind(equal(), 123, 123) // True.
|
||||
boost::bind(eq(), 123, 123) // True.
|
||||
).else_( // Test else not called.
|
||||
boost::bind(equal(), x1, x2) // Compiler-error... but not called.
|
||||
boost::bind(eq(), x1, x2) // Compiler-error... but not called.
|
||||
)
|
||||
<< std::endl;
|
||||
ok.str(""); ok << true << std::endl;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
boost::contract::aux::test::oteststream out;
|
||||
|
||||
struct equal {
|
||||
struct eq {
|
||||
typedef void result_type; // Test void result type.
|
||||
|
||||
template<typename L, typename R>
|
||||
@@ -27,14 +27,14 @@ int main() {
|
||||
|
||||
out.str("");
|
||||
boost::contract::call_if<boost::has_equal_to<int> >(
|
||||
boost::bind(equal(), 123, 456) // False.
|
||||
boost::bind(eq(), 123, 456) // False.
|
||||
); // Test no else (not called).
|
||||
ok.str(""); ok << false << std::endl;
|
||||
BOOST_TEST(out.eq(ok.str()));
|
||||
|
||||
out.str("");
|
||||
boost::contract::call_if<boost::has_equal_to<int> >(
|
||||
boost::bind(equal(), 123, 123) // True.
|
||||
boost::bind(eq(), 123, 123) // True.
|
||||
).else_(
|
||||
[] { return false; }
|
||||
); // Test else (not called).
|
||||
@@ -44,9 +44,9 @@ int main() {
|
||||
out.str("");
|
||||
// Test "..._c".
|
||||
boost::contract::call_if_c<boost::has_equal_to<int>::value>(
|
||||
boost::bind(equal(), 123, 123) // True.
|
||||
boost::bind(eq(), 123, 123) // True.
|
||||
).else_( // Test else (not called).
|
||||
boost::bind(equal(), x1, x2) // Compiler-error... but not called.
|
||||
boost::bind(eq(), x1, x2) // Compiler-error... but not called.
|
||||
);
|
||||
ok.str(""); ok << true << std::endl;
|
||||
BOOST_TEST(out.eq(ok.str()));
|
||||
|
||||
Reference in New Issue
Block a user