19 #include <gtest/gtest.h> 22 #include "../../include/ecl/ipc/shared_memory.hpp" 24 #ifdef ECL_HAS_SHARED_MEMORY 36 using ecl::SharedMemory;
61 Data(
double d1 = 0.0,
double d2 = 0.0) {value[0] = d1; value[1] = d2;}
73 using ecl::ipc::tests::Data;
87 TEST(SharedMemoryTests,access) {
89 string name(
"shared_memory");
100 SharedMemory<Data> sm(name.c_str());
101 Data *data = sm.data();
102 EXPECT_EQ(1.3,data->value[0]);
103 EXPECT_EQ(2.3,data->value[1]);
107 std::cout << e.
what() << std::endl;
112 cerr <<
"Failed to fork" << endl;
121 SharedMemory<Data> sm(name.c_str());
122 Data *data = sm.data();
123 data->value[0] = 1.3;
124 data->value[1] = 2.3;
125 EXPECT_EQ(1.3,data->value[0]);
126 EXPECT_EQ(2.3,data->value[1]);
131 std::cout << e.
what() << std::endl;
140 int main(
int argc,
char **argv) {
142 testing::InitGoogleTest(&argc,argv);
143 return RUN_ALL_TESTS();
152 int main(
int argc,
char **argv) {
153 std::cout << std::endl;
154 std::cout <<
"Shared memory is not supported on this platform (or ecl is just lacking)." << std::endl;
155 std::cout << std::endl;
Embedded control libraries.
const char * what() const
TEST(TypeTests, fundamentals)
int main(int argc, char **argv)