aboutsummaryrefslogtreecommitdiffstats
path: root/unittests
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-01 18:38:21 +0000
committerChris Lattner <sabre@nondot.org>2009-08-01 18:38:21 +0000
commitfbad2cc949c42d0ca9bb7e63b15d7a587058c6a5 (patch)
tree60612d8c363d8ec5a7545f34a87c2fd4d539a906 /unittests
parent27a32604cc38db2e6903b8a23516cd0bdb5096e5 (diff)
downloadexternal_llvm-fbad2cc949c42d0ca9bb7e63b15d7a587058c6a5.zip
external_llvm-fbad2cc949c42d0ca9bb7e63b15d7a587058c6a5.tar.gz
external_llvm-fbad2cc949c42d0ca9bb7e63b15d7a587058c6a5.tar.bz2
daniel says it's fine to nuke this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77789 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/MC/AsmStreamerTest.cpp101
1 files changed, 0 insertions, 101 deletions
diff --git a/unittests/MC/AsmStreamerTest.cpp b/unittests/MC/AsmStreamerTest.cpp
deleted file mode 100644
index 815c9b0..0000000
--- a/unittests/MC/AsmStreamerTest.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-//===- AsmStreamerTest.cpp - Triple unit tests ----------------------------===//
-//
-// 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/MC/MCContext.h"
-#include "llvm/MC/MCSection.h"
-#include "llvm/MC/MCStreamer.h"
-#include "llvm/MC/MCValue.h"
-#include "llvm/Support/raw_ostream.h"
-using namespace llvm;
-
-namespace {
-
-// Helper class.
-class StringAsmStreamer {
- std::string Str;
- raw_string_ostream OS;
- MCContext Context;
- MCStreamer *Streamer;
-
-public:
- StringAsmStreamer() : OS(Str), Streamer(createAsmStreamer(Context, OS)) {}
- ~StringAsmStreamer() {
- delete Streamer;
- }
-
- MCContext &getContext() { return Context; }
- MCStreamer &getStreamer() { return *Streamer; }
-
- const std::string &getString() {
- Streamer->Finish();
- return Str;
- }
-};
-
-TEST(AsmStreamer, EmptyOutput) {
- StringAsmStreamer S;
- EXPECT_EQ("", S.getString());
-}
-
-TEST(AsmStreamer, Sections) {
- StringAsmStreamer S;
- MCSection *Sec0 = MCSection::Create("foo", SectionKind(), S.getContext());
- S.getStreamer().SwitchSection(Sec0);
- EXPECT_EQ(".section foo\n", S.getString());
-}
-
-TEST(AsmStreamer, Values) {
- StringAsmStreamer S;
- MCSection *Sec0 = MCSection::Create("foo", SectionKind(), S.getContext());
- MCSymbol *A = S.getContext().CreateSymbol("a");
- MCSymbol *B = S.getContext().CreateSymbol("b");
- S.getStreamer().SwitchSection(Sec0);
- S.getStreamer().EmitLabel(A);
- S.getStreamer().EmitLabel(B);
- S.getStreamer().EmitValue(MCValue::get(A, B, 10), 1);
- S.getStreamer().EmitValue(MCValue::get(A, B, 10), 2);
- S.getStreamer().EmitValue(MCValue::get(A, B, 10), 4);
- S.getStreamer().EmitValue(MCValue::get(A, B, 10), 8);
- EXPECT_EQ(".section foo\n\
-a:\n\
-b:\n\
-.byte a - b + 10\n\
-.short a - b + 10\n\
-.long a - b + 10\n\
-.quad a - b + 10\n", S.getString());
-}
-
-TEST(AsmStreamer, Align) {
- StringAsmStreamer S;
- MCSection *Sec0 = MCSection::Create("foo", SectionKind(), S.getContext());
- S.getStreamer().SwitchSection(Sec0);
- S.getStreamer().EmitValueToAlignment(4);
- S.getStreamer().EmitValueToAlignment(4, /*Value=*/12, /*ValueSize=*/2);
- S.getStreamer().EmitValueToAlignment(8, /*Value=*/12, /*ValueSize=*/4,
- /*MaxBytesToEmit=*/24);
- EXPECT_EQ(".section foo\n\
-.p2align 2, 0\n\
-.p2alignw 2, 12\n\
-.p2alignl 3, 12, 24\n", S.getString());
-}
-
-TEST(AsmStreamer, Org) {
- StringAsmStreamer S;
- MCSection *Sec0 = MCSection::Create("foo", SectionKind(), S.getContext());
- S.getStreamer().SwitchSection(Sec0);
- MCSymbol *A = S.getContext().CreateSymbol("a");
- S.getStreamer().EmitLabel(A);
- S.getStreamer().EmitValueToOffset(MCValue::get(A, 0, 4), 32);
- EXPECT_EQ(".section foo\n\
-a:\n\
-.org a + 4, 32\n", S.getString());
-}
-
-}