MCPcopy Create free account
hub / github.com/boostorg/asio / test

Function test

test/random_access_file.cpp:48–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46};
47
48void test()
49{
50#if defined(BOOST_ASIO_HAS_FILE)
51 using namespace boost::asio;
52
53 try
54 {
55 io_context ioc;
56 const io_context::executor_type ioc_ex = ioc.get_executor();
57 char mutable_char_buffer[128] = "";
58 const char const_char_buffer[128] = "";
59 archetypes::lazy_handler lazy;
60 boost::system::error_code ec;
61 const std::string path;
62
63 // basic_random_access_file constructors.
64
65 random_access_file file1(ioc);
66 random_access_file file2(ioc, "", random_access_file::read_only);
67 random_access_file file3(ioc, path, random_access_file::read_only);
68 random_access_file::native_handle_type native_file1 = file1.native_handle();
69 random_access_file file4(ioc, native_file1);
70
71 random_access_file file5(ioc_ex);
72 random_access_file file6(ioc_ex, "", random_access_file::read_only);
73 random_access_file file7(ioc_ex, path, random_access_file::read_only);
74 random_access_file::native_handle_type native_file2 = file1.native_handle();
75 random_access_file file8(ioc_ex, native_file2);
76
77 random_access_file file9(std::move(file8));
78
79 basic_random_access_file<io_context::executor_type> file10(ioc);
80 random_access_file file11(std::move(file10));
81
82 // basic_random_access_file operators.
83
84 file1 = random_access_file(ioc);
85 file1 = std::move(file2);
86 file1 = std::move(file10);
87
88 // I/O object functions.
89
90 random_access_file::executor_type ex = file1.get_executor();
91 (void)ex;
92
93 // basic_random_access_file functions.
94
95 file1.open("", random_access_file::read_only);
96 file1.open("", random_access_file::read_only, ec);
97
98 file1.open(path, random_access_file::read_only);
99 file1.open(path, random_access_file::read_only, ec);
100
101 random_access_file::native_handle_type native_file3 = file1.native_handle();
102 file1.assign(native_file3);
103 random_access_file::native_handle_type native_file4 = file1.native_handle();
104 file1.assign(native_file4, ec);
105

Callers

nothing calls this directly

Calls 15

bufferFunction · 0.85
get_executorMethod · 0.45
native_handleMethod · 0.45
openMethod · 0.45
assignMethod · 0.45
is_openMethod · 0.45
closeMethod · 0.45
releaseMethod · 0.45
cancelMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected