/test/lib/numeric/number/test_number71.e

http://github.com/tybor/Liberty · Specman e · 60 lines · 32 code · 6 blank · 22 comment · 1 complexity · 3ec7fc742a8128580092414024b520f7 MD5 · raw file

  1. -- This file is part of SmartEiffel The GNU Eiffel Compiler Tools and Libraries.
  2. -- See the Copyright notice at the end of this file.
  3. --
  4. class TEST_NUMBER71
  5. -- tests on "inverse"
  6. insert
  7. NUMBER_TOOLS
  8. create {}
  9. make
  10. feature {ANY}
  11. make
  12. local
  13. n: NUMBER
  14. do
  15. n := from_integer(1)
  16. assert(n.inverse @= 1)
  17. n := from_integer(-1)
  18. assert(n.inverse @= -1)
  19. n := from_string("1/5")
  20. assert(n.inverse @= 5)
  21. n := from_string("-1/4")
  22. assert(n.inverse @= -4)
  23. n := from_string("458/4561891")
  24. assert(n.inverse.inverse.is_equal(n))
  25. end
  26. count: INTEGER
  27. assert (b: BOOLEAN)
  28. do
  29. count := count + 1
  30. if not b then
  31. io.put_string("TEST_NUMBER71 : ERROR Test # ")
  32. io.put_integer(count)
  33. io.put_string("%N")
  34. end
  35. end
  36. end -- class TEST_NUMBER71
  37. --
  38. -- ------------------------------------------------------------------------------------------------------------------------------
  39. -- Copyright notice below. Please read.
  40. --
  41. -- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
  42. -- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
  43. -- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
  44. -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
  45. -- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
  46. -- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  47. --
  48. -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
  49. -- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
  50. --
  51. -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
  52. --
  53. -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
  54. -- ------------------------------------------------------------------------------------------------------------------------------