/[eiffelstudio]/trunk/eweasel/tests/scoop045/controller.e
ViewVC logotype

Contents of /trunk/eweasel/tests/scoop045/controller.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 96579 - (show annotations)
Wed Feb 4 10:06:26 2015 UTC (4 years, 11 months ago) by romanschmocker
File size: 2309 byte(s)
Eweasel tests for SCOOP exception handling.

The tests are written against the new semantics
by Benjamin Morandi, and currently they all fail.
Initially the tests were part of a naster thesis 
at ETH by Florian Besser.

The patch also includes a test for a bug
(test#scoop041) where the behaviour in molten
and frozen code differs when evaluating a
precondition on a controlled object.



1 note
2 description: "Test if accountability is correctly handed over during lock passing."
3 author: "Florian Besser, Roman Schmocker"
4 date: "$Date$"
5 revision: "$Revision$"
6 original_source: "http://se.inf.ethz.ch/student_projects/florian_besser/code.zip"
7 original_tests: "Maude Tests/searchers/"
8
9 class
10 CONTROLLER
11
12 create
13 make
14
15 feature
16
17 make
18 local
19 s1, s2: separate SEARCHER
20 log: separate LOGGER
21 retried: BOOLEAN
22 do
23 if not retried then
24 create s1
25 create s2
26 create log
27
28 test_no_propagation (s1, s2, log)
29 -- Make sure no exceptions are stored after an unlock.
30 sync (s1)
31 sync (s2)
32
33 test_late_propagation (s1, s2, log)
34 sync (s1)
35 sync (s2)
36
37 test_accountability_transfer (s1, s2, log)
38 sync (s1)
39 sync (s2)
40
41 print("OK: At end of {CONTROLLER}.make.%N")
42 end
43 rescue
44 print ("ERROR: In rescue of {CONTROLLER}.make.%N")
45 retried := True
46 retry
47 end
48
49 test_no_propagation (s1, s2: separate SEARCHER; log: separate LOGGER)
50 -- Test if an exception is properly forgotten.
51 do
52 s1.search (1)
53 s2.search (-1)
54 log.log (s1, s2)
55
56 sync (s1)
57 -- Don't sync with s2 - we ingore this exception.
58 print ("OK: At end of {CONTROLLER}.test_no_propagation.%N")
59 end
60
61 test_late_propagation (s1, s2: separate SEARCHER; log: separate LOGGER)
62 -- Test if an exception is still there after an accountability transfer.
63 local
64 retried: BOOLEAN
65 do
66 if not retried then
67 s1.search (1)
68 s2.search (-1)
69 log.log (s1, s2)
70 sync (s1)
71
72 print ("OK: In body of {CONTROLLER}.test_late_propagation.%N")
73
74 sync (s2) -- Exception should propagate here.
75
76 print ("ERROR: At end of {CONTROLLER}.test_late_propagation.%N")
77 end
78 rescue
79 print ("OK: In rescue of {CONTROLLER}.test_late_propagation.%N")
80 retried := True
81 retry
82 end
83
84 test_accountability_transfer (s1, s2: separate SEARCHER; log: separate LOGGER)
85 -- Test if accountability is properly transferred to `log'.
86 do
87 s1.search (0)
88 s2.search (-1)
89 log.log (s1, s2)
90 -- Also test that exception is now successfully handled.
91 sync (s2) -- should not throw.
92 print ("OK: At end of {CONTROLLER}.test_accountability_transfer.%N")
93 end
94
95 sync (searcher: separate SEARCHER)
96 local
97 i: INTEGER
98 do
99 i := searcher.solution
100 end
101 end

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23