blob: ffa2b23fd3b78f85e31c9c0b1bfad634e87b1829 [file] [log] [blame]
Michael J. Spencer1eb3b892013-04-12 18:40:39 +00001//===- lld/unittest/ParallelTest.cpp --------------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9///
10/// \file
11/// \brief Parallel.h unit tests.
12///
13//===----------------------------------------------------------------------===//
14
15#include "gtest/gtest.h"
16
17#include "lld/Core/Parallel.h"
18
19#include <array>
20#include <random>
21
22uint32_t array[1024 * 1024];
23
24TEST(Parallel, sort) {
25 std::mt19937 randEngine;
26 std::uniform_int_distribution<uint32_t> dist;
27
28 for (auto &i : array)
29 i = dist(randEngine);
30
31 lld::parallel_sort(std::begin(array), std::end(array));
32 ASSERT_TRUE(std::is_sorted(std::begin(array), std::end(array)));
33}