Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
z
Enumerations
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
z
Classes
Class List
Class Hierarchy
Class Members
All
:
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
Enumerations
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Properties
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Related Functions
:
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
grpc
test
core
promise
call_push_pull_test.cc
Go to the documentation of this file.
1
// Copyright 2022 gRPC authors.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#include "
src/core/lib/promise/call_push_pull.h
"
16
17
#include <utility>
18
19
#include "absl/status/status.h"
20
#include "gtest/gtest.h"
21
22
namespace
grpc_core
{
23
24
TEST
(CallPushPullTest,
Empty
) {
25
auto
p =
CallPushPull
([] {
return
absl::OkStatus
(); },
26
[] {
return
absl::OkStatus
(); },
27
[] {
return
absl::OkStatus
(); });
28
EXPECT_EQ
(p(),
Poll<absl::Status>
(
absl::OkStatus
()));
29
}
30
31
TEST
(CallPushPullTest, Paused) {
32
auto
p =
CallPushPull
([]() ->
Poll<absl::Status>
{
return
Pending
{}; },
33
[]() ->
Poll<absl::Status>
{
return
Pending
{}; },
34
[]() ->
Poll<absl::Status>
{
return
Pending
{}; });
35
EXPECT_EQ
(p(),
Poll<absl::Status>
(
Pending
{}));
36
}
37
38
TEST
(CallPushPullTest, OneReady) {
39
auto
a
=
CallPushPull
([]() ->
Poll<absl::Status>
{
return
absl::OkStatus
(); },
40
[]() ->
Poll<absl::Status>
{
return
Pending
{}; },
41
[]() ->
Poll<absl::Status>
{
return
Pending
{}; });
42
EXPECT_EQ
(
a
(),
Poll<absl::Status>
(
Pending
{}));
43
auto
b
=
CallPushPull
([]() ->
Poll<absl::Status>
{
return
Pending
{}; },
44
[]() ->
Poll<absl::Status>
{
return
absl::OkStatus
(); },
45
[]() ->
Poll<absl::Status>
{
return
Pending
{}; });
46
EXPECT_EQ
(
b
(),
Poll<absl::Status>
(
Pending
{}));
47
auto
c =
48
CallPushPull
([]() ->
Poll<absl::Status>
{
return
Pending
{}; },
49
[]() ->
Poll<absl::Status>
{
return
Pending
{}; },
50
[]() ->
Poll<absl::Status>
{
return
absl::OkStatus
(); });
51
EXPECT_EQ
(c(),
Poll<absl::Status>
(
Pending
{}));
52
}
53
54
TEST
(CallPushPullTest, OneFailed) {
55
auto
a
=
CallPushPull
(
56
[]() ->
Poll<absl::Status>
{
return
absl::UnknownError
(
"bah"
); },
57
[]() ->
Poll<absl::Status>
{
return
Pending
{}; },
58
[]() ->
Poll<absl::Status>
{
return
Pending
{}; });
59
EXPECT_EQ
(
a
(),
Poll<absl::Status>
(
absl::UnknownError
(
"bah"
)));
60
auto
b
=
CallPushPull
(
61
[]() ->
Poll<absl::Status>
{
return
Pending
{}; },
62
[]() ->
Poll<absl::Status>
{
return
absl::UnknownError
(
"humbug"
); },
63
[]() ->
Poll<absl::Status>
{
return
Pending
{}; });
64
EXPECT_EQ
(
b
(),
Poll<absl::Status>
(
absl::UnknownError
(
"humbug"
)));
65
auto
c =
CallPushPull
(
66
[]() ->
Poll<absl::Status>
{
return
Pending
{}; },
67
[]() ->
Poll<absl::Status>
{
return
Pending
{}; },
68
[]() ->
Poll<absl::Status>
{
return
absl::UnknownError
(
"wha"
); });
69
EXPECT_EQ
(c(),
Poll<absl::Status>
(
absl::UnknownError
(
"wha"
)));
70
}
71
72
}
// namespace grpc_core
73
74
int
main
(
int
argc,
char
** argv) {
75
::testing::InitGoogleTest
(&argc, argv);
76
return
RUN_ALL_TESTS
();
77
}
grpc_core
Definition:
call_metric_recorder.h:31
main
int main(int argc, char **argv)
Definition:
call_push_pull_test.cc:74
absl::OkStatus
Status OkStatus()
Definition:
third_party/abseil-cpp/absl/status/status.h:882
grpc_core::TEST
TEST(AvlTest, NoOp)
Definition:
avl_test.cc:21
a
int a
Definition:
abseil-cpp/absl/container/internal/hash_policy_traits_test.cc:88
call_push_pull.h
EXPECT_EQ
#define EXPECT_EQ(a, b)
Definition:
iomgr/time_averaged_stats_test.cc:27
grpc_core::CallPushPull
promise_detail::CallPushPull< FMain, FPush, FPull > CallPushPull(FMain f_main, FPush f_push, FPull f_pull)
Definition:
call_push_pull.h:139
grpc_core::Pending
Definition:
poll.h:29
absl::UnknownError
Status UnknownError(absl::string_view message)
Definition:
third_party/abseil-cpp/absl/status/status.cc:383
RUN_ALL_TESTS
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
Definition:
bloaty/third_party/googletest/googletest/include/gtest/gtest.h:2471
b
uint64_t b
Definition:
abseil-cpp/absl/container/internal/layout_test.cc:53
Empty
Definition:
abseil-cpp/absl/container/internal/compressed_tuple_test.cc:33
testing::InitGoogleTest
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
Definition:
bloaty/third_party/googletest/googletest/src/gtest.cc:6106
absl::variant
Definition:
abseil-cpp/absl/types/internal/variant.h:46
grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:58:42