brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · a81e11c Raw
52 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// <ios>10 11// template <class charT, class traits> class basic_ios12 13// explicit basic_ios(basic_streambuf<charT,traits>* sb);14 15#include <ios>16#include <streambuf>17#include <cassert>18 19#include "test_macros.h"20 21int main(int, char**)22{23    {24        std::streambuf* sb = 0;25        std::basic_ios<char> ios(sb);26        assert(ios.rdbuf() == sb);27        assert(ios.tie() == 0);28        assert(ios.rdstate() == std::ios::badbit);29        assert(ios.exceptions() == std::ios::goodbit);30        assert(ios.flags() == (std::ios::skipws | std::ios::dec));31        assert(ios.width() == 0);32        assert(ios.precision() == 6);33        assert(ios.fill() == ' ');34        assert(ios.getloc() == std::locale());35    }36    {37        std::streambuf* sb = (std::streambuf*)1;38        std::basic_ios<char> ios(sb);39        assert(ios.rdbuf() == sb);40        assert(ios.tie() == 0);41        assert(ios.rdstate() == std::ios::goodbit);42        assert(ios.exceptions() == std::ios::goodbit);43        assert(ios.flags() == (std::ios::skipws | std::ios::dec));44        assert(ios.width() == 0);45        assert(ios.precision() == 6);46        assert(ios.fill() == ' ');47        assert(ios.getloc() == std::locale());48    }49 50  return 0;51}52