test_walltime.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2018 The urg_stamped Authors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <gtest/gtest.h>
18 
19 #include <scip2/walltime.h>
20 
21 TEST(WalltimeTest, testTimestampOverflow)
22 {
23  for (uint64_t start_device_time = 0;
24  start_device_time < (1 << 24);
25  start_device_time += (1 << 23))
26  {
27  scip2::Walltime<24> walltime;
28 
29  for (uint64_t device_time = start_device_time;
30  device_time < (1 << 25);
31  device_time += 25)
32  {
33  const uint32_t device_timestamp = device_time & 0xFFFFFF;
34  ASSERT_EQ(walltime.update(device_timestamp), device_time);
35  }
36  }
37 }
38 
39 int main(int argc, char **argv)
40 {
41  testing::InitGoogleTest(&argc, argv);
42 
43  return RUN_ALL_TESTS();
44 }
uint64_t update(const uint32_t &time_device)
Definition: walltime.h:33
int main(int argc, char **argv)
TEST(WalltimeTest, testTimestampOverflow)


urg_stamped
Author(s): Atsushi Watanabe
autogenerated on Thu Jun 6 2019 19:55:59