PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/test/lib/numeric/integer/test_integer4.e

http://github.com/tybor/Liberty
Specman e | 136 lines | 107 code | 5 blank | 24 comment | 1 complexity | 1502c9839455a6458eb1fe234123b06e 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_INTEGER4
  5
  6create {}
  7   make
  8
  9feature {ANY}
 10   make
 11      local
 12         a32, b32: INTEGER_32; a64, b64: INTEGER_64
 13      do
 14         a32 := 0xFFFFF000
 15         b32 := a32.bit_shift_right(4)
 16         assert(b32 = 0xFFFFFF00)
 17         a32 := 0xFFFFF000
 18         b32 := a32.bit_shift_right(8)
 19         assert(b32 = 0xFFFFFFF0)
 20         a32 := 0xFFFFF000
 21         b32 := a32.bit_shift_right(12)
 22         assert(b32 = 0xFFFFFFFF)
 23         a32 := 0xFFFFF000
 24         b32 := a32.bit_shift_right(16)
 25         assert(b32 = 0xFFFFFFFF)
 26         a64 := 0xFFFFF000FFFFF000
 27         b64 := a64.bit_shift_right(4)
 28         assert(b64 = 0xFFFFFF000FFFFF00)
 29         a64 := 0xFFFFF000FFFFF000
 30         b64 := a64.bit_shift_right(8)
 31         assert(b64 = 0xFFFFFFF000FFFFF0)
 32         a64 := 0xFFFFF000FFFFF000
 33         b64 := a64.bit_shift_right(12)
 34         assert(b64 = 0xFFFFFFFF000FFFFF)
 35         a64 := 0xFFFFF000FFFFF000
 36         b64 := a64.bit_shift_right(16)
 37         assert(b64 = 0xFFFFFFFFF000FFFF)
 38         a64 := 0xFFFFF000FFFFF000
 39         b64 := a64.bit_shift_right(24)
 40         assert(b64 = 0xFFFFFFFFFFF000FF)
 41         a64 := 0xFFFFF000FFFFF000
 42         b64 := a64.bit_shift_right(32)
 43         assert(b64 = 0xFFFFFFFFFFFFF000)
 44         -- -----------------------------------------------------
 45         a32 := 0x7FFFF000
 46         b32 := a32.bit_shift_right(4)
 47         assert(b32 = 0x07FFFF00)
 48         a32 := 0x7FFFF000
 49         b32 := a32.bit_shift_right(8)
 50         assert(b32 = 0x007FFFF0)
 51         a32 := 0x7FFFF000
 52         b32 := a32.bit_shift_right(12)
 53         assert(b32 = 0x0007FFFF)
 54         a32 := 0x7FFFF000
 55         b32 := a32.bit_shift_right(16)
 56         assert(b32 = 0x00007FFF)
 57         a64 := 0x7FFFF000FFFFF000
 58         b64 := a64.bit_shift_right(4)
 59         assert(b64 = 0x07FFFF000FFFFF00)
 60         a64 := 0x7FFFF000FFFFF000
 61         b64 := a64.bit_shift_right(8)
 62         assert(b64 = 0x007FFFF000FFFFF0)
 63         a64 := 0x7FFFF000FFFFF000
 64         b64 := a64.bit_shift_right(12)
 65         assert(b64 = 0x0007FFFF000FFFFF)
 66         a64 := 0x7FFFF000FFFFF000
 67         b64 := a64.bit_shift_right(16)
 68         assert(b64 = 0x00007FFFF000FFFF)
 69         a64 := 0x7FFFF000FFFFF000
 70         b64 := a64.bit_shift_right(24)
 71         assert(b64 = 0x0000007FFFF000FF)
 72         a64 := 0x7FFFF000FFFFF000
 73         b64 := a64.bit_shift_right(32)
 74         assert(b64 = 0x000000007FFFF000)
 75         -- -----------------------------------------------------
 76         a32 := 0xFFFFF000
 77         assert(a32.bit_not = 0x00000FFF)
 78         b32 := a32.bit_shift_right_unsigned(4)
 79         assert(b32 = 0x0FFFFF00)
 80         a32 := 0xFFFFF000
 81         b32 := a32.bit_shift_right_unsigned(8)
 82         assert(b32 = 0x00FFFFF0)
 83         a32 := 0xFFFFF000
 84         b32 := a32.bit_shift_right_unsigned(12)
 85         assert(b32 = 0x000FFFFF)
 86         a32 := 0xFFFFF000
 87         b32 := a32.bit_shift_right_unsigned(16)
 88         assert(b32 = 0x0000FFFF)
 89         a64 := 0xFFFFF000FFFFF000
 90         sedb_breakpoint
 91         b64 := a64.bit_shift_right_unsigned(8)
 92         assert(b64 = 0x00FFFFF000FFFFF0)
 93         a64 := 0xFFFFF000FFFFF000
 94         b64 := a64.bit_shift_right_unsigned(16)
 95         assert(b64 = 0x0000FFFFF000FFFF)
 96         a64 := 0xFFFFF000FFFFF000
 97         b64 := a64.bit_shift_right_unsigned(24)
 98         assert(b64 = 0x000000FFFFF000FF)
 99         a64 := 0xFFFFF000FFFFF000
100         b64 := a64.bit_shift_right_unsigned(32)
101         assert(b64 = 0x00000000FFFFF000)
102         -- -----------------------------------------------------
103      end
104
105   assert (b: BOOLEAN)
106      do
107         cpt := cpt + 1
108         if not b then
109            sedb_breakpoint
110            std_output.put_string("TEST_INTEGER4: ERROR Test # ")
111            std_output.put_integer(cpt)
112            std_output.put_string("%N")
113         end
114      end
115
116   cpt: INTEGER
117
118end -- class TEST_INTEGER4
119--
120-- ------------------------------------------------------------------------------------------------------------------------------
121-- Copyright notice below. Please read.
122--
123-- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
124-- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
125-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
126-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
127-- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
128-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
129--
130-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P.       - University of Nancy 1 - FRANCE
131-- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
132--
133-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
134--
135-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
136-- ------------------------------------------------------------------------------------------------------------------------------