PageRenderTime 16ms CodeModel.GetById 13ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/test/lib/numeric/number/test_number109.e

http://github.com/tybor/Liberty
Specman e | 121 lines | 89 code | 5 blank | 27 comment | 0 complexity | bd6cb60458075ae419e4188ac0a01225 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--
  4class TEST_NUMBER109
  5   --
  6   -- Test of depassement of INTEGER_64_NUMBER capacity
  7   -- during a division between 2 integers which
  8   -- symbolized by a BIG_INTEGER_NUMBER
  9   -- Result is an small integer
 10   --
 11
 12insert
 13   EIFFELTEST_TOOLS
 14   
 15create {}
 16   make
 17
 18feature {ANY}
 19   make
 20      local
 21         a, b, q, r: NUMBER
 22      do
 23         a := nt.from_string("100000000000000000000000000")
 24         b := nt.from_string("1000000000000000000000")
 25         q := a // b
 26         r := a \\ b
 27         assert(q.is_integer_general_number)
 28         assert(q.is_positive)
 29         assert(q @= 100000)
 30         assert(r.is_integer_general_number)
 31         assert(r.is_zero)
 32         a := nt.from_string("-100000000000000000000000000")
 33         b := nt.from_string("1000000000000000000000")
 34         q := a // b
 35         r := a \\ b
 36         assert(q.is_integer_general_number)
 37         assert(not q.is_positive)
 38         assert(q @= -100000)
 39         assert(r.is_integer_general_number)
 40         assert(r.is_zero)
 41         a := nt.from_string("100000000000000000000000000")
 42         b := nt.from_string("-1000000000000000000000")
 43         q := a // b
 44         r := a \\ b
 45         assert(q.is_integer_general_number)
 46         assert(not q.is_positive)
 47         assert(q @= -100000)
 48         assert(r.is_integer_general_number)
 49         assert(r.is_zero)
 50         a := nt.from_string("-100000000000000000000000000")
 51         b := nt.from_string("-1000000000000000000000")
 52         q := a // b
 53         r := a \\ b
 54         assert(q.is_integer_general_number)
 55         assert(q.is_positive)
 56         assert(q @= 100000)
 57         assert(r.is_integer_general_number)
 58         assert(r.is_zero)
 59         a := nt.from_string("100000000000000000000000999")
 60         b := nt.from_string("1000000000000000000000")
 61         q := a // b
 62         r := a \\ b
 63         assert(q.is_integer_general_number)
 64         assert(q.is_positive)
 65         assert(q @= 100000)
 66         assert(r.is_integer_general_number)
 67         assert(r.is_positive)
 68         assert(r @= 999)
 69         a := nt.from_string("-99999999999999999999999001")
 70         b := nt.from_string("1000000000000000000000")
 71         q := a // b
 72         r := a \\ b
 73         assert(q.is_integer_general_number)
 74         assert(not q.is_positive)
 75         assert(q @= -100000)
 76         assert(r.is_integer_general_number)
 77         assert(r.is_positive)
 78         assert(r @= 999)
 79         a := nt.from_string("100000000000000000000000999")
 80         b := nt.from_string("-1000000000000000000000")
 81         q := a // b
 82         r := a \\ b
 83         assert(q.is_integer_general_number)
 84         assert(not q.is_positive)
 85         assert(q @= -100000)
 86         assert(r.is_integer_general_number)
 87         assert(r.is_positive)
 88         assert(r @= 999)
 89         a := nt.from_string("-99999999999999999999999001")
 90         b := nt.from_string("-1000000000000000000000")
 91         q := a // b
 92         r := a \\ b
 93         assert(q.is_integer_general_number)
 94         assert(q.is_positive)
 95         assert(q @= 100000)
 96         assert(r.is_integer_general_number)
 97         assert(r.is_positive)
 98         assert(r @= 999)
 99      end
100
101   nt: NUMBER_TOOLS
102
103end -- class TEST_NUMBER109
104--
105-- ------------------------------------------------------------------------------------------------------------------------------
106-- Copyright notice below. Please read.
107--
108-- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
109-- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
110-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
111-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
112-- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
113-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
114--
115-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P.       - University of Nancy 1 - FRANCE
116-- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
117--
118-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
119--
120-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
121-- ------------------------------------------------------------------------------------------------------------------------------