forked from youtube/cobalt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configuration_test.cc
62 lines (49 loc) · 1.73 KB
/
configuration_test.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright 2016 The Cobalt Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Some kind of dumb tests that make sure that some of the utility macros in
// configuration.h work for the current toolchain.
#include "starboard/configuration.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace starboard {
namespace nplb {
namespace {
SB_COMPILE_ASSERT(sizeof(int32_t) < sizeof(int64_t), int32_less_than_int64);
void TheUnreferencer(int unreferenced) {}
struct PossiblyFunnySize {
int32_t a;
int8_t b;
int32_t c;
int8_t d;
};
TEST(SbArraySizeTest, SunnyDay) {
const size_t kArraySize = 27;
char test[kArraySize];
EXPECT_EQ(kArraySize, SB_ARRAY_SIZE(test));
int64_t test2[kArraySize];
EXPECT_EQ(kArraySize, SB_ARRAY_SIZE(test2));
PossiblyFunnySize test3[kArraySize];
EXPECT_EQ(kArraySize, SB_ARRAY_SIZE(test3));
}
TEST(SbArraySizeIntTest, SunnyDay) {
const int kArraySize = 27;
char test[kArraySize];
EXPECT_EQ(kArraySize, SB_ARRAY_SIZE_INT(test));
int64_t test2[kArraySize];
EXPECT_EQ(kArraySize, SB_ARRAY_SIZE_INT(test2));
PossiblyFunnySize test3[kArraySize];
EXPECT_EQ(kArraySize, SB_ARRAY_SIZE_INT(test3));
}
} // namespace
} // namespace nplb
} // namespace starboard