PageRenderTime 24ms CodeModel.GetById 17ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/test/language/unclassified/test_is_equal.e

http://github.com/tybor/Liberty
Specman e | 71 lines | 44 code | 5 blank | 22 comment | 1 complexity | cc004ac22f3d243ba5683d3211daadb5 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_IS_EQUAL
 5
 6create {}
 7   make
 8
 9feature {ANY}
10   make
11      local
12         animal1, animal2: ANIMAL; p1, p2: LIB_TEST_POINT; any1, any2: ANY; cp1, cp2: COLORED_POINT
13      do
14         assert(("foo").is_equal("foo"))
15         assert(not ("bar").is_equal("foo"))
16         assert(not ("foo").is_equal(""))
17         create {DOG} animal1
18         create {CAT} animal1
19         create {CAT} animal2
20         assert(animal1.is_equal(animal2))
21         create p1.make(1.5, 2.5)
22         create p2.make(1.5, 2.5)
23         assert(p1.is_equal(p2))
24         assert(p2.is_equal(p1))
25         any1 := p1
26         any2 := p2
27         assert(any1.is_equal(any2))
28         assert(any2.is_equal(any1))
29         create cp1.make(1.5, 2.5, "red")
30         create cp2.make(1.5, 2.5, "red")
31         assert(not cp1.is_equal(cp2))
32         any1 := cp1
33         any2 := cp1
34         assert(any1.is_equal(any2))
35         any2 := cp2
36         assert(not any1.is_equal(any2))
37      end
38
39   assert (b: BOOLEAN)
40      do
41         cpt := cpt + 1
42         if not b then
43            std_output.put_string("TEST_IS_EQUAL: ERROR Test # ")
44            std_output.put_integer(cpt)
45            std_output.put_string("%N")
46         else
47            -- std_output.put_string("Yes %N");
48         end
49      end
50
51   cpt: INTEGER
52
53end -- class TEST_IS_EQUAL
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-- ------------------------------------------------------------------------------------------------------------------------------