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

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

Issue 469393002: Mojo: clang-format mojo/public/c/... and add a presubmit check. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « mojo/public/c/system/tests/core_unittest_pure_c.c ('k') | mojo/public/c/system/types.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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): Fix no-compile tests (which are all disabled; crbug.com/105388) 8 // TODO(vtl): Fix no-compile tests (which are all disabled; crbug.com/105388)
9 // and write some "negative" tests. 9 // and write some "negative" tests.
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 EXPECT_EQ(4u, MOJO_ALIGNOF(int32_t)); 51 EXPECT_EQ(4u, MOJO_ALIGNOF(int32_t));
52 EXPECT_EQ(8u, MOJO_ALIGNOF(int64_t)); 52 EXPECT_EQ(8u, MOJO_ALIGNOF(int64_t));
53 EXPECT_EQ(8u, MOJO_ALIGNOF(double)); 53 EXPECT_EQ(8u, MOJO_ALIGNOF(double));
54 } 54 }
55 55
56 // These structs are used in the Alignas test. Define them globally to avoid 56 // These structs are used in the Alignas test. Define them globally to avoid
57 // MSVS warnings/errors. 57 // MSVS warnings/errors.
58 #if defined(_MSC_VER) 58 #if defined(_MSC_VER)
59 #pragma warning(push) 59 #pragma warning(push)
60 // Disable the warning "structure was padded due to __declspec(align())". 60 // Disable the warning "structure was padded due to __declspec(align())".
61 #pragma warning(disable:4324) 61 #pragma warning(disable : 4324)
62 #endif 62 #endif
63 struct MOJO_ALIGNAS(1) StructAlignas1 { char x; }; 63 struct MOJO_ALIGNAS(1) StructAlignas1 {
64 struct MOJO_ALIGNAS(4) StructAlignas4 { char x; }; 64 char x;
65 struct MOJO_ALIGNAS(8) StructAlignas8 { char x; }; 65 };
66 struct MOJO_ALIGNAS(4) StructAlignas4 {
67 char x;
68 };
69 struct MOJO_ALIGNAS(8) StructAlignas8 {
70 char x;
71 };
66 #if defined(_MSC_VER) 72 #if defined(_MSC_VER)
67 #pragma warning(pop) 73 #pragma warning(pop)
68 #endif 74 #endif
69 75
70 TEST(MacrosTest, Alignas) { 76 TEST(MacrosTest, Alignas) {
71 EXPECT_EQ(1u, MOJO_ALIGNOF(StructAlignas1)); 77 EXPECT_EQ(1u, MOJO_ALIGNOF(StructAlignas1));
72 EXPECT_EQ(4u, MOJO_ALIGNOF(StructAlignas4)); 78 EXPECT_EQ(4u, MOJO_ALIGNOF(StructAlignas4));
73 EXPECT_EQ(8u, MOJO_ALIGNOF(StructAlignas8)); 79 EXPECT_EQ(8u, MOJO_ALIGNOF(StructAlignas8));
74 } 80 }
75 81
76 } // namespace 82 } // namespace
77 } // namespace mojo 83 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/c/system/tests/core_unittest_pure_c.c ('k') | mojo/public/c/system/types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698