blob: 6fc2b8eb11308bf664b4e081c1170c6c227367bd (
plain)
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
36
37
38
|
// Copyright (C) 2018 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0
//
#include <gtest/gtest.h>
#include <gmock/gmock-spec-builders.h>
#include "ie_allocator.hpp"
using namespace ::testing;
using namespace std;
using namespace InferenceEngine;
class SystemAllocatorTests: public ::testing::Test {
protected:
virtual void TearDown() {
}
virtual void SetUp() {
allocator = details::shared_from_irelease(CreateDefaultAllocator());
}
std::shared_ptr<IAllocator> allocator;
public:
};
TEST_F(SystemAllocatorTests, canAllocate) {
EXPECT_NO_THROW(allocator->alloc(100));
}
TEST_F(SystemAllocatorTests, canLockAllocatedMemory) {
//large block such as 10k will result in sigsegv if not allocated
void * handle = allocator->alloc(10000);
char * ptr = (char *)allocator->lock(handle);
ptr [9999] = 11;
ASSERT_EQ(ptr[9999], 11);
}
|