Blame test/static_kinds_tests.cpp
|
Packit Service |
7f3b24 |
// SPDX-License-Identifier: BSD-2-Clause
|
|
Packit Service |
7f3b24 |
/* Copyright (C) 2014 - 2020 Intel Corporation. */
|
|
Packit |
345191 |
|
|
Packit |
345191 |
#include "memkind.h"
|
|
Packit |
345191 |
#include "memkind/internal/memkind_private.h"
|
|
Packit |
345191 |
|
|
Packit |
345191 |
#include "common.h"
|
|
Packit |
345191 |
#include "static_kinds_list.h"
|
|
Packit |
345191 |
|
|
Packit |
345191 |
/*
|
|
Packit |
345191 |
* Set of tests for checking if static kinds meets non-trivial assumptions
|
|
Packit |
345191 |
*/
|
|
Packit |
345191 |
|
|
Packit |
345191 |
class StaticKindsTest: public :: testing::Test
|
|
Packit |
345191 |
{
|
|
Packit |
345191 |
public:
|
|
Packit |
345191 |
|
|
Packit |
345191 |
protected:
|
|
Packit |
345191 |
void SetUp()
|
|
Packit |
345191 |
{
|
|
Packit |
345191 |
}
|
|
Packit |
345191 |
};
|
|
Packit |
345191 |
|
|
Packit |
345191 |
|
|
Packit |
345191 |
/*
|
|
Packit |
345191 |
* Assumption: all static kinds should implement init_once operation
|
|
Packit |
345191 |
* Reason: init_once should perform memkind_register (and other initialization if needed)
|
|
Packit |
345191 |
* we are also using that fact to optimize initialization on first use (in memkind_malloc etc.)
|
|
Packit |
345191 |
*/
|
|
Packit |
345191 |
TEST_F(StaticKindsTest, test_TC_MEMKIND_STATIC_KINDS_INIT_ONCE)
|
|
Packit |
345191 |
{
|
|
Packit |
345191 |
for(size_t i=0; i<(sizeof(static_kinds_list)/sizeof(static_kinds_list[0]));
|
|
Packit |
345191 |
i++) {
|
|
Packit |
345191 |
ASSERT_TRUE(static_kinds_list[i]->ops->init_once != NULL) <<
|
|
Packit |
345191 |
static_kinds_list[i]->name << " does not implement init_once operation!";
|
|
Packit |
345191 |
}
|
|
Packit |
345191 |
}
|
|
Packit |
345191 |
|