2018-08-22 16:29:37 +08:00
|
|
|
/*
|
2020-02-23 05:21:06 +08:00
|
|
|
* Copyright (C) 2018-2020 Intel Corporation
|
2018-08-22 16:29:37 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2018-08-22 16:29:37 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include "test.h"
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2018-08-22 16:29:37 +08:00
|
|
|
|
|
|
|
template <typename BaseType, uint32_t ordinal>
|
|
|
|
struct DestructorCounted : public BaseType {
|
|
|
|
template <typename... Args>
|
2018-10-11 17:19:49 +08:00
|
|
|
DestructorCounted(uint32_t &destructorId, Args &&... args) : BaseType(std::forward<Args>(args)...),
|
|
|
|
destructorId(destructorId) {}
|
2018-08-22 16:29:37 +08:00
|
|
|
|
|
|
|
~DestructorCounted() override {
|
|
|
|
EXPECT_EQ(ordinal, destructorId);
|
|
|
|
destructorId++;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
uint32_t &destructorId;
|
|
|
|
};
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|