From dbf47fabd406b51e8d3d03c5eb06c5fe6f7d0d5d Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Thu, 3 Mar 2016 16:25:06 -0800 Subject: Better comments. --- test/cpp/end2end/async_end2end_test.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/cpp/end2end') diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 30028dd4aa..dc8c2bb6e5 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -107,11 +107,14 @@ class PollingOverrider { class Verifier { public: explicit Verifier(bool spin) : spin_(spin) {} + // Expect sets the expected ok value for a specific tag Verifier& Expect(int i, bool expect_ok) { expectations_[tag(i)] = expect_ok; return *this; } + // Next waits for 1 async tag to complete, checks its + // expectations, and returns the tag int Next(CompletionQueue* cq, bool ignore_ok) { bool ok; void* got_tag; @@ -135,14 +138,19 @@ class Verifier { return detag(got_tag); } + // Verify keeps calling Next until all currently set + // expected tags are complete void Verify(CompletionQueue* cq) { Verify(cq, false); } + // This version of Verify allows optionally ignoring the + // outcome of the expectation void Verify(CompletionQueue* cq, bool ignore_ok) { GPR_ASSERT(!expectations_.empty()); while (!expectations_.empty()) { Next(cq, ignore_ok); } } + // This version of Verify stops after a certain deadline void Verify(CompletionQueue* cq, std::chrono::system_clock::time_point deadline) { if (expectations_.empty()) { -- cgit v1.2.3