summaryrefslogtreecommitdiff
path: root/unittests/Core
diff options
context:
space:
mode:
Diffstat (limited to 'unittests/Core')
-rw-r--r--unittests/Core/CMakeLists.txt2
-rw-r--r--unittests/Core/StructuredDataTest.cpp32
-rw-r--r--unittests/Core/TimerTest.cpp73
3 files changed, 0 insertions, 107 deletions
diff --git a/unittests/Core/CMakeLists.txt b/unittests/Core/CMakeLists.txt
index 73dd0d83fee3..426009661b12 100644
--- a/unittests/Core/CMakeLists.txt
+++ b/unittests/Core/CMakeLists.txt
@@ -6,8 +6,6 @@ add_lldb_unittest(LLDBCoreTests
ScalarTest.cpp
StateTest.cpp
StreamCallbackTest.cpp
- StructuredDataTest.cpp
- TimerTest.cpp
LINK_LIBS
lldbCore
diff --git a/unittests/Core/StructuredDataTest.cpp b/unittests/Core/StructuredDataTest.cpp
deleted file mode 100644
index cdcf3236cd77..000000000000
--- a/unittests/Core/StructuredDataTest.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-//===-- StructuredDataTest.cpp ----------------------------------*- C++ -*-===//
-//
-// 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 "lldb/Core/StructuredData.h"
-#include "lldb/Utility/StreamString.h"
-
-#include "llvm/BinaryFormat/MachO.h"
-
-using namespace lldb;
-using namespace lldb_private;
-
-TEST(StructuredDataTest, StringDump) {
- std::pair<llvm::StringRef, llvm::StringRef> TestCases[] = {
- { R"(asdfg)", R"("asdfg")" },
- { R"(as"df)", R"("as\"df")" },
- { R"(as\df)", R"("as\\df")" },
- };
- for(auto P : TestCases) {
- StreamString S;
- const bool pretty_print = false;
- StructuredData::String(P.first).Dump(S, pretty_print);
- EXPECT_EQ(P.second, S.GetString());
- }
-}
diff --git a/unittests/Core/TimerTest.cpp b/unittests/Core/TimerTest.cpp
deleted file mode 100644
index a35df0d49c8e..000000000000
--- a/unittests/Core/TimerTest.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-//===-- TimerTest.cpp -------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "lldb/Core/Timer.h"
-#include "gtest/gtest.h"
-
-#include "lldb/Utility/StreamString.h"
-#include <thread>
-
-using namespace lldb_private;
-
-TEST(TimerTest, CategoryTimes) {
- Timer::ResetCategoryTimes();
- {
- static Timer::Category tcat("CAT1");
- Timer t(tcat, "");
- std::this_thread::sleep_for(std::chrono::milliseconds(10));
- }
- StreamString ss;
- Timer::DumpCategoryTimes(&ss);
- double seconds;
- ASSERT_EQ(1, sscanf(ss.GetData(), "%lf sec for CAT1", &seconds));
- EXPECT_LT(0.001, seconds);
- EXPECT_GT(0.1, seconds);
-}
-
-TEST(TimerTest, CategoryTimesNested) {
- Timer::ResetCategoryTimes();
- {
- static Timer::Category tcat1("CAT1");
- Timer t1(tcat1, "");
- std::this_thread::sleep_for(std::chrono::milliseconds(10));
- // Explicitly testing the same category as above.
- Timer t2(tcat1, "");
- std::this_thread::sleep_for(std::chrono::milliseconds(10));
- }
- StreamString ss;
- Timer::DumpCategoryTimes(&ss);
- double seconds;
- // It should only appear once.
- ASSERT_EQ(ss.GetString().count("CAT1"), 1U);
- ASSERT_EQ(1, sscanf(ss.GetData(), "%lf sec for CAT1", &seconds));
- EXPECT_LT(0.002, seconds);
- EXPECT_GT(0.2, seconds);
-}
-
-TEST(TimerTest, CategoryTimes2) {
- Timer::ResetCategoryTimes();
- {
- static Timer::Category tcat1("CAT1");
- Timer t1(tcat1, "");
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- static Timer::Category tcat2("CAT2");
- Timer t2(tcat2, "");
- std::this_thread::sleep_for(std::chrono::milliseconds(10));
- }
- StreamString ss;
- Timer::DumpCategoryTimes(&ss);
- double seconds1, seconds2;
- ASSERT_EQ(2, sscanf(ss.GetData(), "%lf sec for CAT1%*[\n ]%lf sec for CAT2",
- &seconds1, &seconds2))
- << "String: " << ss.GetData();
- EXPECT_LT(0.01, seconds1);
- EXPECT_GT(1, seconds1);
- EXPECT_LT(0.001, seconds2);
- EXPECT_GT(0.1, seconds2);
-}