/test/lib/numeric/number/test_number72.e

http://github.com/tybor/Liberty · Specman e · 82 lines · 53 code · 7 blank · 22 comment · 0 complexity · 12dd1d3341116cdfac6aea3804cff071 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_NUMBER72
  5. -- tests on "append_in"
  6. insert
  7. EIFFELTEST_TOOLS
  8. PLATFORM
  9. NUMBER_TOOLS
  10. create {}
  11. make
  12. feature {ANY}
  13. s: STRING "hello"
  14. make
  15. local
  16. s1, s2, s3: STRING; n: NUMBER
  17. do
  18. n := from_integer(1)
  19. s1 := s.twin
  20. n.append_in(s1)
  21. assert(s1.is_equal("hello1"))
  22. n := from_integer(-1)
  23. s1 := s.twin
  24. n.append_in(s1)
  25. assert(s1.is_equal("hello-1"))
  26. n := from_integer(0)
  27. s1 := s.twin
  28. n.append_in(s1)
  29. assert(s1.is_equal("hello0"))
  30. n := from_integer(Maximum_integer)
  31. n := n @* 10
  32. s1 := s.twin
  33. n.append_in(s1)
  34. s2 := s.twin
  35. Maximum_integer.append_in(s2)
  36. s3 := "0"
  37. s2.append(s3)
  38. assert(s1.is_equal(s2))
  39. n := from_integer(Minimum_integer)
  40. n := n @* 10
  41. s1 := s.twin
  42. n.append_in(s1)
  43. s2 := s.twin
  44. Minimum_integer.append_in(s2)
  45. s3 := "0"
  46. s2.append(s3)
  47. assert(s1.is_equal(s2))
  48. n := from_string("60/50")
  49. s1 := s.twin
  50. n.append_in(s1)
  51. assert(s1.is_equal("hello6/5"))
  52. n := from_string("-60/50")
  53. s1 := s.twin
  54. n.append_in(s1)
  55. assert(s1.is_equal("hello-6/5"))
  56. end
  57. end -- class TEST_NUMBER72
  58. --
  59. -- ------------------------------------------------------------------------------------------------------------------------------
  60. -- Copyright notice below. Please read.
  61. --
  62. -- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
  63. -- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
  64. -- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
  65. -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
  66. -- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
  67. -- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  68. --
  69. -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
  70. -- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
  71. --
  72. -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
  73. --
  74. -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
  75. -- ------------------------------------------------------------------------------------------------------------------------------