aboutsummaryrefslogtreecommitdiff
path: root/cpp02/ex02/Fixed.cpp
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-11-10 12:01:44 +0100
committerCharles Cabergs <me@cacharle.xyz>2020-11-10 12:01:44 +0100
commit18ca1fc67ccc7bf176287f7b2908a33a597ec67a (patch)
tree930e1604156d6b8957d8c01786a18f670a202bc3 /cpp02/ex02/Fixed.cpp
parent9dd7a48967f99793b818f7362ac8e95717186774 (diff)
downloadpiscine_cpp-18ca1fc67ccc7bf176287f7b2908a33a597ec67a.tar.gz
piscine_cpp-18ca1fc67ccc7bf176287f7b2908a33a597ec67a.tar.bz2
piscine_cpp-18ca1fc67ccc7bf176287f7b2908a33a597ec67a.zip
Added more tests for cpp02/02
Diffstat (limited to 'cpp02/ex02/Fixed.cpp')
-rw-r--r--cpp02/ex02/Fixed.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/cpp02/ex02/Fixed.cpp b/cpp02/ex02/Fixed.cpp
index 7769083..085b16f 100644
--- a/cpp02/ex02/Fixed.cpp
+++ b/cpp02/ex02/Fixed.cpp
@@ -6,7 +6,7 @@
/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/04/13 11:45:18 by charles #+# #+# */
-/* Updated: 2020/10/19 12:41:30 by cacharle ### ########.fr */
+/* Updated: 2020/11/10 12:00:43 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -64,14 +64,12 @@ Fixed& Fixed::operator--() { m_value++; return *this; }
Fixed Fixed::operator++(int) { Fixed copy(*this); m_value++; return copy; }
Fixed Fixed::operator--(int) { Fixed copy(*this); m_value--; return copy; }
-bool Fixed::operator<(Fixed const& other) const { return m_value < other.m_value; }
-bool Fixed::operator>(Fixed const& other) const { return m_value > other.m_value; }
-bool Fixed::operator<=(Fixed const& other) const { return !(*this > other); }
-bool Fixed::operator>=(Fixed const& other) const { return !(*this < other); }
-bool Fixed::operator==(Fixed const& other) const { return m_value == other.m_value; }
-bool Fixed::operator!=(Fixed const& other) const { return !(*this == other); }
-
-int Fixed::getFractionalBits() { return m_fractionalBits; }
+bool Fixed::operator<(Fixed const& other) const { return m_value < other.m_value; }
+bool Fixed::operator>(Fixed const& other) const { return m_value > other.m_value; }
+bool Fixed::operator<=(Fixed const& other) const { return *this < other || *this == other; }
+bool Fixed::operator>=(Fixed const& other) const { return *this > other || *this == other; }
+bool Fixed::operator==(Fixed const& other) const { return m_value == other.m_value; }
+bool Fixed::operator!=(Fixed const& other) const { return !(*this == other); }
Fixed& Fixed::max(Fixed& a, Fixed& b) { return a > b ? a : b; }
Fixed& Fixed::min(Fixed& a, Fixed& b) { return a < b ? a : b; }