diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-03-24 21:31:36 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-03-24 21:31:36 +0000 |
commit | fb911942f1434f3d1750f83f25f5e42c80e60638 (patch) | |
tree | 1678c4a4f0182e4029a86d135aa4a1b7d09e3c41 /unittests/CoreTests/ParallelTest.cpp |
Notes
Diffstat (limited to 'unittests/CoreTests/ParallelTest.cpp')
-rw-r--r-- | unittests/CoreTests/ParallelTest.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/unittests/CoreTests/ParallelTest.cpp b/unittests/CoreTests/ParallelTest.cpp new file mode 100644 index 000000000000..c0282437e2e1 --- /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 <array> +#include <random> + +uint32_t array[1024 * 1024]; + +TEST(Parallel, sort) { + std::mt19937 randEngine; + std::uniform_int_distribution<uint32_t> 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))); +} |