OLD | NEW |
| (Empty) |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "gtest/gtest.h" | |
6 #include "mojo/public/interfaces/bindings/tests/test_constants.mojom.h" | |
7 | |
8 namespace mojo { | |
9 namespace test { | |
10 | |
11 TEST(ConstantTest, GlobalConstants) { | |
12 // Compile-time constants. | |
13 static_assert(kBoolValue == true, ""); | |
14 static_assert(kInt8Value == -2, ""); | |
15 static_assert(kUint8Value == 128U, ""); | |
16 static_assert(kInt16Value == -233, ""); | |
17 static_assert(kUint16Value == 44204U, ""); | |
18 static_assert(kInt32Value == -44204, ""); | |
19 static_assert(kUint32Value == 4294967295U, ""); | |
20 static_assert(kInt64Value == -9223372036854775807, ""); | |
21 static_assert(kUint64Value == 9999999999999999999ULL, ""); | |
22 | |
23 EXPECT_DOUBLE_EQ(kDoubleValue, 3.14159); | |
24 EXPECT_FLOAT_EQ(kFloatValue, 2.71828f); | |
25 } | |
26 | |
27 TEST(ConstantTest, StructConstants) { | |
28 // Compile-time constants. | |
29 static_assert(StructWithConstants::kInt8Value == 5U, ""); | |
30 | |
31 EXPECT_FLOAT_EQ(StructWithConstants::kFloatValue, 765.432f); | |
32 } | |
33 | |
34 TEST(ConstantTest, InterfaceConstants) { | |
35 // Compile-time constants. | |
36 static_assert(InterfaceWithConstants::kUint32Value == 20100722, ""); | |
37 | |
38 EXPECT_DOUBLE_EQ(InterfaceWithConstants::kDoubleValue, 12.34567); | |
39 } | |
40 | |
41 } // namespace test | |
42 } // namespace mojo | |
OLD | NEW |