diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-05-16 19:47:58 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-05-16 19:47:58 +0000 | 
| commit | b76161e41bc2c07cd47f9c61f875d1be95e26d10 (patch) | |
| tree | d03c19ce10dec6419f97df1d4dac9d47eb88982f /unittests/Core | |
| parent | 8b4000f13b303cc154136abc74c55670673e2a96 (diff) | |
Notes
Diffstat (limited to 'unittests/Core')
| -rw-r--r-- | unittests/Core/ScalarTest.cpp | 6 | ||||
| -rw-r--r-- | unittests/Core/TimerTest.cpp | 17 | 
2 files changed, 15 insertions, 8 deletions
diff --git a/unittests/Core/ScalarTest.cpp b/unittests/Core/ScalarTest.cpp index 3c4995c49086..692aa8aaf119 100644 --- a/unittests/Core/ScalarTest.cpp +++ b/unittests/Core/ScalarTest.cpp @@ -12,7 +12,7 @@  #include "lldb/Core/Scalar.h"  #include "lldb/Utility/DataExtractor.h"  #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h"  #include "lldb/Utility/StreamString.h"  using namespace lldb_private; @@ -44,11 +44,11 @@ TEST(ScalarTest, GetBytes) {    Scalar f_scalar;    DataExtractor e_data(e, sizeof(e), endian::InlHostByteOrder(),                         sizeof(void *)); -  Error e_error = +  Status e_error =        e_scalar.SetValueFromData(e_data, lldb::eEncodingUint, sizeof(e));    DataExtractor f_data(f, sizeof(f), endian::InlHostByteOrder(),                         sizeof(void *)); -  Error f_error = +  Status f_error =        f_scalar.SetValueFromData(f_data, lldb::eEncodingUint, sizeof(f));    ASSERT_EQ(0, memcmp(&a, a_scalar.GetBytes(), sizeof(a)));    ASSERT_EQ(0, memcmp(&b, b_scalar.GetBytes(), sizeof(b))); diff --git a/unittests/Core/TimerTest.cpp b/unittests/Core/TimerTest.cpp index 7e7eeef0a361..a35df0d49c8e 100644 --- a/unittests/Core/TimerTest.cpp +++ b/unittests/Core/TimerTest.cpp @@ -18,7 +18,8 @@ using namespace lldb_private;  TEST(TimerTest, CategoryTimes) {    Timer::ResetCategoryTimes();    { -    Timer t("CAT1", ""); +    static Timer::Category tcat("CAT1"); +    Timer t(tcat, "");      std::this_thread::sleep_for(std::chrono::milliseconds(10));    }    StreamString ss; @@ -32,14 +33,18 @@ TEST(TimerTest, CategoryTimes) {  TEST(TimerTest, CategoryTimesNested) {    Timer::ResetCategoryTimes();    { -    Timer t1("CAT1", ""); +    static Timer::Category tcat1("CAT1"); +    Timer t1(tcat1, "");      std::this_thread::sleep_for(std::chrono::milliseconds(10)); -    Timer t2("CAT1", ""); +    // 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); @@ -48,9 +53,11 @@ TEST(TimerTest, CategoryTimesNested) {  TEST(TimerTest, CategoryTimes2) {    Timer::ResetCategoryTimes();    { -    Timer t1("CAT1", ""); +    static Timer::Category tcat1("CAT1"); +    Timer t1(tcat1, "");      std::this_thread::sleep_for(std::chrono::milliseconds(100)); -    Timer t2("CAT2", ""); +    static Timer::Category tcat2("CAT2"); +    Timer t2(tcat2, "");      std::this_thread::sleep_for(std::chrono::milliseconds(10));    }    StreamString ss;  | 
