Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)
[llvm-project.git] / libcxx / test / std / time / time.zone / time.zone.zonedtime / copy.assign.pass.cpp
blob292d16186a5098c5f5f537aa361f8aa8b416e4ef
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14, c++17
10 // UNSUPPORTED: no-filesystem, no-localization, no-tzdb
12 // XFAIL: libcpp-has-no-experimental-tzdb
13 // XFAIL: availability-tzdb-missing
15 // <chrono>
17 // template<class Duration, class TimeZonePtr = const time_zone*>
18 // class zoned_time;
20 // zoned_time& operator=(const zoned_time&) = default;
22 #include <cassert>
23 #include <chrono>
24 #include <concepts>
26 int main(int, char**) {
27 std::chrono::zoned_time<std::chrono::seconds> zt{std::chrono::sys_seconds{std::chrono::seconds{42}}};
28 assert(zt.get_time_zone() == std::chrono::locate_zone("UTC"));
29 assert(zt.get_sys_time() == std::chrono::sys_seconds{std::chrono::seconds{42}});
31 std::chrono::zoned_time<std::chrono::seconds> copy;
32 copy = zt;
33 std::same_as<std::chrono::zoned_time<std::chrono::seconds>&> decltype(auto) result = (copy = zt);
34 assert(&result == &copy);
35 assert(copy.get_time_zone() == std::chrono::locate_zone("UTC"));
36 assert(copy.get_sys_time() == std::chrono::sys_seconds{std::chrono::seconds{42}});
38 return 0;