[analyzer][Z3] Restore the original timeout of 15s (#118291)
[llvm-project.git] / libcxx / test / std / ranges / range.factories / range.istream.view / iterator / deref.pass.cpp
blob1cf05f0ac4cbe74b0eef59f0e68ea4f64351f14b
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: no-localization
10 // UNSUPPORTED: c++03, c++11, c++14, c++17
12 // Val& operator*() const;
14 #include <cassert>
15 #include <ranges>
16 #include <sstream>
18 #include "test_macros.h"
19 #include "../utils.h"
21 template <class CharT>
22 void test() {
23 // operator* should return correct value
25 auto iss = make_string_stream<CharT>("1 2 345 ");
26 std::ranges::basic_istream_view<int, CharT> isv{iss};
27 auto it = isv.begin();
28 std::same_as<int&> decltype(auto) v1 = *it;
29 assert(v1 == 1);
32 // operator* should return the same reference to the value stored in the view
34 auto iss = make_string_stream<CharT>("1 2 345 ");
35 std::ranges::basic_istream_view<int, CharT> isv{iss};
36 using Iter = std::ranges::iterator_t<decltype(isv)>;
38 Iter it1{isv};
39 Iter it2{isv};
40 assert(&*it1 == &*it2);
44 int main(int, char**) {
45 test<char>();
46 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
47 test<wchar_t>();
48 #endif
50 return 0;