shmat_ut.cpp 432 B

1234567891011121314151617
  1. #include "shmat.h"
  2. #include <library/cpp/testing/unittest/registar.h>
  3. Y_UNIT_TEST_SUITE(TTestSharedMemory) {
  4. Y_UNIT_TEST(TestInProc) {
  5. TSharedMemory m1;
  6. TSharedMemory m2;
  7. UNIT_ASSERT(m1.Create(128));
  8. UNIT_ASSERT(m2.Open(m1.GetId(), m1.GetSize()));
  9. *(ui32*)m1.GetPtr() = 123;
  10. UNIT_ASSERT_VALUES_EQUAL(*(ui32*)m2.GetPtr(), 123);
  11. }
  12. } // Y_UNIT_TEST_SUITE(TTestSharedMemory)