MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TEST

Function TEST

tensorflow/core/framework/cancellation_test.cc:25–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23namespace tensorflow {
24
25TEST(Cancellation, SimpleNoCancel) {
26 bool is_cancelled = false;
27 CancellationManager* manager = new CancellationManager();
28 auto token = manager->get_cancellation_token();
29 bool registered = manager->RegisterCallback(
30 token, [&is_cancelled]() { is_cancelled = true; });
31 EXPECT_TRUE(registered);
32 bool deregistered = manager->DeregisterCallback(token);
33 EXPECT_TRUE(deregistered);
34 delete manager;
35 EXPECT_FALSE(is_cancelled);
36}
37
38TEST(Cancellation, SimpleCancel) {
39 bool is_cancelled = false;

Callers

nothing calls this directly

Calls 12

DefaultFunction · 0.85
DeregisterCallbackMethod · 0.80
IsCancelledMethod · 0.80
TryDeregisterCallbackMethod · 0.80
RegisterCallbackMethod · 0.45
StartCancelMethod · 0.45
sizeMethod · 0.45
ScheduleMethod · 0.45
NotifyMethod · 0.45
SleepForMicrosecondsMethod · 0.45
WaitForNotificationMethod · 0.45

Tested by

no test coverage detected