#include <cstdio>
#include <cstdlib>
#include <filesystem>
#include <string>
#include <catch2/catch_test_macros.hpp>
#include "mxl-internal/SharedMemory.hpp"
Go to the source code of this file.
◆ TEST_CASE()
| TEST_CASE |
( |
"Create" | , |
|
|
"" | [shared mem] ) |
Definition at line 26 of file test_sharedmem.cpp.
27{
28 auto const p = std::filesystem::path{"./mxl_shmtest_file.bin"};
29 remove(p);
30
32
38
39
40 REQUIRE_THROWS(
41 [&]()
42 {
44 }());
45
51
53
59
60
61 REQUIRE_THROWS(
62 [&]()
63 {
65 }());
66
72
73
74 REQUIRE_NOTHROW(
75 [&]()
76 {
79 }());
80
81
87
88
90
91
93
94 REQUIRE(file_size(p) == TOTAL_SIZE);
95
96
97 REQUIRE_NOTHROW(
98 [&]()
99 {
101 }());
102
103
109
110 auto const writer_data =
writer.get();
111 auto const reader_data =
reader.get();
112
113 writer_data->testData = 99;
114
115
116 REQUIRE(reader_data->testData == 99);
117
118 REQUIRE_NOTHROW(
119 [&]()
120 {
123 }());
124
130
136
137
138 if (exists(p))
139 {
140 remove(p);
141 }
142}
REQUIRE(timeDelta< 33 '366 '667LL)