escaping_test_common.h
Go to the documentation of this file.
00001 // Copyright 2017 The Abseil Authors.
00002 //
00003 // Licensed under the Apache License, Version 2.0 (the "License");
00004 // you may not use this file except in compliance with the License.
00005 // You may obtain a copy of the License at
00006 //
00007 //      https://www.apache.org/licenses/LICENSE-2.0
00008 //
00009 // Unless required by applicable law or agreed to in writing, software
00010 // distributed under the License is distributed on an "AS IS" BASIS,
00011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00012 // See the License for the specific language governing permissions and
00013 // limitations under the License.
00014 //
00015 // This test contains common things needed by both escaping_test.cc and
00016 // escaping_benchmark.cc.
00017 
00018 #ifndef ABSL_STRINGS_INTERNAL_ESCAPING_TEST_COMMON_H_
00019 #define ABSL_STRINGS_INTERNAL_ESCAPING_TEST_COMMON_H_
00020 
00021 #include <array>
00022 #include "absl/strings/string_view.h"
00023 
00024 namespace absl {
00025 namespace strings_internal {
00026 
00027 struct base64_testcase {
00028   absl::string_view plaintext;
00029   absl::string_view cyphertext;
00030 };
00031 
00032 inline const std::array<base64_testcase, 5>& base64_strings() {
00033   static const std::array<base64_testcase, 5> testcase{{
00034       // Some google quotes
00035       // Cyphertext created with "uuencode (GNU sharutils) 4.6.3"
00036       // (Note that we're testing the websafe encoding, though, so if
00037       // you add messages, be sure to run "tr -- '+/' '-_'" on the output)
00038       { "I was always good at math and science, and I never realized "
00039         "that was unusual or somehow undesirable. So one of the things "
00040         "I care a lot about is helping to remove that stigma, "
00041         "to show girls that you can be feminine, you can like the things "
00042         "that girls like, but you can also be really good at technology. "
00043         "You can be really good at building things."
00044         " - Marissa Meyer, Newsweek, 2010-12-22" "\n",
00045 
00046         "SSB3YXMgYWx3YXlzIGdvb2QgYXQgbWF0aCBhbmQgc2NpZW5jZSwgYW5kIEkg"
00047         "bmV2ZXIgcmVhbGl6ZWQgdGhhdCB3YXMgdW51c3VhbCBvciBzb21laG93IHVu"
00048         "ZGVzaXJhYmxlLiBTbyBvbmUgb2YgdGhlIHRoaW5ncyBJIGNhcmUgYSBsb3Qg"
00049         "YWJvdXQgaXMgaGVscGluZyB0byByZW1vdmUgdGhhdCBzdGlnbWEsIHRvIHNo"
00050         "b3cgZ2lybHMgdGhhdCB5b3UgY2FuIGJlIGZlbWluaW5lLCB5b3UgY2FuIGxp"
00051         "a2UgdGhlIHRoaW5ncyB0aGF0IGdpcmxzIGxpa2UsIGJ1dCB5b3UgY2FuIGFs"
00052         "c28gYmUgcmVhbGx5IGdvb2QgYXQgdGVjaG5vbG9neS4gWW91IGNhbiBiZSBy"
00053         "ZWFsbHkgZ29vZCBhdCBidWlsZGluZyB0aGluZ3MuIC0gTWFyaXNzYSBNZXll"
00054         "ciwgTmV3c3dlZWssIDIwMTAtMTItMjIK" },
00055 
00056       { "Typical first year for a new cluster: "
00057         "~0.5 overheating "
00058         "~1 PDU failure "
00059         "~1 rack-move "
00060         "~1 network rewiring "
00061         "~20 rack failures "
00062         "~5 racks go wonky "
00063         "~8 network maintenances "
00064         "~12 router reloads "
00065         "~3 router failures "
00066         "~dozens of minor 30-second blips for dns "
00067         "~1000 individual machine failures "
00068         "~thousands of hard drive failures "
00069         "slow disks, bad memory, misconfigured machines, flaky machines, etc."
00070         " - Jeff Dean, The Joys of Real Hardware" "\n",
00071 
00072         "VHlwaWNhbCBmaXJzdCB5ZWFyIGZvciBhIG5ldyBjbHVzdGVyOiB-MC41IG92"
00073         "ZXJoZWF0aW5nIH4xIFBEVSBmYWlsdXJlIH4xIHJhY2stbW92ZSB-MSBuZXR3"
00074         "b3JrIHJld2lyaW5nIH4yMCByYWNrIGZhaWx1cmVzIH41IHJhY2tzIGdvIHdv"
00075         "bmt5IH44IG5ldHdvcmsgbWFpbnRlbmFuY2VzIH4xMiByb3V0ZXIgcmVsb2Fk"
00076         "cyB-MyByb3V0ZXIgZmFpbHVyZXMgfmRvemVucyBvZiBtaW5vciAzMC1zZWNv"
00077         "bmQgYmxpcHMgZm9yIGRucyB-MTAwMCBpbmRpdmlkdWFsIG1hY2hpbmUgZmFp"
00078         "bHVyZXMgfnRob3VzYW5kcyBvZiBoYXJkIGRyaXZlIGZhaWx1cmVzIHNsb3cg"
00079         "ZGlza3MsIGJhZCBtZW1vcnksIG1pc2NvbmZpZ3VyZWQgbWFjaGluZXMsIGZs"
00080         "YWt5IG1hY2hpbmVzLCBldGMuIC0gSmVmZiBEZWFuLCBUaGUgSm95cyBvZiBS"
00081         "ZWFsIEhhcmR3YXJlCg" },
00082 
00083       { "I'm the head of the webspam team at Google.  "
00084         "That means that if you type your name into Google and get porn back, "
00085         "it's my fault. Unless you're a porn star, in which case porn is a "
00086         "completely reasonable response."
00087         " - Matt Cutts, Google Plus" "\n",
00088 
00089         "SSdtIHRoZSBoZWFkIG9mIHRoZSB3ZWJzcGFtIHRlYW0gYXQgR29vZ2xlLiAg"
00090         "VGhhdCBtZWFucyB0aGF0IGlmIHlvdSB0eXBlIHlvdXIgbmFtZSBpbnRvIEdv"
00091         "b2dsZSBhbmQgZ2V0IHBvcm4gYmFjaywgaXQncyBteSBmYXVsdC4gVW5sZXNz"
00092         "IHlvdSdyZSBhIHBvcm4gc3RhciwgaW4gd2hpY2ggY2FzZSBwb3JuIGlzIGEg"
00093         "Y29tcGxldGVseSByZWFzb25hYmxlIHJlc3BvbnNlLiAtIE1hdHQgQ3V0dHMs"
00094         "IEdvb2dsZSBQbHVzCg" },
00095 
00096       { "It will still be a long time before machines approach human "
00097         "intelligence. "
00098         "But luckily, machines don't actually have to be intelligent; "
00099         "they just have to fake it. Access to a wealth of information, "
00100         "combined with a rudimentary decision-making capacity, "
00101         "can often be almost as useful. Of course, the results are better yet "
00102         "when coupled with intelligence. A reference librarian with access to "
00103         "a good search engine is a formidable tool."
00104         " - Craig Silverstein, Siemens Pictures of the Future, Spring 2004"
00105         "\n",
00106 
00107         "SXQgd2lsbCBzdGlsbCBiZSBhIGxvbmcgdGltZSBiZWZvcmUgbWFjaGluZXMg"
00108         "YXBwcm9hY2ggaHVtYW4gaW50ZWxsaWdlbmNlLiBCdXQgbHVja2lseSwgbWFj"
00109         "aGluZXMgZG9uJ3QgYWN0dWFsbHkgaGF2ZSB0byBiZSBpbnRlbGxpZ2VudDsg"
00110         "dGhleSBqdXN0IGhhdmUgdG8gZmFrZSBpdC4gQWNjZXNzIHRvIGEgd2VhbHRo"
00111         "IG9mIGluZm9ybWF0aW9uLCBjb21iaW5lZCB3aXRoIGEgcnVkaW1lbnRhcnkg"
00112         "ZGVjaXNpb24tbWFraW5nIGNhcGFjaXR5LCBjYW4gb2Z0ZW4gYmUgYWxtb3N0"
00113         "IGFzIHVzZWZ1bC4gT2YgY291cnNlLCB0aGUgcmVzdWx0cyBhcmUgYmV0dGVy"
00114         "IHlldCB3aGVuIGNvdXBsZWQgd2l0aCBpbnRlbGxpZ2VuY2UuIEEgcmVmZXJl"
00115         "bmNlIGxpYnJhcmlhbiB3aXRoIGFjY2VzcyB0byBhIGdvb2Qgc2VhcmNoIGVu"
00116         "Z2luZSBpcyBhIGZvcm1pZGFibGUgdG9vbC4gLSBDcmFpZyBTaWx2ZXJzdGVp"
00117         "biwgU2llbWVucyBQaWN0dXJlcyBvZiB0aGUgRnV0dXJlLCBTcHJpbmcgMjAw"
00118         "NAo" },
00119 
00120       // Degenerate edge case
00121       { "",
00122         "" },
00123   }};
00124 
00125   return testcase;
00126 }
00127 
00128 }  // namespace strings_internal
00129 }  // namespace absl
00130 
00131 #endif  // ABSL_STRINGS_INTERNAL_ESCAPING_TEST_COMMON_H_


abseil_cpp
Author(s):
autogenerated on Wed Jun 19 2019 19:42:14