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
gpr
env_test.cc
Go to the documentation of this file.
1
/*
2
*
3
* Copyright 2015 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
19
#include "
src/core/lib/gpr/env.h
"
20
21
#include <stdio.h>
22
#include <
string.h
>
23
24
#include <
grpc/support/alloc.h
>
25
#include <
grpc/support/log.h
>
26
27
#include "
src/core/lib/gpr/string.h
"
28
#include "
test/core/util/test_config.h
"
29
30
#define LOG_TEST_NAME(x) gpr_log(GPR_INFO, "%s", x)
31
32
static
void
test_setenv_getenv
(
void
) {
33
const
char
*
name
=
"FOO"
;
34
const
char
*
value
=
"BAR"
;
35
char
* retrieved_value;
36
37
LOG_TEST_NAME
(
"test_setenv_getenv"
);
38
39
gpr_setenv
(
name
,
value
);
40
retrieved_value =
gpr_getenv
(
name
);
41
GPR_ASSERT
(retrieved_value !=
nullptr
);
42
GPR_ASSERT
(strcmp(
value
, retrieved_value) == 0);
43
gpr_free
(retrieved_value);
44
}
45
46
static
void
test_unsetenv
(
void
) {
47
const
char
*
name
=
"FOO"
;
48
const
char
*
value
=
"BAR"
;
49
char
* retrieved_value;
50
51
LOG_TEST_NAME
(
"test_unsetenv"
);
52
53
gpr_setenv
(
name
,
value
);
54
gpr_unsetenv
(
name
);
55
retrieved_value =
gpr_getenv
(
name
);
56
GPR_ASSERT
(retrieved_value ==
nullptr
);
57
}
58
59
int
main
(
int
argc,
char
** argv) {
60
grpc::testing::TestEnvironment
env
(&argc, argv);
61
test_setenv_getenv
();
62
test_unsetenv
();
63
return
0;
64
}
log.h
generate.env
env
Definition:
generate.py:37
string.h
gpr_free
GPRAPI void gpr_free(void *ptr)
Definition:
alloc.cc:51
setup.name
name
Definition:
setup.py:542
env.h
main
int main(int argc, char **argv)
Definition:
env_test.cc:59
test_unsetenv
static void test_unsetenv(void)
Definition:
env_test.cc:46
gpr_getenv
char * gpr_getenv(const char *name)
GPR_ASSERT
#define GPR_ASSERT(x)
Definition:
include/grpc/impl/codegen/log.h:94
test_config.h
value
const char * value
Definition:
hpack_parser_table.cc:165
test_setenv_getenv
static void test_setenv_getenv(void)
Definition:
env_test.cc:32
alloc.h
grpc::testing::TestEnvironment
Definition:
test/core/util/test_config.h:54
LOG_TEST_NAME
#define LOG_TEST_NAME(x)
Definition:
env_test.cc:30
gpr_unsetenv
void gpr_unsetenv(const char *name)
gpr_setenv
void gpr_setenv(const char *name, const char *value)
grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:59:15