-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.cpp
56 lines (41 loc) · 2.17 KB
/
tests.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include "common.hpp"
#include "prettyprint.hpp"
#include <iostream>
using namespace std;
using namespace mp;
BOOST_AUTO_TEST_CASE(testGetRanksAbsolute)
{
BOOST_TEST( getRanks(2, 8, 3) == std::vector<int>({2, 3}) );
BOOST_TEST( getRanks(3, 8, 3) == std::vector<int>({2, 3, 4}) );
BOOST_TEST( getRanks(4, 8, 3) == std::vector<int>({1, 2, 3, 4}) );
BOOST_TEST( getRanks(5, 8, 3) == std::vector<int>({1, 2, 3, 4, 5}) );
BOOST_TEST( getRanks(6, 8, 3) == std::vector<int>({0, 1, 2, 3, 4, 5}) );
BOOST_TEST( getRanks(7, 8, 3) == std::vector<int>({0, 1, 2, 3, 4, 5, 6}) );
BOOST_TEST( getRanks(8, 8, 3) == std::vector<int>({0, 1, 2, 3, 4, 5, 6, 7}) );
BOOST_TEST( getRanks(8, 80, 3) == std::vector<int>({0, 1, 2, 3, 4, 5, 6, 7}) );
BOOST_TEST( getRanks(3, 80, 0) == std::vector<int>({0, 1, 2}) );
BOOST_TEST( getRanks(4, 5, 4) == std::vector<int>({1, 2, 3, 4}) );
BOOST_TEST( getRanks(4, 5, 4) == std::vector<int>({1, 2, 3, 4}) );
}
BOOST_AUTO_TEST_CASE(testGetRanksRatio)
{
BOOST_TEST( getRanks(0.2, 10, 3) == std::vector<int>({2, 3}) );
BOOST_TEST( getRanks(0.5, 10, 3) == std::vector<int>({1, 2, 3, 4, 5}) );
BOOST_TEST( getRanks(0.8, 10, 3) == std::vector<int>({0, 1, 2, 3, 4, 5, 6, 7}) );
}
BOOST_AUTO_TEST_CASE(testInvertGetRanksAbsolute)
{
BOOST_TEST( invertGetRanks(2, 8, 3) == std::vector<int>({3, 4}) );
BOOST_TEST( invertGetRanks(3, 8, 3) == std::vector<int>({2, 3, 4}) );
BOOST_TEST( invertGetRanks(4, 8, 3) == std::vector<int>({0, 1, 2, 3, 4, 5}) );
BOOST_TEST( invertGetRanks(5, 8, 3) == std::vector<int>({0, 1, 2, 3, 4, 5, 6, 7}) );
BOOST_TEST( invertGetRanks(6, 8, 3) == std::vector<int>({0, 1, 2, 3, 4, 5, 6, 7}) );
BOOST_TEST( invertGetRanks(7, 8, 3) == std::vector<int>({0, 1, 2, 3, 4, 5, 6, 7}) );
BOOST_TEST( invertGetRanks(8, 8, 3) == std::vector<int>({0, 1, 2, 3, 4, 5, 6, 7}) );
BOOST_TEST( invertGetRanks(8, 80, 3) == std::vector<int>({0, 1, 2, 3, 4, 5, 6, 7}) );
BOOST_TEST( invertGetRanks(3, 80, 0) == std::vector<int>({0, 1}) );
BOOST_TEST( invertGetRanks(4, 5, 4) == std::vector<int>({3, 4}) );
BOOST_TEST( invertGetRanks(4, 5, 4) == std::vector<int>({3, 4}) );
}