Fixes indexed classed handle resource (#899)

Nothing in WPILib uses it, so it was not tested
This commit is contained in:
Thad House
2018-01-19 22:31:59 -08:00
committed by Peter Johnson
parent 738a1c015c
commit c00848c060
2 changed files with 33 additions and 11 deletions

View File

@@ -0,0 +1,28 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#include "HAL/HAL.h"
#include "HAL/handles/IndexedClassedHandleResource.h"
#include "gtest/gtest.h"
#define HAL_TestHandle HAL_Handle
namespace {
class MyTestClass {};
} // namespace
namespace hal {
TEST(HandleTests, ClassedHandleTest) {
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