test_walltime.cpp
Go to the documentation of this file.
00001 /*
00002  * Copyright 2018 The urg_stamped Authors
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #include <gtest/gtest.h>
00018 
00019 #include <scip2/walltime.h>
00020 
00021 TEST(WalltimeTest, testTimestampOverflow)
00022 {
00023   for (uint64_t start_device_time = 0;
00024        start_device_time < (1 << 24);
00025        start_device_time += (1 << 23))
00026   {
00027     scip2::Walltime<24> walltime;
00028 
00029     for (uint64_t device_time = start_device_time;
00030          device_time < (1 << 25);
00031          device_time += 25)
00032     {
00033       const uint32_t device_timestamp = device_time & 0xFFFFFF;
00034       ASSERT_EQ(walltime.update(device_timestamp), device_time);
00035     }
00036   }
00037 }
00038 
00039 int main(int argc, char **argv)
00040 {
00041   testing::InitGoogleTest(&argc, argv);
00042 
00043   return RUN_ALL_TESTS();
00044 }


urg_stamped
Author(s): Atsushi Watanabe
autogenerated on Thu Jun 6 2019 18:59:51