Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: third_party/protobuf/objectivec/Tests/GPBObjectiveCPlusPlusTest.mm

Issue 1842653006: Update //third_party/protobuf to version 3. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Protocol Buffers - Google's data interchange format 1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2009 Google Inc. All rights reserved. 2 // Copyright 2013 Google Inc. All rights reserved.
3 // http://code.google.com/p/protobuf/ 3 // https://developers.google.com/protocol-buffers/
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are 6 // modification, are permitted provided that the following conditions are
7 // met: 7 // met:
8 // 8 //
9 // * Redistributions of source code must retain the above copyright 9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer. 10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above 11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer 12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the 13 // in the documentation and/or other materials provided with the
14 // distribution. 14 // distribution.
15 // * Neither the name of Google Inc. nor the names of its 15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from 16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission. 17 // this software without specific prior written permission.
18 // 18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 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. 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 30
31 // Author: brianolson@google.com (Brian Olson) 31
32 // Based on original Protocol Buffers design by 32 #import "GPBTestUtilities.h"
33 // Sanjay Ghemawat, Jeff Dean, and others. 33
34
34 // 35 //
35 // Test program to verify that GzipInputStream is compatible with command line 36 // This is just a compile test (here to make sure things never regress).
36 // gunzip or java.util.zip.GzipInputStream
37 // 37 //
38 // Reads gzip stream on standard input and writes decompressed data to standard 38 // Objective C++ can run into issues with how the NS_ENUM/CF_ENUM declartion
39 // output. 39 // works because of the C++ spec being used for that compilation unit. So
40 // the fact that these imports all work without errors/warning means things
41 // are still good.
42 //
43 // The "well know types" should have cross file enums needing imports.
44 #import "GPBProtocolBuffers.h"
45 // Some of the tests explicitly use cross file enums also.
46 #import "google/protobuf/Unittest.pbobjc.h"
47 #import "google/protobuf/UnittestImport.pbobjc.h"
40 48
41 #include "config.h" 49 // Sanity check the conditions of the test within the Xcode project.
50 #if !__cplusplus
51 #error This isn't compiled as Objective C++?
52 #elif __cplusplus >= 201103L
53 // If this trips, it means the Xcode default might have change (or someone
54 // edited the testing project) and it might be time to revisit the GPB_ENUM
55 // define in GPBBootstrap.h.
56 #warning Did the Xcode default for C++ spec change?
57 #endif
42 58
43 #include <assert.h>
44 #include <stdio.h>
45 #include <stdlib.h>
46 #include <fcntl.h>
47 59
48 #include <google/protobuf/io/gzip_stream.h> 60 // Dummy XCTest.
49 #include <google/protobuf/io/zero_copy_stream_impl.h> 61 @interface GPBObjectiveCPlusPlusTests : GPBTestCase
62 @end
50 63
51 using google::protobuf::io::FileInputStream; 64 @implementation GPBObjectiveCPlusPlusTests
52 using google::protobuf::io::GzipInputStream; 65 - (void)testCPlusPlus {
53 66 // Nothing, This was a compile test.
54 int main(int argc, const char** argv) { 67 XCTAssertTrue(YES);
55 FileInputStream fin(STDIN_FILENO);
56 GzipInputStream in(&fin);
57
58 while (true) {
59 const void* inptr;
60 int inlen;
61 bool ok;
62 ok = in.Next(&inptr, &inlen);
63 if (!ok) {
64 break;
65 }
66 if (inlen > 0) {
67 int err = write(STDOUT_FILENO, inptr, inlen);
68 assert(err == inlen);
69 }
70 }
71
72 return 0;
73 } 68 }
69 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698