diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2020-11-10 12:01:44 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2020-11-10 12:01:44 +0100 |
| commit | 18ca1fc67ccc7bf176287f7b2908a33a597ec67a (patch) | |
| tree | 930e1604156d6b8957d8c01786a18f670a202bc3 /cpp02/ex02/Fixed.cpp | |
| parent | 9dd7a48967f99793b818f7362ac8e95717186774 (diff) | |
| download | piscine_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.cpp | 16 |
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; } |
