protobuf/src/google/protobuf/stubs/strutil_unittest.cc
Go to the documentation of this file.
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 // Author: kenton@google.com (Kenton Varda)
32 
33 #include <google/protobuf/stubs/strutil.h>
34 
35 #include <locale.h>
36 
37 #include <google/protobuf/stubs/stl_util.h>
38 #include <google/protobuf/testing/googletest.h>
39 #include <gtest/gtest.h>
40 
41 #ifdef _WIN32
42 #define snprintf _snprintf
43 #endif
44 
45 namespace google {
46 namespace protobuf {
47 namespace {
48 
49 // TODO(kenton): Copy strutil tests from google3?
50 
51 TEST(StringUtilityTest, ImmuneToLocales) {
52  // Remember the old locale.
53  char* old_locale_cstr = setlocale(LC_NUMERIC, nullptr);
54  ASSERT_TRUE(old_locale_cstr != nullptr);
55  std::string old_locale = old_locale_cstr;
56 
57  // Set the locale to "C".
58  ASSERT_TRUE(setlocale(LC_NUMERIC, "C") != nullptr);
59 
60  EXPECT_EQ("1.5", SimpleDtoa(1.5));
61  EXPECT_EQ("1.5", SimpleFtoa(1.5));
62 
63  if (setlocale(LC_NUMERIC, "es_ES") == nullptr &&
64  setlocale(LC_NUMERIC, "es_ES.utf8") == nullptr) {
65  // Some systems may not have the desired locale available.
67  << "Couldn't set locale to es_ES. Skipping this test.";
68  } else {
69  EXPECT_EQ("1.5", SimpleDtoa(1.5));
70  EXPECT_EQ("1.5", SimpleFtoa(1.5));
71  }
72 
73  // Return to original locale.
74  setlocale(LC_NUMERIC, old_locale.c_str());
75 }
76 
77 #define EXPECT_EQ_ARRAY(len, x, y, msg) \
78  for (int j = 0; j < len; ++j) { \
79  EXPECT_EQ(x[j], y[j]) << "" # x << " != " # y \
80  << " byte " << j << ": " << msg; \
81  }
82 
83 static struct {
85  const char* plaintext;
86  const char* ciphertext;
87 } base64_tests[] = {
88  // Empty string.
89  { 0, "", ""},
90 
91  // Basic bit patterns;
92  // values obtained with "echo -n '...' | uuencode -m test"
93 
94  { 1, "\000", "AA==" },
95  { 1, "\001", "AQ==" },
96  { 1, "\002", "Ag==" },
97  { 1, "\004", "BA==" },
98  { 1, "\010", "CA==" },
99  { 1, "\020", "EA==" },
100  { 1, "\040", "IA==" },
101  { 1, "\100", "QA==" },
102  { 1, "\200", "gA==" },
103 
104  { 1, "\377", "/w==" },
105  { 1, "\376", "/g==" },
106  { 1, "\375", "/Q==" },
107  { 1, "\373", "+w==" },
108  { 1, "\367", "9w==" },
109  { 1, "\357", "7w==" },
110  { 1, "\337", "3w==" },
111  { 1, "\277", "vw==" },
112  { 1, "\177", "fw==" },
113  { 2, "\000\000", "AAA=" },
114  { 2, "\000\001", "AAE=" },
115  { 2, "\000\002", "AAI=" },
116  { 2, "\000\004", "AAQ=" },
117  { 2, "\000\010", "AAg=" },
118  { 2, "\000\020", "ABA=" },
119  { 2, "\000\040", "ACA=" },
120  { 2, "\000\100", "AEA=" },
121  { 2, "\000\200", "AIA=" },
122  { 2, "\001\000", "AQA=" },
123  { 2, "\002\000", "AgA=" },
124  { 2, "\004\000", "BAA=" },
125  { 2, "\010\000", "CAA=" },
126  { 2, "\020\000", "EAA=" },
127  { 2, "\040\000", "IAA=" },
128  { 2, "\100\000", "QAA=" },
129  { 2, "\200\000", "gAA=" },
130 
131  { 2, "\377\377", "//8=" },
132  { 2, "\377\376", "//4=" },
133  { 2, "\377\375", "//0=" },
134  { 2, "\377\373", "//s=" },
135  { 2, "\377\367", "//c=" },
136  { 2, "\377\357", "/+8=" },
137  { 2, "\377\337", "/98=" },
138  { 2, "\377\277", "/78=" },
139  { 2, "\377\177", "/38=" },
140  { 2, "\376\377", "/v8=" },
141  { 2, "\375\377", "/f8=" },
142  { 2, "\373\377", "+/8=" },
143  { 2, "\367\377", "9/8=" },
144  { 2, "\357\377", "7/8=" },
145  { 2, "\337\377", "3/8=" },
146  { 2, "\277\377", "v/8=" },
147  { 2, "\177\377", "f/8=" },
148 
149  { 3, "\000\000\000", "AAAA" },
150  { 3, "\000\000\001", "AAAB" },
151  { 3, "\000\000\002", "AAAC" },
152  { 3, "\000\000\004", "AAAE" },
153  { 3, "\000\000\010", "AAAI" },
154  { 3, "\000\000\020", "AAAQ" },
155  { 3, "\000\000\040", "AAAg" },
156  { 3, "\000\000\100", "AABA" },
157  { 3, "\000\000\200", "AACA" },
158  { 3, "\000\001\000", "AAEA" },
159  { 3, "\000\002\000", "AAIA" },
160  { 3, "\000\004\000", "AAQA" },
161  { 3, "\000\010\000", "AAgA" },
162  { 3, "\000\020\000", "ABAA" },
163  { 3, "\000\040\000", "ACAA" },
164  { 3, "\000\100\000", "AEAA" },
165  { 3, "\000\200\000", "AIAA" },
166  { 3, "\001\000\000", "AQAA" },
167  { 3, "\002\000\000", "AgAA" },
168  { 3, "\004\000\000", "BAAA" },
169  { 3, "\010\000\000", "CAAA" },
170  { 3, "\020\000\000", "EAAA" },
171  { 3, "\040\000\000", "IAAA" },
172  { 3, "\100\000\000", "QAAA" },
173  { 3, "\200\000\000", "gAAA" },
174 
175  { 3, "\377\377\377", "////" },
176  { 3, "\377\377\376", "///+" },
177  { 3, "\377\377\375", "///9" },
178  { 3, "\377\377\373", "///7" },
179  { 3, "\377\377\367", "///3" },
180  { 3, "\377\377\357", "///v" },
181  { 3, "\377\377\337", "///f" },
182  { 3, "\377\377\277", "//+/" },
183  { 3, "\377\377\177", "//9/" },
184  { 3, "\377\376\377", "//7/" },
185  { 3, "\377\375\377", "//3/" },
186  { 3, "\377\373\377", "//v/" },
187  { 3, "\377\367\377", "//f/" },
188  { 3, "\377\357\377", "/+//" },
189  { 3, "\377\337\377", "/9//" },
190  { 3, "\377\277\377", "/7//" },
191  { 3, "\377\177\377", "/3//" },
192  { 3, "\376\377\377", "/v//" },
193  { 3, "\375\377\377", "/f//" },
194  { 3, "\373\377\377", "+///" },
195  { 3, "\367\377\377", "9///" },
196  { 3, "\357\377\377", "7///" },
197  { 3, "\337\377\377", "3///" },
198  { 3, "\277\377\377", "v///" },
199  { 3, "\177\377\377", "f///" },
200 
201  // Random numbers: values obtained with
202  //
203  // #! /bin/bash
204  // dd bs=$1 count=1 if=/dev/random of=/tmp/bar.random
205  // od -N $1 -t o1 /tmp/bar.random
206  // uuencode -m test < /tmp/bar.random
207  //
208  // where $1 is the number of bytes (2, 3)
209 
210  { 2, "\243\361", "o/E=" },
211  { 2, "\024\167", "FHc=" },
212  { 2, "\313\252", "y6o=" },
213  { 2, "\046\041", "JiE=" },
214  { 2, "\145\236", "ZZ4=" },
215  { 2, "\254\325", "rNU=" },
216  { 2, "\061\330", "Mdg=" },
217  { 2, "\245\032", "pRo=" },
218  { 2, "\006\000", "BgA=" },
219  { 2, "\375\131", "/Vk=" },
220  { 2, "\303\210", "w4g=" },
221  { 2, "\040\037", "IB8=" },
222  { 2, "\261\372", "sfo=" },
223  { 2, "\335\014", "3Qw=" },
224  { 2, "\233\217", "m48=" },
225  { 2, "\373\056", "+y4=" },
226  { 2, "\247\232", "p5o=" },
227  { 2, "\107\053", "Rys=" },
228  { 2, "\204\077", "hD8=" },
229  { 2, "\276\211", "vok=" },
230  { 2, "\313\110", "y0g=" },
231  { 2, "\363\376", "8/4=" },
232  { 2, "\251\234", "qZw=" },
233  { 2, "\103\262", "Q7I=" },
234  { 2, "\142\312", "Yso=" },
235  { 2, "\067\211", "N4k=" },
236  { 2, "\220\001", "kAE=" },
237  { 2, "\152\240", "aqA=" },
238  { 2, "\367\061", "9zE=" },
239  { 2, "\133\255", "W60=" },
240  { 2, "\176\035", "fh0=" },
241  { 2, "\032\231", "Gpk=" },
242 
243  { 3, "\013\007\144", "Cwdk" },
244  { 3, "\030\112\106", "GEpG" },
245  { 3, "\047\325\046", "J9Um" },
246  { 3, "\310\160\022", "yHAS" },
247  { 3, "\131\100\237", "WUCf" },
248  { 3, "\064\342\134", "NOJc" },
249  { 3, "\010\177\004", "CH8E" },
250  { 3, "\345\147\205", "5WeF" },
251  { 3, "\300\343\360", "wOPw" },
252  { 3, "\061\240\201", "MaCB" },
253  { 3, "\225\333\044", "ldsk" },
254  { 3, "\215\137\352", "jV/q" },
255  { 3, "\371\147\160", "+Wdw" },
256  { 3, "\030\320\051", "GNAp" },
257  { 3, "\044\174\241", "JHyh" },
258  { 3, "\260\127\037", "sFcf" },
259  { 3, "\111\045\033", "SSUb" },
260  { 3, "\202\114\107", "gkxH" },
261  { 3, "\057\371\042", "L/ki" },
262  { 3, "\223\247\244", "k6ek" },
263  { 3, "\047\216\144", "J45k" },
264  { 3, "\203\070\327", "gzjX" },
265  { 3, "\247\140\072", "p2A6" },
266  { 3, "\124\115\116", "VE1O" },
267  { 3, "\157\162\050", "b3Io" },
268  { 3, "\357\223\004", "75ME" },
269  { 3, "\052\117\156", "Kk9u" },
270  { 3, "\347\154\000", "52wA" },
271  { 3, "\303\012\142", "wwpi" },
272  { 3, "\060\035\362", "MB3y" },
273  { 3, "\130\226\361", "WJbx" },
274  { 3, "\173\013\071", "ews5" },
275  { 3, "\336\004\027", "3gQX" },
276  { 3, "\357\366\234", "7/ac" },
277  { 3, "\353\304\111", "68RJ" },
278  { 3, "\024\264\131", "FLRZ" },
279  { 3, "\075\114\251", "PUyp" },
280  { 3, "\315\031\225", "zRmV" },
281  { 3, "\154\201\276", "bIG+" },
282  { 3, "\200\066\072", "gDY6" },
283  { 3, "\142\350\267", "Yui3" },
284  { 3, "\033\000\166", "GwB2" },
285  { 3, "\210\055\077", "iC0/" },
286  { 3, "\341\037\124", "4R9U" },
287  { 3, "\161\103\152", "cUNq" },
288  { 3, "\270\142\131", "uGJZ" },
289  { 3, "\337\076\074", "3z48" },
290  { 3, "\375\106\362", "/Uby" },
291  { 3, "\227\301\127", "l8FX" },
292  { 3, "\340\002\234", "4AKc" },
293  { 3, "\121\064\033", "UTQb" },
294  { 3, "\157\134\143", "b1xj" },
295  { 3, "\247\055\327", "py3X" },
296  { 3, "\340\142\005", "4GIF" },
297  { 3, "\060\260\143", "MLBj" },
298  { 3, "\075\203\170", "PYN4" },
299  { 3, "\143\160\016", "Y3AO" },
300  { 3, "\313\013\063", "ywsz" },
301  { 3, "\174\236\135", "fJ5d" },
302  { 3, "\103\047\026", "QycW" },
303  { 3, "\365\005\343", "9QXj" },
304  { 3, "\271\160\223", "uXCT" },
305  { 3, "\362\255\172", "8q16" },
306  { 3, "\113\012\015", "SwoN" },
307 
308  // various lengths, generated by this python script:
309  //
310  // from string import lowercase as lc
311  // for i in range(27):
312  // print '{ %2d, "%s",%s "%s" },' % (i, lc[:i], ' ' * (26-i),
313  // lc[:i].encode('base64').strip())
314 
315  { 0, "", "" },
316  { 1, "a", "YQ==" },
317  { 2, "ab", "YWI=" },
318  { 3, "abc", "YWJj" },
319  { 4, "abcd", "YWJjZA==" },
320  { 5, "abcde", "YWJjZGU=" },
321  { 6, "abcdef", "YWJjZGVm" },
322  { 7, "abcdefg", "YWJjZGVmZw==" },
323  { 8, "abcdefgh", "YWJjZGVmZ2g=" },
324  { 9, "abcdefghi", "YWJjZGVmZ2hp" },
325  { 10, "abcdefghij", "YWJjZGVmZ2hpag==" },
326  { 11, "abcdefghijk", "YWJjZGVmZ2hpams=" },
327  { 12, "abcdefghijkl", "YWJjZGVmZ2hpamts" },
328  { 13, "abcdefghijklm", "YWJjZGVmZ2hpamtsbQ==" },
329  { 14, "abcdefghijklmn", "YWJjZGVmZ2hpamtsbW4=" },
330  { 15, "abcdefghijklmno", "YWJjZGVmZ2hpamtsbW5v" },
331  { 16, "abcdefghijklmnop", "YWJjZGVmZ2hpamtsbW5vcA==" },
332  { 17, "abcdefghijklmnopq", "YWJjZGVmZ2hpamtsbW5vcHE=" },
333  { 18, "abcdefghijklmnopqr", "YWJjZGVmZ2hpamtsbW5vcHFy" },
334  { 19, "abcdefghijklmnopqrs", "YWJjZGVmZ2hpamtsbW5vcHFycw==" },
335  { 20, "abcdefghijklmnopqrst", "YWJjZGVmZ2hpamtsbW5vcHFyc3Q=" },
336  { 21, "abcdefghijklmnopqrstu", "YWJjZGVmZ2hpamtsbW5vcHFyc3R1" },
337  { 22, "abcdefghijklmnopqrstuv", "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dg==" },
338  { 23, "abcdefghijklmnopqrstuvw", "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnc=" },
339  { 24, "abcdefghijklmnopqrstuvwx", "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4" },
340  { 25, "abcdefghijklmnopqrstuvwxy", "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eQ==" },
341  { 26, "abcdefghijklmnopqrstuvwxyz", "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXo=" },
342 };
343 
344 static struct {
345  const char* plaintext;
346  const char* ciphertext;
347 } base64_strings[] = {
348  // Some google quotes
349  // Ciphertext created with "uuencode (GNU sharutils) 4.6.3"
350  // (Note that we're testing the websafe encoding, though, so if
351  // you add messages, be sure to run "tr -- '+/' '-_'" on the output)
352  {"I was always good at math and science, and I never realized "
353  "that was unusual or somehow undesirable. So one of the things "
354  "I care a lot about is helping to remove that stigma, "
355  "to show girls that you can be feminine, you can like the things "
356  "that girls like, but you can also be really good at technology. "
357  "You can be really good at building things."
358  " - Marissa Meyer, Newsweek, 2010-12-22"
359  "\n",
360 
361  "SSB3YXMgYWx3YXlzIGdvb2QgYXQgbWF0aCBhbmQgc2NpZW5jZSwgYW5kIEkg"
362  "bmV2ZXIgcmVhbGl6ZWQgdGhhdCB3YXMgdW51c3VhbCBvciBzb21laG93IHVu"
363  "ZGVzaXJhYmxlLiBTbyBvbmUgb2YgdGhlIHRoaW5ncyBJIGNhcmUgYSBsb3Qg"
364  "YWJvdXQgaXMgaGVscGluZyB0byByZW1vdmUgdGhhdCBzdGlnbWEsIHRvIHNo"
365  "b3cgZ2lybHMgdGhhdCB5b3UgY2FuIGJlIGZlbWluaW5lLCB5b3UgY2FuIGxp"
366  "a2UgdGhlIHRoaW5ncyB0aGF0IGdpcmxzIGxpa2UsIGJ1dCB5b3UgY2FuIGFs"
367  "c28gYmUgcmVhbGx5IGdvb2QgYXQgdGVjaG5vbG9neS4gWW91IGNhbiBiZSBy"
368  "ZWFsbHkgZ29vZCBhdCBidWlsZGluZyB0aGluZ3MuIC0gTWFyaXNzYSBNZXll"
369  "ciwgTmV3c3dlZWssIDIwMTAtMTItMjIK"},
370 
371  {"Typical first year for a new cluster: "
372  "~0.5 overheating "
373  "~1 PDU failure "
374  "~1 rack-move "
375  "~1 network rewiring "
376  "~20 rack failures "
377  "~5 racks go wonky "
378  "~8 network maintenances "
379  "~12 router reloads "
380  "~3 router failures "
381  "~dozens of minor 30-second blips for dns "
382  "~1000 individual machine failures "
383  "~thousands of hard drive failures "
384  "slow disks, bad memory, misconfigured machines, flaky machines, etc."
385  " - Jeff Dean, The Joys of Real Hardware"
386  "\n",
387 
388  "VHlwaWNhbCBmaXJzdCB5ZWFyIGZvciBhIG5ldyBjbHVzdGVyOiB-MC41IG92"
389  "ZXJoZWF0aW5nIH4xIFBEVSBmYWlsdXJlIH4xIHJhY2stbW92ZSB-MSBuZXR3"
390  "b3JrIHJld2lyaW5nIH4yMCByYWNrIGZhaWx1cmVzIH41IHJhY2tzIGdvIHdv"
391  "bmt5IH44IG5ldHdvcmsgbWFpbnRlbmFuY2VzIH4xMiByb3V0ZXIgcmVsb2Fk"
392  "cyB-MyByb3V0ZXIgZmFpbHVyZXMgfmRvemVucyBvZiBtaW5vciAzMC1zZWNv"
393  "bmQgYmxpcHMgZm9yIGRucyB-MTAwMCBpbmRpdmlkdWFsIG1hY2hpbmUgZmFp"
394  "bHVyZXMgfnRob3VzYW5kcyBvZiBoYXJkIGRyaXZlIGZhaWx1cmVzIHNsb3cg"
395  "ZGlza3MsIGJhZCBtZW1vcnksIG1pc2NvbmZpZ3VyZWQgbWFjaGluZXMsIGZs"
396  "YWt5IG1hY2hpbmVzLCBldGMuIC0gSmVmZiBEZWFuLCBUaGUgSm95cyBvZiBS"
397  "ZWFsIEhhcmR3YXJlCg"},
398 
399  {"I'm the head of the webspam team at Google. "
400  "That means that if you type your name into Google and get porn back, "
401  "it's my fault. Unless you're a porn star, in which case porn is a "
402  "completely reasonable response."
403  " - Matt Cutts, Google Plus"
404  "\n",
405 
406  "SSdtIHRoZSBoZWFkIG9mIHRoZSB3ZWJzcGFtIHRlYW0gYXQgR29vZ2xlLiAg"
407  "VGhhdCBtZWFucyB0aGF0IGlmIHlvdSB0eXBlIHlvdXIgbmFtZSBpbnRvIEdv"
408  "b2dsZSBhbmQgZ2V0IHBvcm4gYmFjaywgaXQncyBteSBmYXVsdC4gVW5sZXNz"
409  "IHlvdSdyZSBhIHBvcm4gc3RhciwgaW4gd2hpY2ggY2FzZSBwb3JuIGlzIGEg"
410  "Y29tcGxldGVseSByZWFzb25hYmxlIHJlc3BvbnNlLiAtIE1hdHQgQ3V0dHMs"
411  "IEdvb2dsZSBQbHVzCg"},
412 
413  {"It will still be a long time before machines approach human "
414  "intelligence. "
415  "But luckily, machines don't actually have to be intelligent; "
416  "they just have to fake it. Access to a wealth of information, "
417  "combined with a rudimentary decision-making capacity, "
418  "can often be almost as useful. Of course, the results are better yet "
419  "when coupled with intelligence. A reference librarian with access to "
420  "a good search engine is a formidable tool."
421  " - Craig Silverstein, Siemens Pictures of the Future, Spring 2004"
422  "\n",
423 
424  "SXQgd2lsbCBzdGlsbCBiZSBhIGxvbmcgdGltZSBiZWZvcmUgbWFjaGluZXMg"
425  "YXBwcm9hY2ggaHVtYW4gaW50ZWxsaWdlbmNlLiBCdXQgbHVja2lseSwgbWFj"
426  "aGluZXMgZG9uJ3QgYWN0dWFsbHkgaGF2ZSB0byBiZSBpbnRlbGxpZ2VudDsg"
427  "dGhleSBqdXN0IGhhdmUgdG8gZmFrZSBpdC4gQWNjZXNzIHRvIGEgd2VhbHRo"
428  "IG9mIGluZm9ybWF0aW9uLCBjb21iaW5lZCB3aXRoIGEgcnVkaW1lbnRhcnkg"
429  "ZGVjaXNpb24tbWFraW5nIGNhcGFjaXR5LCBjYW4gb2Z0ZW4gYmUgYWxtb3N0"
430  "IGFzIHVzZWZ1bC4gT2YgY291cnNlLCB0aGUgcmVzdWx0cyBhcmUgYmV0dGVy"
431  "IHlldCB3aGVuIGNvdXBsZWQgd2l0aCBpbnRlbGxpZ2VuY2UuIEEgcmVmZXJl"
432  "bmNlIGxpYnJhcmlhbiB3aXRoIGFjY2VzcyB0byBhIGdvb2Qgc2VhcmNoIGVu"
433  "Z2luZSBpcyBhIGZvcm1pZGFibGUgdG9vbC4gLSBDcmFpZyBTaWx2ZXJzdGVp"
434  "biwgU2llbWVucyBQaWN0dXJlcyBvZiB0aGUgRnV0dXJlLCBTcHJpbmcgMjAw"
435  "NAo"},
436 
437  // Degenerate edge case
438  {"", ""},
439 };
440 
441 TEST(Base64, EscapeAndUnescape) {
442  // Check the short strings; this tests the math (and boundaries)
443  for (int i = 0; i < sizeof(base64_tests) / sizeof(base64_tests[0]); ++i) {
444  char encode_buffer[100];
445  int encode_length;
446  char decode_buffer[100];
447  int decode_length;
448  int cipher_length;
449  std::string decode_str;
450 
451  const unsigned char* unsigned_plaintext =
452  reinterpret_cast<const unsigned char*>(base64_tests[i].plaintext);
453 
454  StringPiece plaintext(base64_tests[i].plaintext,
455  base64_tests[i].plain_length);
456 
457  cipher_length = strlen(base64_tests[i].ciphertext);
458 
459  // The basic escape function:
460  memset(encode_buffer, 0, sizeof(encode_buffer));
461  encode_length = Base64Escape(unsigned_plaintext,
462  base64_tests[i].plain_length,
463  encode_buffer,
464  sizeof(encode_buffer));
465  // Is it of the expected length?
466  EXPECT_EQ(encode_length, cipher_length);
467  // Would it have been okay to allocate only CalculateBase64EscapeLen()?
469  encode_length);
470 
471  // Is it the expected encoded value?
472  ASSERT_STREQ(encode_buffer, base64_tests[i].ciphertext);
473 
474  // If we encode it into a buffer of exactly the right length...
475  memset(encode_buffer, 0, sizeof(encode_buffer));
476  encode_length =
477  Base64Escape(unsigned_plaintext, base64_tests[i].plain_length,
478  encode_buffer, cipher_length);
479  // Is it still of the expected length?
480  EXPECT_EQ(encode_length, cipher_length);
481 
482  // And is the value still correct? (i.e., not losing the last byte)
483  EXPECT_STREQ(encode_buffer, base64_tests[i].ciphertext);
484 
485  // If we decode it back:
486  decode_str.clear();
487  EXPECT_TRUE(
488  Base64Unescape(StringPiece(encode_buffer, cipher_length), &decode_str));
489 
490  // Is it of the expected length?
491  EXPECT_EQ(base64_tests[i].plain_length, decode_str.length());
492 
493  // Is it the expected decoded value?
494  EXPECT_EQ(plaintext, decode_str);
495 
496  // Let's try with a pre-populated string.
497  std::string encoded("this junk should be ignored");
498  Base64Escape(
499  std::string(base64_tests[i].plaintext, base64_tests[i].plain_length),
500  &encoded);
501  EXPECT_EQ(encoded, std::string(encode_buffer, cipher_length));
502 
503  std::string decoded("this junk should be ignored");
504  EXPECT_TRUE(
505  Base64Unescape(StringPiece(encode_buffer, cipher_length), &decoded));
506  EXPECT_EQ(decoded.size(), base64_tests[i].plain_length);
507  EXPECT_EQ_ARRAY(decoded.size(), decoded, base64_tests[i].plaintext, i);
508 
509  // Our decoder treats the padding '=' characters at the end as
510  // optional (but if there are any, there must be the correct
511  // number of them.) If encode_buffer has any, run some additional
512  // tests that fiddle with them.
513  char* first_equals = strchr(encode_buffer, '=');
514  if (first_equals) {
515  // How many equals signs does the string start with?
516  int equals = (*(first_equals+1) == '=') ? 2 : 1;
517 
518  // Try chopping off the equals sign(s) entirely. The decoder
519  // should still be okay with this.
520  std::string decoded2("this junk should also be ignored");
521  *first_equals = '\0';
523  StringPiece(encode_buffer, first_equals - encode_buffer), &decoded2));
524  EXPECT_EQ(decoded.size(), base64_tests[i].plain_length);
525  EXPECT_EQ_ARRAY(decoded.size(), decoded, base64_tests[i].plaintext, i);
526 
527  // Now test chopping off the equals sign(s) and adding
528  // whitespace. Our decoder should still accept this.
529  decoded2.assign("this junk should be ignored");
530  *first_equals = ' ';
531  *(first_equals+1) = '\0';
533  StringPiece(encode_buffer, first_equals - encode_buffer + 1),
534  &decoded2));
535  EXPECT_EQ(decoded.size(), base64_tests[i].plain_length);
536  EXPECT_EQ_ARRAY(decoded.size(), decoded, base64_tests[i].plaintext, i);
537 
538  // Now stick a bad character at the end of the string. The decoder
539  // should refuse this string.
540  decoded2.assign("this junk should be ignored");
541  *first_equals = '?';
542  *(first_equals+1) = '\0';
543  EXPECT_TRUE(
545  StringPiece(encode_buffer, first_equals - encode_buffer + 1),
546  &decoded2));
547 
548  int len;
549 
550  // Test whitespace mixed with the padding. (eg "AA = = ") The
551  // decoder should accept this.
552  if (equals == 2) {
553  snprintf(first_equals, 6, " = = ");
554  len = first_equals - encode_buffer + 5;
555  } else {
556  snprintf(first_equals, 6, " = ");
557  len = first_equals - encode_buffer + 3;
558  }
559  decoded2.assign("this junk should be ignored");
560  EXPECT_TRUE(
561  Base64Unescape(StringPiece(encode_buffer, len), &decoded2));
562  EXPECT_EQ(decoded.size(), base64_tests[i].plain_length);
563  EXPECT_EQ_ARRAY(decoded.size(), decoded, base64_tests[i].plaintext, i);
564 
565  // Test whitespace mixed with the padding, but with the wrong
566  // number of equals signs (eg "AA = "). The decoder should
567  // refuse these strings.
568  if (equals == 1) {
569  snprintf(first_equals, 6, " = = ");
570  len = first_equals - encode_buffer + 5;
571  } else {
572  snprintf(first_equals, 6, " = ");
573  len = first_equals - encode_buffer + 3;
574  }
575  EXPECT_TRUE(
576  !Base64Unescape(StringPiece(encode_buffer, len), &decoded2));
577  }
578 
579  // Cool! the basic Base64 encoder/decoder works.
580  // Let's try the alternate alphabet: tr -- '+/' '-_'
581 
582  char websafe[100];
583  memset(websafe, 0, sizeof(websafe));
584  strncpy(websafe, base64_tests[i].ciphertext, cipher_length);
585  for (int c = 0; c < sizeof(websafe); ++c) {
586  if ('+' == websafe[c]) { websafe[c] = '-'; }
587  if ('/' == websafe[c]) { websafe[c] = '_'; }
588  }
589 
590  // The websafe escape function:
591  memset(encode_buffer, 0, sizeof(encode_buffer));
592  encode_length = WebSafeBase64Escape(unsigned_plaintext,
593  base64_tests[i].plain_length,
594  encode_buffer,
595  sizeof(encode_buffer),
596  true);
597  // Is it of the expected length?
598  EXPECT_EQ(encode_length, cipher_length);
599  EXPECT_EQ(
600  CalculateBase64EscapedLen(base64_tests[i].plain_length, true),
601  encode_length);
602 
603  // Is it the expected encoded value?
604  EXPECT_STREQ(encode_buffer, websafe);
605 
606  // If we encode it into a buffer of exactly the right length...
607  memset(encode_buffer, 0, sizeof(encode_buffer));
608  encode_length =
609  WebSafeBase64Escape(unsigned_plaintext, base64_tests[i].plain_length,
610  encode_buffer, cipher_length, true);
611  // Is it still of the expected length?
612  EXPECT_EQ(encode_length, cipher_length);
613 
614  // And is the value still correct? (i.e., not losing the last byte)
615  EXPECT_STREQ(encode_buffer, websafe);
616 
617  // Let's try the string version of the encoder
618  encoded = "this junk should be ignored";
620  unsigned_plaintext, base64_tests[i].plain_length,
621  &encoded, true);
622  EXPECT_EQ(encoded.size(), cipher_length);
623  EXPECT_STREQ(encoded.c_str(), websafe);
624 
625  // If we decode it back:
626  memset(decode_buffer, 0, sizeof(decode_buffer));
627  decode_length = WebSafeBase64Unescape(encode_buffer, cipher_length,
628  decode_buffer, sizeof(decode_buffer));
629 
630  // Is it of the expected length?
631  EXPECT_EQ(decode_length, base64_tests[i].plain_length);
632 
633  // Is it the expected decoded value?
634  EXPECT_EQ(0,
635  memcmp(decode_buffer, base64_tests[i].plaintext, decode_length));
636 
637  // If we decode it into a buffer of exactly the right length...
638  memset(decode_buffer, 0, sizeof(decode_buffer));
639  decode_length = WebSafeBase64Unescape(encode_buffer, cipher_length,
640  decode_buffer, decode_length);
641 
642  // Is it still of the expected length?
643  EXPECT_EQ(decode_length, base64_tests[i].plain_length);
644 
645  // And is it the expected decoded value?
646  EXPECT_EQ(0,
647  memcmp(decode_buffer, base64_tests[i].plaintext, decode_length));
648 
649  // Try using '.' for the pad character.
650  for (int c = cipher_length - 1; c >= 0 && '=' == encode_buffer[c]; --c) {
651  encode_buffer[c] = '.';
652  }
653 
654  // If we decode it back:
655  memset(decode_buffer, 0, sizeof(decode_buffer));
656  decode_length = WebSafeBase64Unescape(encode_buffer, cipher_length,
657  decode_buffer, sizeof(decode_buffer));
658 
659  // Is it of the expected length?
660  EXPECT_EQ(decode_length, base64_tests[i].plain_length);
661 
662  // Is it the expected decoded value?
663  EXPECT_EQ(0,
664  memcmp(decode_buffer, base64_tests[i].plaintext, decode_length));
665 
666  // If we decode it into a buffer of exactly the right length...
667  memset(decode_buffer, 0, sizeof(decode_buffer));
668  decode_length = WebSafeBase64Unescape(encode_buffer, cipher_length,
669  decode_buffer, decode_length);
670 
671  // Is it still of the expected length?
672  EXPECT_EQ(decode_length, base64_tests[i].plain_length);
673 
674  // And is it the expected decoded value?
675  EXPECT_EQ(0,
676  memcmp(decode_buffer, base64_tests[i].plaintext, decode_length));
677 
678  // Let's try the string version of the decoder
679  decoded = "this junk should be ignored";
680  EXPECT_TRUE(WebSafeBase64Unescape(StringPiece(encode_buffer, cipher_length),
681  &decoded));
682  EXPECT_EQ(decoded.size(), base64_tests[i].plain_length);
683  EXPECT_EQ_ARRAY(decoded.size(), decoded, base64_tests[i].plaintext, i);
684 
685  // Okay! the websafe Base64 encoder/decoder works.
686  // Let's try the unpadded version
687 
688  for (int c = 0; c < sizeof(websafe); ++c) {
689  if ('=' == websafe[c]) {
690  websafe[c] = '\0';
691  cipher_length = c;
692  break;
693  }
694  }
695 
696  // The websafe escape function:
697  memset(encode_buffer, 0, sizeof(encode_buffer));
698  encode_length = WebSafeBase64Escape(unsigned_plaintext,
699  base64_tests[i].plain_length,
700  encode_buffer,
701  sizeof(encode_buffer),
702  false);
703  // Is it of the expected length?
704  EXPECT_EQ(encode_length, cipher_length);
705  EXPECT_EQ(
706  CalculateBase64EscapedLen(base64_tests[i].plain_length, false),
707  encode_length);
708 
709  // Is it the expected encoded value?
710  EXPECT_STREQ(encode_buffer, websafe);
711 
712  // If we encode it into a buffer of exactly the right length...
713  memset(encode_buffer, 0, sizeof(encode_buffer));
714  encode_length =
715  WebSafeBase64Escape(unsigned_plaintext, base64_tests[i].plain_length,
716  encode_buffer, cipher_length, false);
717  // Is it still of the expected length?
718  EXPECT_EQ(encode_length, cipher_length);
719 
720  // And is the value still correct? (i.e., not losing the last byte)
721  EXPECT_STREQ(encode_buffer, websafe);
722 
723  // Let's try the (other) string version of the encoder
724  std::string plain(base64_tests[i].plaintext, base64_tests[i].plain_length);
725  encoded = "this junk should be ignored";
726  WebSafeBase64Escape(plain, &encoded);
727  EXPECT_EQ(encoded.size(), cipher_length);
728  EXPECT_STREQ(encoded.c_str(), websafe);
729 
730  // If we decode it back:
731  memset(decode_buffer, 0, sizeof(decode_buffer));
732  decode_length = WebSafeBase64Unescape(encode_buffer, cipher_length,
733  decode_buffer, sizeof(decode_buffer));
734 
735  // Is it of the expected length?
736  EXPECT_EQ(decode_length, base64_tests[i].plain_length);
737 
738  // Is it the expected decoded value?
739  EXPECT_EQ(0,
740  memcmp(decode_buffer, base64_tests[i].plaintext, decode_length));
741 
742  // If we decode it into a buffer of exactly the right length...
743  memset(decode_buffer, 0, sizeof(decode_buffer));
744  decode_length = WebSafeBase64Unescape(encode_buffer, cipher_length,
745  decode_buffer, decode_length);
746 
747  // Is it still of the expected length?
748  EXPECT_EQ(decode_length, base64_tests[i].plain_length);
749 
750  // And is it the expected decoded value?
751  EXPECT_EQ(0,
752  memcmp(decode_buffer, base64_tests[i].plaintext, decode_length));
753 
754 
755  // Let's try the string version of the decoder
756  decoded = "this junk should be ignored";
757  EXPECT_TRUE(WebSafeBase64Unescape(StringPiece(encode_buffer, cipher_length),
758  &decoded));
759  EXPECT_EQ(decoded.size(), base64_tests[i].plain_length);
760  EXPECT_EQ_ARRAY(decoded.size(), decoded, base64_tests[i].plaintext, i);
761 
762  // This value works. Try the next.
763  }
764 
765  // Now try the long strings, this tests the streaming
766  for (int i = 0; i < sizeof(base64_strings) / sizeof(base64_strings[0]);
767  ++i) {
768  const unsigned char* unsigned_plaintext =
769  reinterpret_cast<const unsigned char*>(base64_strings[i].plaintext);
770  int plain_length = strlen(base64_strings[i].plaintext);
771  int cipher_length = strlen(base64_strings[i].ciphertext);
772  std::vector<char> buffer(cipher_length + 1);
773  int encode_length = WebSafeBase64Escape(unsigned_plaintext,
774  plain_length,
775  &buffer[0],
776  buffer.size(),
777  false);
778  EXPECT_EQ(cipher_length, encode_length);
779  EXPECT_EQ(
780  CalculateBase64EscapedLen(plain_length, false), encode_length);
781  buffer[ encode_length ] = '\0';
783  }
784 
785  // Verify the behavior when decoding bad data
786  {
787  const char* bad_data = "ab-/";
789  EXPECT_FALSE(Base64Unescape(StringPiece(bad_data), &buf));
790  EXPECT_TRUE(!WebSafeBase64Unescape(bad_data, &buf));
791  EXPECT_TRUE(buf.empty());
792  }
793 }
794 
795 // Test StrCat of ints and longs of various sizes and signdedness.
796 TEST(StrCat, Ints) {
797  const short s = -1; // NOLINT(runtime/int)
798  const uint16_t us = 2;
799  const int i = -3;
800  const unsigned int ui = 4;
801  const long l = -5; // NOLINT(runtime/int)
802  const unsigned long ul = 6; // NOLINT(runtime/int)
803  const long long ll = -7; // NOLINT(runtime/int)
804  const unsigned long long ull = 8; // NOLINT(runtime/int)
805  const ptrdiff_t ptrdiff = -9;
806  const size_t size = 10;
807  const intptr_t intptr = -12;
808  const uintptr_t uintptr = 13;
809  std::string answer;
810  answer = StrCat(s, us);
811  EXPECT_EQ(answer, "-12");
812  answer = StrCat(i, ui);
813  EXPECT_EQ(answer, "-34");
814  answer = StrCat(l, ul);
815  EXPECT_EQ(answer, "-56");
816  answer = StrCat(ll, ull);
817  EXPECT_EQ(answer, "-78");
818  answer = StrCat(ptrdiff, size);
819  EXPECT_EQ(answer, "-910");
820  answer = StrCat(ptrdiff, intptr);
821  EXPECT_EQ(answer, "-9-12");
822  answer = StrCat(uintptr, 0);
823  EXPECT_EQ(answer, "130");
824 }
825 
826 class ReplaceChars
827  : public ::testing::TestWithParam<
828  std::tuple<std::string, std::string, const char*, char>> {};
829 
830 TEST_P(ReplaceChars, ReplacesAllOccurencesOfAnyCharInReplaceWithAReplaceChar) {
831  std::string expected = std::get<0>(GetParam());
832  std::string string_to_replace_in = std::get<1>(GetParam());
833  const char* what_to_replace = std::get<2>(GetParam());
834  char replacement = std::get<3>(GetParam());
835  ReplaceCharacters(&string_to_replace_in, what_to_replace, replacement);
836  ASSERT_EQ(expected, string_to_replace_in);
837 }
838 
840  Replace, ReplaceChars,
841  ::testing::Values(
842  std::make_tuple("", "", "", '_'), // empty string should remain empty
843  std::make_tuple(" ", " ", "", '_'), // no replacement string
844  std::make_tuple(" ", " ", "_-abcedf",
845  '*'), // replacement character not in string
846  std::make_tuple("replace", "Replace", "R",
847  'r'), // replace one character
848  std::make_tuple("not_spaces__", "not\nspaces\t ", " \t\r\n",
849  '_'), // replace some special characters
850  std::make_tuple("c++", "cxx", "x",
851  '+'), // same character multiple times
852  std::make_tuple("qvvvvvng v T", "queueing a T", "aeiou",
853  'v'))); // replace all voewls
854 
855 class StripWs
856  : public ::testing::TestWithParam<std::tuple<std::string, std::string>> {};
857 
858 TEST_P(StripWs, AlwaysStripsLeadingAndTrailingWhitespace) {
859  std::string expected = std::get<0>(GetParam());
860  std::string string_to_strip = std::get<1>(GetParam());
861  StripWhitespace(&string_to_strip);
862  ASSERT_EQ(expected, string_to_strip);
863 }
864 
866  Strip, StripWs,
867  ::testing::Values(
868  std::make_tuple("", ""), // empty string should remain empty
869  std::make_tuple("", " "), // only ws should become empty
870  std::make_tuple("no whitespace",
871  " no whitespace"), // leading ws removed
872  std::make_tuple("no whitespace",
873  "no whitespace "), // trailing ws removed
874  std::make_tuple("no whitespace",
875  " no whitespace "), // same nb. of leading and trailing
877  "no whitespace",
878  " no whitespace "), // different nb. of leading/trailing
879  std::make_tuple("no whitespace",
880  " no whitespace "))); // more trailing than leading
881 
882 } // anonymous namespace
883 } // namespace protobuf
884 } // namespace google
EXPECT_FALSE
#define EXPECT_FALSE(condition)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:1970
INSTANTIATE_TEST_CASE_P
#define INSTANTIATE_TEST_CASE_P
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest-param-test.h:495
google::protobuf::CalculateBase64EscapedLen
int CalculateBase64EscapedLen(int input_len, bool do_padding)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:1653
plain_length
int plain_length
Definition: protobuf/src/google/protobuf/stubs/strutil_unittest.cc:84
google::protobuf::WebSafeBase64Unescape
int WebSafeBase64Unescape(const char *src, int szsrc, char *dest, int szdest)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:2063
memset
return memset(p, 0, total)
fix_build_deps.c
list c
Definition: fix_build_deps.py:490
uint16_t
unsigned short uint16_t
Definition: stdint-msvc2008.h:79
ASSERT_STREQ
#define ASSERT_STREQ(s1, s2)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:2104
std::tr1::make_tuple
tuple make_tuple()
Definition: cares/cares/test/gmock-1.8.0/gtest/gtest.h:1619
buf
voidpf void * buf
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
ciphertext
const char * ciphertext
Definition: protobuf/src/google/protobuf/stubs/strutil_unittest.cc:86
google::protobuf
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:12
absl::FormatConversionChar::s
@ s
google::protobuf::ReplaceCharacters
void ReplaceCharacters(string *s, const char *remove, char replacewith)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:103
google::protobuf::StrCat
string StrCat(const AlphaNum &a, const AlphaNum &b)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:1482
testing::TestWithParam
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:1883
EXPECT_EQ
#define EXPECT_EQ(a, b)
Definition: iomgr/time_averaged_stats_test.cc:27
google::protobuf::TEST_P
TEST_P(DynamicMessageTest, IndependentOffsets)
Definition: bloaty/third_party/protobuf/src/google/protobuf/dynamic_message_unittest.cc:143
google::protobuf::Base64Unescape
bool Base64Unescape(StringPiece src, string *dest)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:2092
google::protobuf::StripWhitespace
void StripWhitespace(string *str)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:113
google::protobuf::SimpleFtoa
string SimpleFtoa(float value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:1226
grpc_ruby_generator::Replace
std::string Replace(std::string s, const std::string &from, const std::string &to)
Definition: ruby_generator_string-inl.h:52
intptr_t
_W64 signed int intptr_t
Definition: stdint-msvc2008.h:118
google::protobuf::WebSafeBase64Escape
int WebSafeBase64Escape(const unsigned char *src, int szsrc, char *dest, int szdest, bool do_padding)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:2209
google::protobuf::WARNING
static const LogLevel WARNING
Definition: bloaty/third_party/protobuf/src/google/protobuf/testing/googletest.h:71
google::protobuf::TEST
TEST(ArenaTest, ArenaConstructable)
Definition: bloaty/third_party/protobuf/src/google/protobuf/arena_unittest.cc:156
buffer
char buffer[1024]
Definition: libuv/docs/code/idle-compute/main.c:8
uintptr_t
_W64 unsigned int uintptr_t
Definition: stdint-msvc2008.h:119
EXPECT_STREQ
#define EXPECT_STREQ(s1, s2)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:2095
google::protobuf::SimpleDtoa
string SimpleDtoa(double value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:1221
testing::Values
internal::ValueArray< T... > Values(T... v)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest-param-test.h:335
google::protobuf::Base64Escape
int Base64Escape(const unsigned char *src, int szsrc, char *dest, int szdest)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:2206
EXPECT_EQ_ARRAY
#define EXPECT_EQ_ARRAY(len, x, y, msg)
Definition: protobuf/src/google/protobuf/stubs/strutil_unittest.cc:77
absl::strings_internal::base64_strings
const std::array< base64_testcase, 5 > & base64_strings()
Definition: abseil-cpp/absl/strings/internal/escaping_test_common.h:33
ASSERT_TRUE
#define ASSERT_TRUE(condition)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:1973
EXPECT_TRUE
#define EXPECT_TRUE(condition)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:1967
len
int len
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:46
run_grpclb_interop_tests.l
dictionary l
Definition: run_grpclb_interop_tests.py:410
size
voidpf void uLong size
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136
plaintext
const char * plaintext
Definition: protobuf/src/google/protobuf/stubs/strutil_unittest.cc:85
GOOGLE_LOG
#define GOOGLE_LOG(LEVEL)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/logging.h:146
google
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:11
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
absl::str_format_internal::LengthMod::ll
@ ll
ASSERT_EQ
#define ASSERT_EQ(val1, val2)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:2056


grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:23