summaryrefslogtreecommitdiffstats
path: root/libcxx/test
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test')
-rw-r--r--libcxx/test/libcxx/iterators/trivial_iterators.pass.cpp4
-rw-r--r--libcxx/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_urng.pass.cpp2
-rw-r--r--libcxx/test/std/experimental/algorithms/alg.random.sample/sample.fail.cpp3
-rw-r--r--libcxx/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp18
4 files changed, 15 insertions, 12 deletions
diff --git a/libcxx/test/libcxx/iterators/trivial_iterators.pass.cpp b/libcxx/test/libcxx/iterators/trivial_iterators.pass.cpp
index 33c83025176..c4b3aae92ff 100644
--- a/libcxx/test/libcxx/iterators/trivial_iterators.pass.cpp
+++ b/libcxx/test/libcxx/iterators/trivial_iterators.pass.cpp
@@ -42,7 +42,7 @@ class my_input_iterator
{
It it_;
- template <class U> friend class input_iterator;
+ template <class U> friend class my_input_iterator;
public:
typedef my_input_iterator_tag iterator_category;
typedef typename std::iterator_traits<It>::value_type value_type;
@@ -55,7 +55,7 @@ public:
my_input_iterator() : it_() {}
explicit my_input_iterator(It it) : it_(it) {}
template <class U>
- my_input_iterator(const input_iterator<U>& u) :it_(u.it_) {}
+ my_input_iterator(const my_input_iterator<U>& u) :it_(u.it_) {}
reference operator*() const {return *it_;}
pointer operator->() const {return it_;}
diff --git a/libcxx/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_urng.pass.cpp b/libcxx/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_urng.pass.cpp
index 0c35ed73ee4..512acc392de 100644
--- a/libcxx/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_urng.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_urng.pass.cpp
@@ -29,7 +29,7 @@ int main()
std::shuffle(ia, ia+sa, g);
LIBCPP_ASSERT(std::equal(ia, ia+sa, ia1));
assert(std::is_permutation(ia, ia+sa, ia1));
- std::shuffle(ia, ia+sa, g);
+ std::shuffle(ia, ia+sa, std::move(g));
LIBCPP_ASSERT(std::equal(ia, ia+sa, ia2));
assert(std::is_permutation(ia, ia+sa, ia2));
}
diff --git a/libcxx/test/std/experimental/algorithms/alg.random.sample/sample.fail.cpp b/libcxx/test/std/experimental/algorithms/alg.random.sample/sample.fail.cpp
index eeb43737932..b27135ac7c0 100644
--- a/libcxx/test/std/experimental/algorithms/alg.random.sample/sample.fail.cpp
+++ b/libcxx/test/std/experimental/algorithms/alg.random.sample/sample.fail.cpp
@@ -32,5 +32,8 @@ template <class PopulationIterator, class SampleIterator> void test() {
}
int main() {
+ // expected-error@experimental/algorithm:* {{static_assert failed "SampleIterator must meet the requirements of RandomAccessIterator"}}
+ // expected-error@experimental/algorithm:* 2 {{does not provide a subscript operator}}
+ // expected-error@experimental/algorithm:* {{invalid operands}}
test<input_iterator<int *>, output_iterator<int *> >();
}
diff --git a/libcxx/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp b/libcxx/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp
index 1a9f9b099b2..531731791c5 100644
--- a/libcxx/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp
+++ b/libcxx/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp
@@ -46,8 +46,8 @@ template <>
struct TestExpectations<std::input_iterator_tag>
: public ReservoirSampleExpectations {};
-template <template<class> class PopulationIteratorType, class PopulationItem,
- template<class> class SampleIteratorType, class SampleItem>
+template <template<class...> class PopulationIteratorType, class PopulationItem,
+ template<class...> class SampleIteratorType, class SampleItem>
void test() {
typedef PopulationIteratorType<PopulationItem *> PopulationIterator;
typedef SampleIteratorType<SampleItem *> SampleIterator;
@@ -68,13 +68,13 @@ void test() {
assert(std::equal(oa, oa + os, oa1));
end = std::experimental::sample(PopulationIterator(ia),
PopulationIterator(ia + is),
- SampleIterator(oa), os, g);
+ SampleIterator(oa), os, std::move(g));
assert(end.base() - oa == std::min(os, is));
assert(std::equal(oa, oa + os, oa2));
}
-template <template<class> class PopulationIteratorType, class PopulationItem,
- template<class> class SampleIteratorType, class SampleItem>
+template <template<class...> class PopulationIteratorType, class PopulationItem,
+ template<class...> class SampleIteratorType, class SampleItem>
void test_empty_population() {
typedef PopulationIteratorType<PopulationItem *> PopulationIterator;
typedef SampleIteratorType<SampleItem *> SampleIterator;
@@ -88,8 +88,8 @@ void test_empty_population() {
assert(end.base() == oa);
}
-template <template<class> class PopulationIteratorType, class PopulationItem,
- template<class> class SampleIteratorType, class SampleItem>
+template <template<class...> class PopulationIteratorType, class PopulationItem,
+ template<class...> class SampleIteratorType, class SampleItem>
void test_empty_sample() {
typedef PopulationIteratorType<PopulationItem *> PopulationIterator;
typedef SampleIteratorType<SampleItem *> SampleIterator;
@@ -103,8 +103,8 @@ void test_empty_sample() {
assert(end.base() == oa);
}
-template <template<class> class PopulationIteratorType, class PopulationItem,
- template<class> class SampleIteratorType, class SampleItem>
+template <template<class...> class PopulationIteratorType, class PopulationItem,
+ template<class...> class SampleIteratorType, class SampleItem>
void test_small_population() {
// The population size is less than the sample size.
typedef PopulationIteratorType<PopulationItem *> PopulationIterator;
OpenPOWER on IntegriCloud