Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
test_scoped_exit.cpp File Reference
#include <fc/scoped_exit.hpp>
#include <boost/test/included/unit_test.hpp>
Include dependency graph for test_scoped_exit.cpp:

Go to the source code of this file.

Classes

struct  move_only
 

Macros

#define BOOST_TEST_MODULE   scoped_exit
 

Functions

 BOOST_AUTO_TEST_CASE (scoped_exit_test)
 
 BOOST_AUTO_TEST_CASE (cancel)
 
 BOOST_AUTO_TEST_CASE (test_move)
 
 BOOST_AUTO_TEST_CASE (test_forward)
 

Macro Definition Documentation

◆ BOOST_TEST_MODULE

#define BOOST_TEST_MODULE   scoped_exit

Definition at line 3 of file test_scoped_exit.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/4]

BOOST_AUTO_TEST_CASE ( cancel )

Definition at line 20 of file test_scoped_exit.cpp.

20 {
21 bool result = false;
22 {
23 auto g1 = make_scoped_exit([&]{ result = true; });
24 BOOST_TEST(result == false);
25 g1.cancel();
26 }
27 BOOST_TEST(result == false);
28}
scoped_exit< Callback > make_scoped_exit(Callback &&c)
Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [2/4]

BOOST_AUTO_TEST_CASE ( scoped_exit_test )

Definition at line 10 of file test_scoped_exit.cpp.

11{
12 bool result = false;
13 {
14 auto g1 = make_scoped_exit([&]{ result = true; });
15 BOOST_TEST(result == false);
16 }
17 BOOST_TEST(result == true);
18}
Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [3/4]

BOOST_AUTO_TEST_CASE ( test_forward )

Definition at line 51 of file test_scoped_exit.cpp.

51 {
52 auto g = make_scoped_exit(move_only{});
53 auto g2 = std::move(g);
54}
Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [4/4]

BOOST_AUTO_TEST_CASE ( test_move )

Definition at line 30 of file test_scoped_exit.cpp.

30 {
31 bool result = false;
32 {
33 auto g1 = make_scoped_exit([&]{ result = true; });
34 BOOST_TEST(result == false);
35 {
36 auto g2 = std::move(g1);
37 BOOST_TEST(result == false);
38 }
39 BOOST_TEST(result == true);
40 result = false;
41 }
42 BOOST_TEST(result == false);
43}
Here is the call graph for this function: