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

Side by Side Diff: mojo/public/cpp/system/tests/macros_unittest.cc

Issue 1348493002: Add fnl build target (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 3 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file tests the C++ Mojo system macros and consists of "positive" tests, 5 // This file tests the C++ Mojo system macros and consists of "positive" tests,
6 // i.e., those verifying that things work (without compile errors, or even 6 // i.e., those verifying that things work (without compile errors, or even
7 // warnings if warnings are treated as errors). 7 // warnings if warnings are treated as errors).
8 // TODO(vtl): Maybe rename "MacrosCppTest" -> "MacrosTest" if/when this gets 8 // TODO(vtl): Maybe rename "MacrosCppTest" -> "MacrosTest" if/when this gets
9 // compiled into a different binary from the C API tests. 9 // compiled into a different binary from the C API tests.
10 // TODO(vtl): Fix no-compile tests (which are all disabled; crbug.com/105388) 10 // TODO(vtl): Fix no-compile tests (which are all disabled; crbug.com/105388)
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 const int kGlobalArray[5] = {1, 2, 3, 4, 5}; 77 const int kGlobalArray[5] = {1, 2, 3, 4, 5};
78 static_assert(MOJO_ARRAYSIZE(kGlobalArray) == 5u, 78 static_assert(MOJO_ARRAYSIZE(kGlobalArray) == 5u,
79 "MOJO_ARRAY_SIZE() failed in static_assert()"); 79 "MOJO_ARRAY_SIZE() failed in static_assert()");
80 80
81 TEST(MacrosCppTest, ArraySize) { 81 TEST(MacrosCppTest, ArraySize) {
82 double local_array[4] = {6.7, 7.8, 8.9, 9.0}; 82 double local_array[4] = {6.7, 7.8, 8.9, 9.0};
83 // MSVS considers this local variable unused since MOJO_ARRAYSIZE only takes 83 // MSVS considers this local variable unused since MOJO_ARRAYSIZE only takes
84 // the size of the type of the local and not the values itself. 84 // the size of the type of the local and not the values itself.
85 MOJO_ALLOW_UNUSED_LOCAL(local_array); 85 MOJO_ALLOW_UNUSED_LOCAL(local_array);
86 EXPECT_EQ(4u, MOJO_ARRAYSIZE(local_array)); 86 EXPECT_EQ(4u, MOJO_ARRAYSIZE(local_array));
87
88 // Prevent gcc unneeded-internal-declaration warning
viettrungluu 2015/09/15 23:48:22 nit: period at the end of the comment.
cdotstout 2015/09/16 22:01:00 Done.
89 MOJO_ALLOW_UNUSED_LOCAL(kGlobalArray);
viettrungluu 2015/09/15 23:48:22 "LOCAL". Sigh. <shrug>
cdotstout 2015/09/16 22:01:00 Acknowledged.
87 } 90 }
88 91
89 // Note: MSVS is very strict (and arguably buggy) about warnings for classes 92 // Note: MSVS is very strict (and arguably buggy) about warnings for classes
90 // defined in a local scope, so define these globally. 93 // defined in a local scope, so define these globally.
91 class MoveOnlyInt { 94 class MoveOnlyInt {
92 MOJO_MOVE_ONLY_TYPE(MoveOnlyInt) 95 MOJO_MOVE_ONLY_TYPE(MoveOnlyInt)
93 96
94 public: 97 public:
95 MoveOnlyInt() : is_set_(false), value_() {} 98 MoveOnlyInt() : is_set_(false), value_() {}
96 explicit MoveOnlyInt(int value) : is_set_(true), value_(value) {} 99 explicit MoveOnlyInt(int value) : is_set_(true), value_(value) {}
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 int ReturnsIntYouMustUse() { 153 int ReturnsIntYouMustUse() {
151 return 123; 154 return 123;
152 } 155 }
153 156
154 TEST(MacrosCppTest, IgnoreResult) { 157 TEST(MacrosCppTest, IgnoreResult) {
155 ignore_result(ReturnsIntYouMustUse()); 158 ignore_result(ReturnsIntYouMustUse());
156 } 159 }
157 160
158 } // namespace 161 } // namespace
159 } // namespace mojo 162 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698