-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_pair.cpp
70 lines (51 loc) · 1.73 KB
/
main_pair.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "ft_utility.hpp"
#include <iostream> // for testing
#include <utility> // for testing
template <typename any_pair>
void print_pair(any_pair p)
{
std::cout << '|' << p.first << '|' << std::endl;
std::cout << '|' << p.second << '|' << std::endl;
std::cout << std::endl;
}
int main(void)
{
// init ctor test
std::cout << "init ctor :" << std::endl;
std::pair<int, char> p1(1, '*');
print_pair(p1);
ft::pair<int, char> p2(1, '*');
print_pair(p2);
// copy ctor test
std::cout << "copy ctor :" << std::endl;
std::pair<int, char> p5(p1.first, p1.second);
print_pair(p5);
ft::pair<int, char> p6(p1.first, p1.second);
print_pair(p6);
// default ctor test
std::cout << "default ctor :" << std::endl;
ft::pair<int, char> p9;
print_pair(p9);
std::pair<int, char> p8;
print_pair(p8);
// make_pair test
std::cout << "make_pair :" << std::endl;
std::pair<int, char> p3;
p3 = std::make_pair(2, '+');
print_pair(p3);
ft::pair<int, char> p4;
p4 = ft::make_pair(2, '+');
print_pair(p4);
// rel_ops test
using namespace ft::rel_ops;
std::cout << "rel_ops :" << std::endl;
std::cout << std::boolalpha;
std::cout << "is p2 different of p4 ? : " << (p2 != p4) << std::endl;
std::cout << "is p2 equal to p4 ? : " << (p2 == p4) << std::endl;
std::cout << "is p2 less equal than p4 ? : " << (p2 <= p4) << std::endl; // is ok thanks to changing code's order
std::cout << "is p2 greater equal than p4 ? : " << (p2 >= p4) << std::endl; // is ok thanks to changing code's order
std::cout << "is p2 less than p4 ? : " << (p2 < p4) << std::endl; // ok with other implementation
std::cout << "is p2 greater than p4 ? : " << (p2 > p4) << std::endl;
// add tests that compares std::vectors + test comparing std/ft vectors
return (0);
}