[PATCH] D27495: [XRay][compiler-rt] Use explicit comparisons in unit tests.
Dean Michael Berris via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 12 16:28:02 PST 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL289501: [XRay][compiler-rt] Use explicit comparisons in unit tests. (authored by dberris).
Changed prior to commit:
https://reviews.llvm.org/D27495?vs=80515&id=81161#toc
Repository:
rL LLVM
https://reviews.llvm.org/D27495
Files:
compiler-rt/trunk/lib/xray/tests/unit/buffer_queue_test.cc
Index: compiler-rt/trunk/lib/xray/tests/unit/buffer_queue_test.cc
===================================================================
--- compiler-rt/trunk/lib/xray/tests/unit/buffer_queue_test.cc
+++ compiler-rt/trunk/lib/xray/tests/unit/buffer_queue_test.cc
@@ -14,6 +14,7 @@
#include "gtest/gtest.h"
#include <future>
+#include <system_error>
#include <unistd.h>
namespace __xray {
@@ -25,19 +26,19 @@
TEST(BufferQueueTest, GetAndRelease) {
BufferQueue Buffers(kSize, 1);
BufferQueue::Buffer Buf;
- ASSERT_FALSE(Buffers.getBuffer(Buf));
+ ASSERT_EQ(Buffers.getBuffer(Buf), std::error_code());
ASSERT_NE(nullptr, Buf.Buffer);
- ASSERT_FALSE(Buffers.releaseBuffer(Buf));
+ ASSERT_EQ(Buffers.releaseBuffer(Buf), std::error_code());
ASSERT_EQ(nullptr, Buf.Buffer);
}
TEST(BufferQueueTest, GetUntilFailed) {
BufferQueue Buffers(kSize, 1);
BufferQueue::Buffer Buf0;
- EXPECT_FALSE(Buffers.getBuffer(Buf0));
+ EXPECT_EQ(Buffers.getBuffer(Buf0), std::error_code());
BufferQueue::Buffer Buf1;
EXPECT_EQ(std::errc::not_enough_memory, Buffers.getBuffer(Buf1));
- EXPECT_FALSE(Buffers.releaseBuffer(Buf0));
+ EXPECT_EQ(Buffers.releaseBuffer(Buf0), std::error_code());
}
TEST(BufferQueueTest, ReleaseUnknown) {
@@ -51,13 +52,13 @@
TEST(BufferQueueTest, ErrorsWhenFinalising) {
BufferQueue Buffers(kSize, 2);
BufferQueue::Buffer Buf;
- ASSERT_FALSE(Buffers.getBuffer(Buf));
+ ASSERT_EQ(Buffers.getBuffer(Buf), std::error_code());
ASSERT_NE(nullptr, Buf.Buffer);
- ASSERT_FALSE(Buffers.finalize());
+ ASSERT_EQ(Buffers.finalize(), std::error_code());
BufferQueue::Buffer OtherBuf;
ASSERT_EQ(std::errc::state_not_recoverable, Buffers.getBuffer(OtherBuf));
ASSERT_EQ(std::errc::state_not_recoverable, Buffers.finalize());
- ASSERT_FALSE(Buffers.releaseBuffer(Buf));
+ ASSERT_EQ(Buffers.releaseBuffer(Buf), std::error_code());
}
TEST(BufferQueueTest, MultiThreaded) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27495.81161.patch
Type: text/x-patch
Size: 1931 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161213/3f6ff3d8/attachment.bin>
More information about the llvm-commits
mailing list