2020-12-26 14:12:05 -08:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
2018-01-19 22:31:59 -08:00
|
|
|
|
2024-09-20 17:43:39 -07:00
|
|
|
#include <memory>
|
|
|
|
|
|
2023-08-28 15:13:34 -07:00
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
|
2025-11-07 19:56:21 -05:00
|
|
|
#include "wpi/hal/handles/IndexedClassedHandleResource.h"
|
2018-01-19 22:31:59 -08:00
|
|
|
|
|
|
|
|
#define HAL_TestHandle HAL_Handle
|
|
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
class MyTestClass {};
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|
|
namespace hal {
|
2021-09-17 22:51:51 -07:00
|
|
|
TEST(HandleTest, ClassedHandle) {
|
2018-01-19 22:31:59 -08:00
|
|
|
hal::IndexedClassedHandleResource<HAL_TestHandle, MyTestClass, 8,
|
|
|
|
|
HAL_HandleEnum::Vendor>
|
|
|
|
|
testClass;
|
|
|
|
|
int32_t status = 0;
|
|
|
|
|
testClass.Allocate(0, std::make_unique<MyTestClass>(), &status);
|
|
|
|
|
EXPECT_EQ(0, status);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace hal
|