PageRenderTime 19ms CodeModel.GetById 11ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/test/language/agent/test_agent63.e

http://github.com/tybor/Liberty
Specman e | 61 lines | 30 code | 8 blank | 23 comment | 0 complexity | cce897a22fedba5d11552f41e6bebc04 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_AGENT63
 5   -- Report from Philippe Ribet
 6   -- As TUPLE is not expanded, this example should work.
 7
 8insert
 9   EIFFELTEST_TOOLS
10
11create {}
12   make
13
14feature {}
15   loop_stack: LOOP_STACK
16
17   counter: INTEGER
18
19   make
20      do
21         create loop_stack.make
22         init(3)
23         loop_stack.run
24      end
25
26   init (repeat: INTEGER)
27      local
28         update: SIMPLE_PERIODIC_JOB
29      do
30         counter := repeat
31         create update.set_work(agent foo([repeat]), Void, 1, 0.1)
32         loop_stack.add_job(update)
33      end
34
35   foo (repeat: TUPLE[INTEGER]): BOOLEAN
36      do
37         assert(repeat.first = counter)
38         counter := counter - 1
39         repeat.set_first(repeat.first - 1)
40         Result := repeat.first > 0
41      end
42
43end -- class TEST_AGENT63
44--
45-- ------------------------------------------------------------------------------------------------------------------------------
46-- Copyright notice below. Please read.
47--
48-- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
49-- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
50-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
51-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
52-- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
53-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
54--
55-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P.       - University of Nancy 1 - FRANCE
56-- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
57--
58-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
59--
60-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
61-- ------------------------------------------------------------------------------------------------------------------------------