diff options
Diffstat (limited to 'unittests/Support')
-rw-r--r-- | unittests/Support/CMakeLists.txt | 3 | ||||
-rw-r--r-- | unittests/Support/formatted_raw_ostream_test.cpp | 33 |
2 files changed, 35 insertions, 1 deletions
diff --git a/unittests/Support/CMakeLists.txt b/unittests/Support/CMakeLists.txt index 3b9bf84..06c5343 100644 --- a/unittests/Support/CMakeLists.txt +++ b/unittests/Support/CMakeLists.txt @@ -18,10 +18,11 @@ add_llvm_unittest(SupportTests ManagedStatic.cpp MathExtrasTest.cpp Path.cpp - raw_ostream_test.cpp RegexTest.cpp SwapByteOrderTest.cpp TimeValue.cpp ValueHandleTest.cpp YAMLParserTest.cpp + formatted_raw_ostream.cpp + raw_ostream_test.cpp ) diff --git a/unittests/Support/formatted_raw_ostream_test.cpp b/unittests/Support/formatted_raw_ostream_test.cpp new file mode 100644 index 0000000..4725ced --- /dev/null +++ b/unittests/Support/formatted_raw_ostream_test.cpp @@ -0,0 +1,33 @@ +//===- llvm/unittest/Support/formatted_raw_ostream_test.cpp ---------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "gtest/gtest.h" +#include "llvm/ADT/SmallString.h" +#include "llvm/Support/raw_ostream.h" +#include "llvm/Support/FormattedStream.h" + +using namespace llvm; + +namespace { + +TEST(formatted_raw_ostreamTest, Test_Tell) { + // Check offset when underlying stream has buffer contents. + SmallString<128> A; + raw_svector_ostream B(A); + formatted_raw_ostream C(B); + char tmp[100] = ""; + + for (unsigned i = 0; i != 3; ++i) { + C.write(tmp, 100); + + EXPECT_EQ(100*(i+1), (unsigned) C.tell()); + } +} + +} |