2024-01-12 10:53:56 -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.
|
|
|
|
|
|
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
|
2025-11-07 19:56:21 -05:00
|
|
|
#include "wpi/event/EventLoop.hpp"
|
2025-11-07 19:57:55 -05:00
|
|
|
#include "wpi/system/Errors.hpp"
|
2024-01-12 10:53:56 -08:00
|
|
|
|
|
|
|
|
using namespace frc;
|
|
|
|
|
|
|
|
|
|
TEST(EventLoopTest, ConcurrentModification) {
|
|
|
|
|
EventLoop loop;
|
|
|
|
|
|
|
|
|
|
loop.Bind([&loop] { ASSERT_THROW(loop.Bind([] {}), frc::RuntimeError); });
|
|
|
|
|
|
|
|
|
|
loop.Poll();
|
|
|
|
|
|
|
|
|
|
loop.Clear();
|
|
|
|
|
|
|
|
|
|
loop.Bind([&loop] { ASSERT_THROW(loop.Clear(), frc::RuntimeError); });
|
|
|
|
|
|
|
|
|
|
loop.Poll();
|
|
|
|
|
}
|