blob: 82da6930c142f3f4f97c71f137eb4c064e19379e [file] [log] [blame]
William A. Kennington III458aeae2021-06-14 15:07:16 -07001#include <stdplus/cancel.hpp>
2
3#include <gtest/gtest.h>
4
5namespace stdplus
6{
7
8struct FakeCancelable : public Cancelable
9{
10 size_t count = 0;
11 void cancel() noexcept override
12 {
13 count++;
14 }
15};
16
17TEST(CancelTest, Cancel)
18{
19 FakeCancelable c;
20 EXPECT_EQ(c.count, 0);
21 {
22 Cancel cancel(&c);
23 EXPECT_EQ(c.count, 0);
24 }
25 EXPECT_EQ(c.count, 1);
26}
27
28} // namespace stdplus