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.
|
2020-07-04 01:09:49 -07:00
|
|
|
|
2023-08-28 15:13:34 -07:00
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
|
2025-11-07 19:56:21 -05:00
|
|
|
#include "wpi/hal/SimDevice.h"
|
|
|
|
|
#include "wpi/hal/simulation/SimDeviceData.h"
|
2020-07-04 01:09:49 -07:00
|
|
|
|
|
|
|
|
namespace hal {
|
|
|
|
|
|
2021-09-17 22:51:51 -07:00
|
|
|
TEST(SimDeviceSimTest, Enabled) {
|
2020-07-04 01:09:49 -07:00
|
|
|
ASSERT_TRUE(HALSIM_IsSimDeviceEnabled("foo"));
|
|
|
|
|
HALSIM_SetSimDeviceEnabled("f", false);
|
|
|
|
|
HALSIM_SetSimDeviceEnabled("foob", true);
|
|
|
|
|
ASSERT_FALSE(HALSIM_IsSimDeviceEnabled("foo"));
|
|
|
|
|
ASSERT_TRUE(HALSIM_IsSimDeviceEnabled("foobar"));
|
|
|
|
|
ASSERT_TRUE(HALSIM_IsSimDeviceEnabled("bar"));
|
|
|
|
|
|
|
|
|
|
ASSERT_EQ(HAL_CreateSimDevice("foo"), 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace hal
|