aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/memory/unittests/safe_memory_reader_ut.cpp
blob: 9873dd80bea0448f7e38bf1aa634de37a709540e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <library/cpp/testing/gtest/gtest.h>

#include <library/cpp/yt/memory/safe_memory_reader.h>

namespace NYT {
namespace {

////////////////////////////////////////////////////////////////////////////////

TEST(TSafeMemoryReaderTest, Simple)
{
    TSafeMemoryReader reader;

    int i = 1;

    int value;
    ASSERT_TRUE(reader.Read(&i, &value));
    ASSERT_EQ(value, 1);

    ASSERT_FALSE(reader.Read(reinterpret_cast<void*>(0x1ee3beef), &value));
}

////////////////////////////////////////////////////////////////////////////////

} // namespace
} // namespace NYT