Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:31:52

0001 // Copyright 2017 The Abseil Authors.
0002 //
0003 // Licensed under the Apache License, Version 2.0 (the "License");
0004 // you may not use this file except in compliance with the License.
0005 // You may obtain a copy of the License at
0006 //
0007 //      https://www.apache.org/licenses/LICENSE-2.0
0008 //
0009 // Unless required by applicable law or agreed to in writing, software
0010 // distributed under the License is distributed on an "AS IS" BASIS,
0011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0012 // See the License for the specific language governing permissions and
0013 // limitations under the License.
0014 //
0015 // This test contains common things needed by both escaping_test.cc and
0016 // escaping_benchmark.cc.
0017 
0018 #ifndef ABSL_STRINGS_INTERNAL_ESCAPING_TEST_COMMON_H_
0019 #define ABSL_STRINGS_INTERNAL_ESCAPING_TEST_COMMON_H_
0020 
0021 #include <array>
0022 #include "absl/strings/string_view.h"
0023 
0024 namespace absl {
0025 ABSL_NAMESPACE_BEGIN
0026 namespace strings_internal {
0027 
0028 struct base64_testcase {
0029   absl::string_view plaintext;
0030   absl::string_view cyphertext;
0031 };
0032 
0033 inline const std::array<base64_testcase, 5>& base64_strings() {
0034   static const std::array<base64_testcase, 5> testcase{{
0035       // Some google quotes
0036       // Cyphertext created with "uuencode (GNU sharutils) 4.6.3"
0037       // (Note that we're testing the websafe encoding, though, so if
0038       // you add messages, be sure to run "tr -- '+/' '-_'" on the output)
0039       { "I was always good at math and science, and I never realized "
0040         "that was unusual or somehow undesirable. So one of the things "
0041         "I care a lot about is helping to remove that stigma, "
0042         "to show girls that you can be feminine, you can like the things "
0043         "that girls like, but you can also be really good at technology. "
0044         "You can be really good at building things."
0045         " - Marissa Meyer, Newsweek, 2010-12-22" "\n",
0046 
0047         "SSB3YXMgYWx3YXlzIGdvb2QgYXQgbWF0aCBhbmQgc2NpZW5jZSwgYW5kIEkg"
0048         "bmV2ZXIgcmVhbGl6ZWQgdGhhdCB3YXMgdW51c3VhbCBvciBzb21laG93IHVu"
0049         "ZGVzaXJhYmxlLiBTbyBvbmUgb2YgdGhlIHRoaW5ncyBJIGNhcmUgYSBsb3Qg"
0050         "YWJvdXQgaXMgaGVscGluZyB0byByZW1vdmUgdGhhdCBzdGlnbWEsIHRvIHNo"
0051         "b3cgZ2lybHMgdGhhdCB5b3UgY2FuIGJlIGZlbWluaW5lLCB5b3UgY2FuIGxp"
0052         "a2UgdGhlIHRoaW5ncyB0aGF0IGdpcmxzIGxpa2UsIGJ1dCB5b3UgY2FuIGFs"
0053         "c28gYmUgcmVhbGx5IGdvb2QgYXQgdGVjaG5vbG9neS4gWW91IGNhbiBiZSBy"
0054         "ZWFsbHkgZ29vZCBhdCBidWlsZGluZyB0aGluZ3MuIC0gTWFyaXNzYSBNZXll"
0055         "ciwgTmV3c3dlZWssIDIwMTAtMTItMjIK" },
0056 
0057       { "Typical first year for a new cluster: "
0058         "~0.5 overheating "
0059         "~1 PDU failure "
0060         "~1 rack-move "
0061         "~1 network rewiring "
0062         "~20 rack failures "
0063         "~5 racks go wonky "
0064         "~8 network maintenances "
0065         "~12 router reloads "
0066         "~3 router failures "
0067         "~dozens of minor 30-second blips for dns "
0068         "~1000 individual machine failures "
0069         "~thousands of hard drive failures "
0070         "slow disks, bad memory, misconfigured machines, flaky machines, etc."
0071         " - Jeff Dean, The Joys of Real Hardware" "\n",
0072 
0073         "VHlwaWNhbCBmaXJzdCB5ZWFyIGZvciBhIG5ldyBjbHVzdGVyOiB-MC41IG92"
0074         "ZXJoZWF0aW5nIH4xIFBEVSBmYWlsdXJlIH4xIHJhY2stbW92ZSB-MSBuZXR3"
0075         "b3JrIHJld2lyaW5nIH4yMCByYWNrIGZhaWx1cmVzIH41IHJhY2tzIGdvIHdv"
0076         "bmt5IH44IG5ldHdvcmsgbWFpbnRlbmFuY2VzIH4xMiByb3V0ZXIgcmVsb2Fk"
0077         "cyB-MyByb3V0ZXIgZmFpbHVyZXMgfmRvemVucyBvZiBtaW5vciAzMC1zZWNv"
0078         "bmQgYmxpcHMgZm9yIGRucyB-MTAwMCBpbmRpdmlkdWFsIG1hY2hpbmUgZmFp"
0079         "bHVyZXMgfnRob3VzYW5kcyBvZiBoYXJkIGRyaXZlIGZhaWx1cmVzIHNsb3cg"
0080         "ZGlza3MsIGJhZCBtZW1vcnksIG1pc2NvbmZpZ3VyZWQgbWFjaGluZXMsIGZs"
0081         "YWt5IG1hY2hpbmVzLCBldGMuIC0gSmVmZiBEZWFuLCBUaGUgSm95cyBvZiBS"
0082         "ZWFsIEhhcmR3YXJlCg" },
0083 
0084       { "I'm the head of the webspam team at Google.  "
0085         "That means that if you type your name into Google and get porn back, "
0086         "it's my fault. Unless you're a porn star, in which case porn is a "
0087         "completely reasonable response."
0088         " - Matt Cutts, Google Plus" "\n",
0089 
0090         "SSdtIHRoZSBoZWFkIG9mIHRoZSB3ZWJzcGFtIHRlYW0gYXQgR29vZ2xlLiAg"
0091         "VGhhdCBtZWFucyB0aGF0IGlmIHlvdSB0eXBlIHlvdXIgbmFtZSBpbnRvIEdv"
0092         "b2dsZSBhbmQgZ2V0IHBvcm4gYmFjaywgaXQncyBteSBmYXVsdC4gVW5sZXNz"
0093         "IHlvdSdyZSBhIHBvcm4gc3RhciwgaW4gd2hpY2ggY2FzZSBwb3JuIGlzIGEg"
0094         "Y29tcGxldGVseSByZWFzb25hYmxlIHJlc3BvbnNlLiAtIE1hdHQgQ3V0dHMs"
0095         "IEdvb2dsZSBQbHVzCg" },
0096 
0097       { "It will still be a long time before machines approach human "
0098         "intelligence. "
0099         "But luckily, machines don't actually have to be intelligent; "
0100         "they just have to fake it. Access to a wealth of information, "
0101         "combined with a rudimentary decision-making capacity, "
0102         "can often be almost as useful. Of course, the results are better yet "
0103         "when coupled with intelligence. A reference librarian with access to "
0104         "a good search engine is a formidable tool."
0105         " - Craig Silverstein, Siemens Pictures of the Future, Spring 2004"
0106         "\n",
0107 
0108         "SXQgd2lsbCBzdGlsbCBiZSBhIGxvbmcgdGltZSBiZWZvcmUgbWFjaGluZXMg"
0109         "YXBwcm9hY2ggaHVtYW4gaW50ZWxsaWdlbmNlLiBCdXQgbHVja2lseSwgbWFj"
0110         "aGluZXMgZG9uJ3QgYWN0dWFsbHkgaGF2ZSB0byBiZSBpbnRlbGxpZ2VudDsg"
0111         "dGhleSBqdXN0IGhhdmUgdG8gZmFrZSBpdC4gQWNjZXNzIHRvIGEgd2VhbHRo"
0112         "IG9mIGluZm9ybWF0aW9uLCBjb21iaW5lZCB3aXRoIGEgcnVkaW1lbnRhcnkg"
0113         "ZGVjaXNpb24tbWFraW5nIGNhcGFjaXR5LCBjYW4gb2Z0ZW4gYmUgYWxtb3N0"
0114         "IGFzIHVzZWZ1bC4gT2YgY291cnNlLCB0aGUgcmVzdWx0cyBhcmUgYmV0dGVy"
0115         "IHlldCB3aGVuIGNvdXBsZWQgd2l0aCBpbnRlbGxpZ2VuY2UuIEEgcmVmZXJl"
0116         "bmNlIGxpYnJhcmlhbiB3aXRoIGFjY2VzcyB0byBhIGdvb2Qgc2VhcmNoIGVu"
0117         "Z2luZSBpcyBhIGZvcm1pZGFibGUgdG9vbC4gLSBDcmFpZyBTaWx2ZXJzdGVp"
0118         "biwgU2llbWVucyBQaWN0dXJlcyBvZiB0aGUgRnV0dXJlLCBTcHJpbmcgMjAw"
0119         "NAo" },
0120 
0121       // Degenerate edge case
0122       { "",
0123         "" },
0124   }};
0125 
0126   return testcase;
0127 }
0128 
0129 }  // namespace strings_internal
0130 ABSL_NAMESPACE_END
0131 }  // namespace absl
0132 
0133 #endif  // ABSL_STRINGS_INTERNAL_ESCAPING_TEST_COMMON_H_