Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Differential D49774 Diff 157349 test/std/experimental/filesystem/fs.filesystem.synopsis/file_time_type.pass.cpp
Changeset View
Changeset View
Standalone View
Standalone View
test/std/experimental/filesystem/fs.filesystem.synopsis/file_time_type.pass.cpp
Show All 11 Lines | |||||
// <experimental/filesystem> | // <experimental/filesystem> | ||||
// typedef TrivialClock file_time_type; | // typedef TrivialClock file_time_type; | ||||
#include "filesystem_include.hpp" | #include "filesystem_include.hpp" | ||||
#include <chrono> | #include <chrono> | ||||
#include <type_traits> | #include <type_traits> | ||||
#include "test_macros.h" | |||||
// system_clock is used because it meets the requirements of TrivialClock, | // system_clock is used because it meets the requirements of TrivialClock, | ||||
// and the resolution and range of system_clock should match the operating | // and the resolution and range of system_clock should match the operating | ||||
// system's file time type. | // system's file time type. | ||||
typedef std::chrono::system_clock ExpectedClock; | |||||
typedef std::chrono::time_point<ExpectedClock> ExpectedTimePoint; | void test_trivial_clock() { | ||||
using namespace fs; | |||||
using Clock = file_time_type::clock; | |||||
ASSERT_NOEXCEPT(Clock::now()); | |||||
ASSERT_SAME_TYPE(decltype(Clock::now()), file_time_type); | |||||
ASSERT_SAME_TYPE(Clock::time_point, file_time_type); | |||||
volatile auto* odr_use = &Clock::is_steady; | |||||
((void)odr_use); | |||||
} | |||||
void test_time_point_resolution_and_range() { | |||||
using namespace fs; | |||||
using Dur = file_time_type::duration; | |||||
using Period = Dur::period; | |||||
ASSERT_SAME_TYPE(Period, std::nano); | |||||
} | |||||
int main() { | int main() { | ||||
static_assert(std::is_same< | test_trivial_clock(); | ||||
fs::file_time_type, | test_time_point_resolution_and_range(); | ||||
ExpectedTimePoint | |||||
>::value, ""); | |||||
} | } |