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