Built motion from commit 6a09e18b.|2.6.11
[motion2.git] / legacy-libs / grpc-cloned / deps / grpc / third_party / abseil-cpp / absl / strings / internal / escaping_test_common.h
1 // Copyright 2017 The Abseil 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 //      https://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 // This test contains common things needed by both escaping_test.cc and
16 // escaping_benchmark.cc.
17
18 #ifndef ABSL_STRINGS_INTERNAL_ESCAPING_TEST_COMMON_H_
19 #define ABSL_STRINGS_INTERNAL_ESCAPING_TEST_COMMON_H_
20
21 #include <array>
22 #include "absl/strings/string_view.h"
23
24 namespace absl {
25 namespace strings_internal {
26
27 struct base64_testcase {
28   absl::string_view plaintext;
29   absl::string_view cyphertext;
30 };
31
32 inline const std::array<base64_testcase, 5>& base64_strings() {
33   static const std::array<base64_testcase, 5> testcase{{
34       // Some google quotes
35       // Cyphertext created with "uuencode (GNU sharutils) 4.6.3"
36       // (Note that we're testing the websafe encoding, though, so if
37       // you add messages, be sure to run "tr -- '+/' '-_'" on the output)
38       { "I was always good at math and science, and I never realized "
39         "that was unusual or somehow undesirable. So one of the things "
40         "I care a lot about is helping to remove that stigma, "
41         "to show girls that you can be feminine, you can like the things "
42         "that girls like, but you can also be really good at technology. "
43         "You can be really good at building things."
44         " - Marissa Meyer, Newsweek, 2010-12-22" "\n",
45
46         "SSB3YXMgYWx3YXlzIGdvb2QgYXQgbWF0aCBhbmQgc2NpZW5jZSwgYW5kIEkg"
47         "bmV2ZXIgcmVhbGl6ZWQgdGhhdCB3YXMgdW51c3VhbCBvciBzb21laG93IHVu"
48         "ZGVzaXJhYmxlLiBTbyBvbmUgb2YgdGhlIHRoaW5ncyBJIGNhcmUgYSBsb3Qg"
49         "YWJvdXQgaXMgaGVscGluZyB0byByZW1vdmUgdGhhdCBzdGlnbWEsIHRvIHNo"
50         "b3cgZ2lybHMgdGhhdCB5b3UgY2FuIGJlIGZlbWluaW5lLCB5b3UgY2FuIGxp"
51         "a2UgdGhlIHRoaW5ncyB0aGF0IGdpcmxzIGxpa2UsIGJ1dCB5b3UgY2FuIGFs"
52         "c28gYmUgcmVhbGx5IGdvb2QgYXQgdGVjaG5vbG9neS4gWW91IGNhbiBiZSBy"
53         "ZWFsbHkgZ29vZCBhdCBidWlsZGluZyB0aGluZ3MuIC0gTWFyaXNzYSBNZXll"
54         "ciwgTmV3c3dlZWssIDIwMTAtMTItMjIK" },
55
56       { "Typical first year for a new cluster: "
57         "~0.5 overheating "
58         "~1 PDU failure "
59         "~1 rack-move "
60         "~1 network rewiring "
61         "~20 rack failures "
62         "~5 racks go wonky "
63         "~8 network maintenances "
64         "~12 router reloads "
65         "~3 router failures "
66         "~dozens of minor 30-second blips for dns "
67         "~1000 individual machine failures "
68         "~thousands of hard drive failures "
69         "slow disks, bad memory, misconfigured machines, flaky machines, etc."
70         " - Jeff Dean, The Joys of Real Hardware" "\n",
71
72         "VHlwaWNhbCBmaXJzdCB5ZWFyIGZvciBhIG5ldyBjbHVzdGVyOiB-MC41IG92"
73         "ZXJoZWF0aW5nIH4xIFBEVSBmYWlsdXJlIH4xIHJhY2stbW92ZSB-MSBuZXR3"
74         "b3JrIHJld2lyaW5nIH4yMCByYWNrIGZhaWx1cmVzIH41IHJhY2tzIGdvIHdv"
75         "bmt5IH44IG5ldHdvcmsgbWFpbnRlbmFuY2VzIH4xMiByb3V0ZXIgcmVsb2Fk"
76         "cyB-MyByb3V0ZXIgZmFpbHVyZXMgfmRvemVucyBvZiBtaW5vciAzMC1zZWNv"
77         "bmQgYmxpcHMgZm9yIGRucyB-MTAwMCBpbmRpdmlkdWFsIG1hY2hpbmUgZmFp"
78         "bHVyZXMgfnRob3VzYW5kcyBvZiBoYXJkIGRyaXZlIGZhaWx1cmVzIHNsb3cg"
79         "ZGlza3MsIGJhZCBtZW1vcnksIG1pc2NvbmZpZ3VyZWQgbWFjaGluZXMsIGZs"
80         "YWt5IG1hY2hpbmVzLCBldGMuIC0gSmVmZiBEZWFuLCBUaGUgSm95cyBvZiBS"
81         "ZWFsIEhhcmR3YXJlCg" },
82
83       { "I'm the head of the webspam team at Google.  "
84         "That means that if you type your name into Google and get porn back, "
85         "it's my fault. Unless you're a porn star, in which case porn is a "
86         "completely reasonable response."
87         " - Matt Cutts, Google Plus" "\n",
88
89         "SSdtIHRoZSBoZWFkIG9mIHRoZSB3ZWJzcGFtIHRlYW0gYXQgR29vZ2xlLiAg"
90         "VGhhdCBtZWFucyB0aGF0IGlmIHlvdSB0eXBlIHlvdXIgbmFtZSBpbnRvIEdv"
91         "b2dsZSBhbmQgZ2V0IHBvcm4gYmFjaywgaXQncyBteSBmYXVsdC4gVW5sZXNz"
92         "IHlvdSdyZSBhIHBvcm4gc3RhciwgaW4gd2hpY2ggY2FzZSBwb3JuIGlzIGEg"
93         "Y29tcGxldGVseSByZWFzb25hYmxlIHJlc3BvbnNlLiAtIE1hdHQgQ3V0dHMs"
94         "IEdvb2dsZSBQbHVzCg" },
95
96       { "It will still be a long time before machines approach human "
97         "intelligence. "
98         "But luckily, machines don't actually have to be intelligent; "
99         "they just have to fake it. Access to a wealth of information, "
100         "combined with a rudimentary decision-making capacity, "
101         "can often be almost as useful. Of course, the results are better yet "
102         "when coupled with intelligence. A reference librarian with access to "
103         "a good search engine is a formidable tool."
104         " - Craig Silverstein, Siemens Pictures of the Future, Spring 2004"
105         "\n",
106
107         "SXQgd2lsbCBzdGlsbCBiZSBhIGxvbmcgdGltZSBiZWZvcmUgbWFjaGluZXMg"
108         "YXBwcm9hY2ggaHVtYW4gaW50ZWxsaWdlbmNlLiBCdXQgbHVja2lseSwgbWFj"
109         "aGluZXMgZG9uJ3QgYWN0dWFsbHkgaGF2ZSB0byBiZSBpbnRlbGxpZ2VudDsg"
110         "dGhleSBqdXN0IGhhdmUgdG8gZmFrZSBpdC4gQWNjZXNzIHRvIGEgd2VhbHRo"
111         "IG9mIGluZm9ybWF0aW9uLCBjb21iaW5lZCB3aXRoIGEgcnVkaW1lbnRhcnkg"
112         "ZGVjaXNpb24tbWFraW5nIGNhcGFjaXR5LCBjYW4gb2Z0ZW4gYmUgYWxtb3N0"
113         "IGFzIHVzZWZ1bC4gT2YgY291cnNlLCB0aGUgcmVzdWx0cyBhcmUgYmV0dGVy"
114         "IHlldCB3aGVuIGNvdXBsZWQgd2l0aCBpbnRlbGxpZ2VuY2UuIEEgcmVmZXJl"
115         "bmNlIGxpYnJhcmlhbiB3aXRoIGFjY2VzcyB0byBhIGdvb2Qgc2VhcmNoIGVu"
116         "Z2luZSBpcyBhIGZvcm1pZGFibGUgdG9vbC4gLSBDcmFpZyBTaWx2ZXJzdGVp"
117         "biwgU2llbWVucyBQaWN0dXJlcyBvZiB0aGUgRnV0dXJlLCBTcHJpbmcgMjAw"
118         "NAo" },
119
120       // Degenerate edge case
121       { "",
122         "" },
123   }};
124
125   return testcase;
126 }
127
128 }  // namespace strings_internal
129 }  // namespace absl
130
131 #endif  // ABSL_STRINGS_INTERNAL_ESCAPING_TEST_COMMON_H_