3454 |
09 Dec 15 |
peter |
// $Id$ |
3454 |
09 Dec 15 |
peter |
2 |
|
3454 |
09 Dec 15 |
peter |
3 |
/* |
3454 |
09 Dec 15 |
peter |
Copyright (C) 2015 Peter Johansson |
3454 |
09 Dec 15 |
peter |
5 |
|
3454 |
09 Dec 15 |
peter |
This file is part of the yat library, http://dev.thep.lu.se/yat |
3454 |
09 Dec 15 |
peter |
7 |
|
3454 |
09 Dec 15 |
peter |
The yat library is free software; you can redistribute it and/or |
3454 |
09 Dec 15 |
peter |
modify it under the terms of the GNU General Public License as |
3454 |
09 Dec 15 |
peter |
published by the Free Software Foundation; either version 3 of the |
3454 |
09 Dec 15 |
peter |
License, or (at your option) any later version. |
3454 |
09 Dec 15 |
peter |
12 |
|
3454 |
09 Dec 15 |
peter |
The yat library is distributed in the hope that it will be useful, |
3454 |
09 Dec 15 |
peter |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
3454 |
09 Dec 15 |
peter |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3454 |
09 Dec 15 |
peter |
General Public License for more details. |
3454 |
09 Dec 15 |
peter |
17 |
|
3454 |
09 Dec 15 |
peter |
You should have received a copy of the GNU General Public License |
3454 |
09 Dec 15 |
peter |
along with yat. If not, see <http://www.gnu.org/licenses/>. |
3454 |
09 Dec 15 |
peter |
20 |
*/ |
3454 |
09 Dec 15 |
peter |
21 |
|
3454 |
09 Dec 15 |
peter |
22 |
#include <config.h> |
3454 |
09 Dec 15 |
peter |
23 |
|
3454 |
09 Dec 15 |
peter |
24 |
#include "Suite.h" |
3454 |
09 Dec 15 |
peter |
25 |
|
3454 |
09 Dec 15 |
peter |
26 |
#include <yat/random/copy_k_of_n.h> |
3454 |
09 Dec 15 |
peter |
27 |
|
3454 |
09 Dec 15 |
peter |
28 |
#include <boost/concept_archetype.hpp> |
3454 |
09 Dec 15 |
peter |
29 |
#include <boost/iterator/iterator_archetypes.hpp> |
3454 |
09 Dec 15 |
peter |
30 |
|
3454 |
09 Dec 15 |
peter |
31 |
#include <iterator> |
3454 |
09 Dec 15 |
peter |
32 |
#include <vector> |
3454 |
09 Dec 15 |
peter |
33 |
|
3454 |
09 Dec 15 |
peter |
34 |
using namespace theplu::yat; |
3454 |
09 Dec 15 |
peter |
35 |
int main(int argc, char* argv[]) |
3454 |
09 Dec 15 |
peter |
36 |
{ |
3454 |
09 Dec 15 |
peter |
37 |
using namespace theplu::yat; |
3454 |
09 Dec 15 |
peter |
38 |
test::Suite suite(argc, argv); |
3454 |
09 Dec 15 |
peter |
39 |
|
3454 |
09 Dec 15 |
peter |
40 |
std::vector<int> x(1000, 0); |
3454 |
09 Dec 15 |
peter |
41 |
std::vector<int> y; |
3454 |
09 Dec 15 |
peter |
42 |
size_t n = 100; |
3454 |
09 Dec 15 |
peter |
43 |
random::copy_k_of_n(x.begin(), n, x.size(), std::back_inserter(y)); |
3454 |
09 Dec 15 |
peter |
44 |
if (y.size() != n) { |
3454 |
09 Dec 15 |
peter |
45 |
suite.add(false); |
3454 |
09 Dec 15 |
peter |
46 |
suite.err() << "error: y.size(): " << y.size() << " expected " << n << "\n"; |
3454 |
09 Dec 15 |
peter |
47 |
} |
3454 |
09 Dec 15 |
peter |
// do not run compiler test |
3454 |
09 Dec 15 |
peter |
49 |
if (false) { |
3454 |
09 Dec 15 |
peter |
50 |
typedef boost::sgi_assignable_archetype< |
3454 |
09 Dec 15 |
peter |
51 |
boost::default_constructible_archetype<> |
3454 |
09 Dec 15 |
peter |
52 |
> value_type; |
3454 |
09 Dec 15 |
peter |
53 |
boost::input_iterator_archetype<value_type> in; |
3454 |
09 Dec 15 |
peter |
54 |
boost::detail::dummy_constructor arg; |
3454 |
09 Dec 15 |
peter |
55 |
boost::output_iterator_archetype<value_type> out(arg); |
3454 |
09 Dec 15 |
peter |
56 |
random::copy_k_of_n(in, 10, 20, out); |
3454 |
09 Dec 15 |
peter |
57 |
} |
3454 |
09 Dec 15 |
peter |
58 |
return suite.return_value(); |
3454 |
09 Dec 15 |
peter |
59 |
} |