28 {
29 LOG_UNIT_TEST;
30
33 const int n_vals = size - rank;
34 std::vector<int> vals(n_vals);
35
36
37
38 int val = rank+1, stride = size;
39 for (int i=0; i != n_vals; ++i)
40 {
41 vals[n_vals-i-1] = val;
42 val += stride;
43 stride -= 1;
44 }
45
47
48 sorter.sort();
49
50 const std::vector<int> & my_bin = sorter.bin();
51
52
53
54
55
56
57 int total_size = cast_int<int>(my_bin.size());
59
60 CPPUNIT_ASSERT_EQUAL(total_size, size*(size+1)/2);
61
62 CPPUNIT_ASSERT(std::is_sorted(my_bin.begin(), my_bin.end()));
63
64 int rank_with_i = -1;
65 for (int i=1; i <= total_size; ++i)
66 {
67 int count_i = std::count(my_bin.begin(), my_bin.end(), i);
68 CPPUNIT_ASSERT(count_i < 2);
69
70 if (count_i)
71 {
72 CPPUNIT_ASSERT(rank_with_i <= rank);
73 rank_with_i = rank;
74 }
76
78 CPPUNIT_ASSERT_EQUAL(count_i, 1);
79 }
80 }
The parallel sorting method is templated on the type of data which is to be sorted.
Communicator * TestCommWorld