-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
57 lines (40 loc) · 1.12 KB
/
main.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
// Rafael A. Arce Nazario
//
// Cliente con pruebas para la clase Racional
#define CATCH_CONFIG_MAIN
#include <iostream>
#include "/home/rarce/Dropbox/ccom3034-b92/catch.hpp"
#include "Racional.h"
using namespace std;
TEST_CASE("Rational tests", "[rational]") {
Racional r01;
Racional r02(10,8);
REQUIRE(r01.getP() == 0);
REQUIRE(r01.getQ() == 1);
REQUIRE(r02.getP() == 10);
REQUIRE(r02.getQ() == 8);
// r02.simplificar();
~r02;
REQUIRE(r02.getP() == 5);
REQUIRE(r02.getQ() == 4);
Racional r03;
// r03 = r02.suma(r01);
REQUIRE(r02.suma(r01).getP() == 5);
REQUIRE(r02.suma(r01).getQ() == 4);
r03 = r01 + r02;
Racional r04(1000,10000);
Racional r05(1,2);
REQUIRE((r04 > r05) == false);
REQUIRE((r05 > r04) == true);
r05.display();
Racional r06(1,2);
Racional r07(3,5);
Racional r08;
r08 = suma(r06,r07);
REQUIRE((r06 + 5).getP() == 11);
REQUIRE((r06 + 5).getQ() == 2);
REQUIRE((5 + r06).getP() == 11);
REQUIRE((5 + r06).getQ() == 2);
REQUIRE( (r06++) == Racional(1,2));
REQUIRE( r06 == Racional(3,2));
}