The C based gRPC (C++, Python, Ruby, Objective-C, PHP, C#) https://grpc.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
2.7 KiB

10 years ago
/*
*
* Copyright 2015 gRPC authors.
10 years ago
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
10 years ago
*
* http://www.apache.org/licenses/LICENSE-2.0
10 years ago
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
10 years ago
*
*/
#ifndef GRPC_TEST_CORE_END2END_CQ_VERIFIER_H
#define GRPC_TEST_CORE_END2END_CQ_VERIFIER_H
10 years ago
#include <stdbool.h>
10 years ago
#include <grpc/grpc.h>
#include "test/core/util/test_config.h"
10 years ago
/* A cq_verifier can verify that expected events arrive in a timely fashion
on a single completion queue */
typedef struct cq_verifier cq_verifier;
/* construct/destroy a cq_verifier */
cq_verifier* cq_verifier_create(grpc_completion_queue* cq);
void cq_verifier_destroy(cq_verifier* v);
10 years ago
/* ensure all expected events (and only those events) are present on the
bound completion queue */
void cq_verify(cq_verifier* v);
10 years ago
/* ensure all expected events (and only those events) are present on the
bound completion queue withing \a timeout_sec */
void cq_verify_custom_timeout(cq_verifier* v, int timeout_sec);
10 years ago
/* ensure that the completion queue is empty */
void cq_verify_empty(cq_verifier* v);
10 years ago
9 years ago
/* ensure that the completion queue is empty, waiting up to \a timeout secs. */
void cq_verify_empty_timeout(cq_verifier* v, int timeout_sec);
9 years ago
10 years ago
/* Various expectation matchers
Any functions taking ... expect a NULL terminated list of key/value pairs
(each pair using two parameter slots) of metadata that MUST be present in
the event. */
void cq_expect_completion(cq_verifier* v, const char* file, int line, void* tag,
8 years ago
bool success);
void cq_expect_completion_any_status(cq_verifier* v, const char* file, int line,
void* tag);
8 years ago
#define CQ_EXPECT_COMPLETION(v, tag, success) \
cq_expect_completion(v, __FILE__, __LINE__, tag, success)
#define CQ_EXPECT_COMPLETION_ANY_STATUS(v, tag) \
cq_expect_completion_any_status(v, __FILE__, __LINE__, tag)
10 years ago
int byte_buffer_eq_slice(grpc_byte_buffer* bb, grpc_slice b);
int byte_buffer_eq_string(grpc_byte_buffer* byte_buffer, const char* string);
int contains_metadata(grpc_metadata_array* array, const char* key,
const char* value);
int contains_metadata_slices(grpc_metadata_array* array, grpc_slice key,
grpc_slice value);
#endif /* GRPC_TEST_CORE_END2END_CQ_VERIFIER_H */