From fb911942f1434f3d1750f83f25f5e42c80e60638 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Tue, 24 Mar 2015 21:31:36 +0000 Subject: Vendor import of lld trunk r233088: https://llvm.org/svn/llvm-project/lld/trunk@233088 --- unittests/CoreTests/ParallelTest.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 unittests/CoreTests/ParallelTest.cpp (limited to 'unittests/CoreTests/ParallelTest.cpp') diff --git a/unittests/CoreTests/ParallelTest.cpp b/unittests/CoreTests/ParallelTest.cpp new file mode 100644 index 0000000000000..c0282437e2e1d --- /dev/null +++ b/unittests/CoreTests/ParallelTest.cpp @@ -0,0 +1,31 @@ +//===- lld/unittest/ParallelTest.cpp --------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +/// +/// \file +/// \brief Parallel.h unit tests. +/// +//===----------------------------------------------------------------------===// + +#include "gtest/gtest.h" +#include "lld/Core/Parallel.h" +#include +#include + +uint32_t array[1024 * 1024]; + +TEST(Parallel, sort) { + std::mt19937 randEngine; + std::uniform_int_distribution dist; + + for (auto &i : array) + i = dist(randEngine); + + lld::parallel_sort(std::begin(array), std::end(array)); + ASSERT_TRUE(std::is_sorted(std::begin(array), std::end(array))); +} -- cgit v1.2.3