PageRenderTime 4ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/test/lib/numeric/number/test_number108.e

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