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

/test/lib/storage/collection/test_native_array8.e

http://github.com/tybor/Liberty
Specman e | 71 lines | 32 code | 5 blank | 34 comment | 1 complexity | b74424dfd93bf33a537fbaf3158d89a1 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_NATIVE_ARRAY8
 5
 6create {}
 7   make
 8
 9feature {ANY}
10   make
11      local
12         a, b: NATIVE_ARRAY[ANY]; cat: CAT; dog: DOG
13      do
14         create cat
15         create dog
16         a := a.calloc(2)
17         -- *** Correctly rejected *** (Dom. nov 10th 2004) *** a.put(cat,0);
18         -- *** Correctly rejected *** (Dom. nov 10th 2004) *** a.put(dog,1);
19         -- *** Correctly rejected *** (Dom. nov 10th 2004) *** assert(a.item(0) = cat);
20         -- *** Correctly rejected *** (Dom. nov 10th 2004) *** assert(a.item(1) = dog);
21         a := a.realloc(2, 1024)
22         -- *** Correctly rejected *** (Dom. nov 10th 2004) *** assert(a.item(0) = cat);
23         -- *** Correctly rejected *** (Dom. nov 10th 2004) *** assert(a.item(1) = dog);
24         b := b.calloc(2)
25         assert(b.item(0) = Void)
26         assert(b.item(1) = Void)
27         -- *** Correctly rejected *** (Dom. nov 10th 2004) *** b.put(cat,0);
28         -- *** Correctly rejected *** (Dom. nov 10th 2004) *** b.put(dog,1);
29         -- *** Correctly rejected *** (Dom. nov 10th 2004) *** assert(b.item(0) = cat);
30         -- *** Correctly rejected *** (Dom. nov 10th 2004) *** assert(b.item(1) = dog);
31         b := b.realloc(2, 1024)
32         -- *** Correctly rejected *** (Dom. nov 10th 2004) *** assert(b.item(0) = cat);
33         -- *** Correctly rejected *** (Dom. nov 10th 2004) *** assert(b.item(1) = dog);
34         assert(a.fast_memcmp(b, 2))
35         assert(a.memcmp(b, 2))
36      end
37
38   assert (b: BOOLEAN)
39      do
40         cpt := cpt + 1
41         if not b then
42            std_output.put_string("TEST_NATIVE_ARRAY8: ERROR Test # ")
43            std_output.put_integer(cpt)
44            std_output.put_string("%N")
45            crash
46         else
47            -- std_output.put_string("Yes%N");
48         end
49      end
50
51   cpt: INTEGER
52
53end -- class TEST_NATIVE_ARRAY8
54--
55-- ------------------------------------------------------------------------------------------------------------------------------
56-- Copyright notice below. Please read.
57--
58-- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
59-- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
60-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
61-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
62-- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
63-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
64--
65-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P.       - University of Nancy 1 - FRANCE
66-- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
67--
68-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
69--
70-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
71-- ------------------------------------------------------------------------------------------------------------------------------