forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aligned_buffer.cpp
35 lines (30 loc) · 945 Bytes
/
aligned_buffer.cpp
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
28
29
30
31
32
33
34
35
// Copyright (C) 2018-2024 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "openvino/runtime/aligned_buffer.hpp"
#include "gtest/gtest.h"
using namespace ov;
TEST(aligned_buffer, alignment) {
AlignedBuffer buffer(100, 64);
size_t addr = reinterpret_cast<size_t>(buffer.get_ptr()) % 64;
EXPECT_EQ(addr, 0);
}
TEST(aligned_buffer, move) {
{
AlignedBuffer buffer1(100, 64);
AlignedBuffer buffer2(std::move(buffer1));
EXPECT_EQ(buffer1.size(), 0);
EXPECT_EQ(buffer1.get_ptr(), nullptr);
EXPECT_EQ(buffer2.size(), 100);
EXPECT_NE(buffer2.get_ptr(), nullptr);
}
{
AlignedBuffer buffer1(100, 64);
AlignedBuffer buffer2;
buffer2 = std::move(buffer1);
EXPECT_EQ(buffer1.size(), 0);
EXPECT_EQ(buffer1.get_ptr(), nullptr);
EXPECT_EQ(buffer2.size(), 100);
EXPECT_NE(buffer2.get_ptr(), nullptr);
}
}