FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
firebase-cpp-sdk/binary_to_array_test.py at main · firebase/firebase-cpp-sdk · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
firebase
/
firebase-cpp-sdk
Public
Notifications
You must be signed in to change notification settings
Fork
138
Star
326
Code
Issues
99
Pull requests
37
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
firebase-cpp-sdk
/
binary_to_array_test.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
91 lines (67 loc) · 2.58 KB
Breadcrumbs
firebase-cpp-sdk
/
binary_to_array_test.py
Copy path
File metadata and controls
91 lines (67 loc) · 2.58 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Copyright 2018 Google LLC
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# 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.
"""Tests for google3.firebase.app.client.cpp.binary_to_array."""
from
google3
.
testing
.
pybase
import
googletest
from
google3
.
firebase
.
app
.
client
.
cpp
import
binary_to_array
EXPECTED_SOURCE_FILE
=
"""
\
// Copyright 2016 Google Inc. All Rights Reserved.
#include <stdlib.h>
namespace test_outer_namespace {
namespace test_inner_namespace {
extern const size_t test_array_name_size;
extern const char test_fileid[];
extern const unsigned char test_array_name[];
const unsigned char test_array_name[] = {
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x00 // Extra
\\
0 to make it a C string
};
const size_t test_array_name_size =
sizeof(test_array_name) - 1;
const char test_fileid[] =
"test_filename";
} // namespace test_inner_namespace
} // namespace test_outer_namespace
"""
EXPECTED_HEADER_FILE
=
"""
\
// Copyright 2016 Google Inc. All Rights Reserved.
#ifndef TEST_HEADER_GUARD
#define TEST_HEADER_GUARD
#include <stdlib.h>
namespace test_outer_namespace {
namespace test_inner_namespace {
extern const size_t test_array_name_size;
extern const unsigned char test_array_name[];
extern const char test_fileid[];
} // namespace test_inner_namespace
} // namespace test_outer_namespace
#endif // TEST_HEADER_GUARD
"""
namespaces
=
[
"test_outer_namespace"
,
"test_inner_namespace"
]
array_name
=
"test_array_name"
array_size_name
=
"test_array_name_size"
fileid
=
"test_fileid"
filename
=
"test_filename"
input_bytes
=
[
1
,
2
,
3
,
4
,
5
,
6
,
7
]
header_guard
=
"TEST_HEADER_GUARD"
class
BinaryToArrayTest
(
googletest
.
TestCase
):
def
test_source_file
(
self
):
result_source
=
binary_to_array
.
source
(
namespaces
,
array_name
,
array_size_name
,
fileid
,
filename
,
input_bytes
)
self
.
assertEqual
(
"
\n
"
.
join
(
result_source
),
EXPECTED_SOURCE_FILE
)
def
test_header_file
(
self
):
result_header
=
binary_to_array
.
header
(
header_guard
,
namespaces
,
array_name
,
array_size_name
,
fileid
)
self
.
assertEqual
(
"
\n
"
.
join
(
result_header
),
EXPECTED_HEADER_FILE
)
if
__name__
==
"__main__"
:
googletest
.
main
()
Back
|
FazBrowse Home
|
New Git URL