[InstCombine] Signed saturation patterns
[llvm-complete.git] / unittests / Support / formatted_raw_ostream_test.cpp
blob0fe0869922a147ad4be8e195fa406b830bb9b597
1 //===- llvm/unittest/Support/formatted_raw_ostream_test.cpp ---------------===//
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 #include "llvm/ADT/SmallString.h"
10 #include "llvm/Support/FormattedStream.h"
11 #include "llvm/Support/raw_ostream.h"
12 #include "gtest/gtest.h"
14 using namespace llvm;
16 namespace {
18 TEST(formatted_raw_ostreamTest, Test_Tell) {
19 // Check offset when underlying stream has buffer contents.
20 SmallString<128> A;
21 raw_svector_ostream B(A);
22 formatted_raw_ostream C(B);
23 char tmp[100] = "";
25 for (unsigned i = 0; i != 3; ++i) {
26 C.write(tmp, 100);
28 EXPECT_EQ(100*(i+1), (unsigned) C.tell());