grpc_alts_credentials_options_test.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2018 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
20 
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <string.h>
24 
25 #include <grpc/grpc.h>
26 #include <grpc/support/log.h>
27 
28 #define ALTS_CLIENT_OPTIONS_TEST_TARGET_SERVICE_ACCOUNT_1 "abc@google.com"
29 #define ALTS_CLIENT_OPTIONS_TEST_TARGET_SERVICE_ACCOUNT_2 "def@google.com"
30 
31 const size_t kTargetServiceAccountNum = 2;
32 
34  /* Initialization. */
37  /* Test. */
39  /* Cleanup. */
41 }
42 
45  auto client_options =
47  size_t num = 0;
48  target_service_account* node = client_options->target_account_list_head;
49  while (node != nullptr) {
50  num++;
51  node = node->next;
52  }
53  return num;
54 }
55 
57  /* Initialization. */
60  /* Set client options fields. */
65  /* Validate client option fields. */
68  auto client_options =
70  GPR_ASSERT(strcmp(client_options->target_account_list_head->data,
72  GPR_ASSERT(strcmp(client_options->target_account_list_head->next->data,
74  /* Perform a copy operation and validate its correctness. */
75  grpc_alts_credentials_options* new_options =
79  auto new_client_options =
80  reinterpret_cast<grpc_alts_credentials_client_options*>(new_options);
81  GPR_ASSERT(strcmp(new_client_options->target_account_list_head->data,
83  GPR_ASSERT(strcmp(new_client_options->target_account_list_head->next->data,
85  /* Cleanup.*/
88 }
89 
90 int main(int /*argc*/, char** /*argv*/) {
91  /* Test. */
94  return 0;
95 }
grpc_alts_credentials_options_destroy
GRPCAPI void grpc_alts_credentials_options_destroy(grpc_alts_credentials_options *options)
Definition: grpc_alts_credentials_options.cc:38
grpc_alts_credentials_client_options
Definition: grpc_alts_credentials_options.h:50
log.h
string.h
options
double_dict options[]
Definition: capstone_test.c:55
test_copy_client_options_failure
static void test_copy_client_options_failure()
Definition: grpc_alts_credentials_options_test.cc:33
target_service_account
Definition: grpc_alts_credentials_options.h:40
grpc_alts_credentials_client_options_create
GRPCAPI grpc_alts_credentials_options * grpc_alts_credentials_client_options_create(void)
Definition: grpc_alts_credentials_client_options.cc:73
GPR_ASSERT
#define GPR_ASSERT(x)
Definition: include/grpc/impl/codegen/log.h:94
test_client_options_api_success
static void test_client_options_api_success()
Definition: grpc_alts_credentials_options_test.cc:56
grpc_alts_credentials_client_options_add_target_service_account
GRPCAPI void grpc_alts_credentials_client_options_add_target_service_account(grpc_alts_credentials_options *options, const char *service_account)
Definition: grpc_alts_credentials_client_options.cc:45
grpc.h
grpc_alts_credentials_options.h
kTargetServiceAccountNum
const size_t kTargetServiceAccountNum
Definition: grpc_alts_credentials_options_test.cc:31
ALTS_CLIENT_OPTIONS_TEST_TARGET_SERVICE_ACCOUNT_1
#define ALTS_CLIENT_OPTIONS_TEST_TARGET_SERVICE_ACCOUNT_1
Definition: grpc_alts_credentials_options_test.cc:28
grpc_alts_credentials_options
Definition: grpc_alts_credentials_options.h:35
grpc_alts_credentials_options_copy
grpc_alts_credentials_options * grpc_alts_credentials_options_copy(const grpc_alts_credentials_options *options)
Definition: grpc_alts_credentials_options.cc:26
xds_manager.num
num
Definition: xds_manager.py:56
main
int main(int, char **)
Definition: grpc_alts_credentials_options_test.cc:90
target_service_account::next
struct target_service_account * next
Definition: grpc_alts_credentials_options.h:41
get_target_service_account_num
static size_t get_target_service_account_num(grpc_alts_credentials_options *options)
Definition: grpc_alts_credentials_options_test.cc:43
ALTS_CLIENT_OPTIONS_TEST_TARGET_SERVICE_ACCOUNT_2
#define ALTS_CLIENT_OPTIONS_TEST_TARGET_SERVICE_ACCOUNT_2
Definition: grpc_alts_credentials_options_test.cc:29


grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:44