OLD | NEW |
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 |
11 #include <mojo/macros.h> | 11 #include <mojo/macros.h> |
12 | 12 |
13 #include <assert.h> | 13 #include <assert.h> |
14 #include <stdint.h> | 14 #include <stdint.h> |
15 #include <stdlib.h> | 15 #include <stdlib.h> |
16 | 16 |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "gtest/gtest.h" |
18 | 18 |
19 namespace mojo { | 19 namespace mojo { |
20 namespace { | 20 namespace { |
21 | 21 |
22 TEST(MacrosTest, AllowUnused) { | 22 TEST(MacrosTest, AllowUnused) { |
23 // Test that no warning/error is issued even though |x| is unused. | 23 // Test that no warning/error is issued even though |x| is unused. |
24 int x = 123; | 24 int x = 123; |
25 MOJO_ALLOW_UNUSED_LOCAL(x); | 25 MOJO_ALLOW_UNUSED_LOCAL(x); |
26 } | 26 } |
27 | 27 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 #endif | 75 #endif |
76 | 76 |
77 TEST(MacrosTest, Alignas) { | 77 TEST(MacrosTest, Alignas) { |
78 EXPECT_EQ(1u, MOJO_ALIGNOF(StructAlignas1)); | 78 EXPECT_EQ(1u, MOJO_ALIGNOF(StructAlignas1)); |
79 EXPECT_EQ(4u, MOJO_ALIGNOF(StructAlignas4)); | 79 EXPECT_EQ(4u, MOJO_ALIGNOF(StructAlignas4)); |
80 EXPECT_EQ(8u, MOJO_ALIGNOF(StructAlignas8)); | 80 EXPECT_EQ(8u, MOJO_ALIGNOF(StructAlignas8)); |
81 } | 81 } |
82 | 82 |
83 } // namespace | 83 } // namespace |
84 } // namespace mojo | 84 } // namespace mojo |
OLD | NEW |