Fix the test for partition_copy so it is not ridiculously slow. Also, detab.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346104 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -222,11 +222,24 @@ int partition_copy(const uint8_t *data, size_t size)
|
||||
if (!std::none_of(v2.begin(), v2.end(), is_even<uint8_t>())) return 3;
|
||||
|
||||
// Every value in both vectors has to be in the original
|
||||
for (auto v: v1)
|
||||
if (std::find(data, data + size, v) == data + size) return 4;
|
||||
|
||||
for (auto v: v2)
|
||||
if (std::find(data, data + size, v) == data + size) return 5;
|
||||
// Make a copy of the input, and sort it
|
||||
Vec v0{data, data + size};
|
||||
std::sort(v0.begin(), v0.end());
|
||||
|
||||
// Sort each vector and ensure that all of the elements appear in the original input
|
||||
std::sort(v1.begin(), v1.end());
|
||||
if (!std::includes(v0.begin(), v0.end(), v1.begin(), v1.end())) return 4;
|
||||
|
||||
std::sort(v2.begin(), v2.end());
|
||||
if (!std::includes(v0.begin(), v0.end(), v2.begin(), v2.end())) return 5;
|
||||
|
||||
// This, while simple, is really slow - 20 seconds on a 500K element input.
|
||||
// for (auto v: v1)
|
||||
// if (std::find(data, data + size, v) == data + size) return 4;
|
||||
//
|
||||
// for (auto v: v2)
|
||||
// if (std::find(data, data + size, v) == data + size) return 5;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user