|
1 | 1 | import java |
2 | | -import AutomodelApplicationModeCharacteristics |
| 2 | +import AutomodelApplicationModeCharacteristics as Characteristics |
3 | 3 | import TestUtilities.InlineExpectationsTest |
| 4 | +import AutomodelExtractionTests |
4 | 5 |
|
5 | | -module Extraction implements TestSig { |
6 | | - string getARelevantTag() { |
7 | | - result in ["sourceModel", "sinkModel", "positiveExample", "negativeExample"] |
| 6 | +module TestHelper implements TestHelperSig<Characteristics::ApplicationCandidatesImpl> { |
| 7 | + Location getEndpointLocation(Characteristics::Endpoint endpoint) { |
| 8 | + result = endpoint.asTop().getLocation() |
8 | 9 | } |
9 | 10 |
|
10 | | - additional predicate selectEndpoint( |
11 | | - Endpoint endpoint, string name, string signature, string input, string output, |
12 | | - string extensibleType, string tag, string suffix |
| 11 | + predicate isCandidate( |
| 12 | + Characteristics::Endpoint endpoint, string name, string signature, string input, string output, |
| 13 | + string extensibleType |
13 | 14 | ) { |
14 | | - isCandidate(endpoint, _, _, _, name, signature, input, output, _, extensibleType, _) and |
15 | | - tag = extensibleType and |
16 | | - suffix = "" |
17 | | - or |
18 | | - isNegativeExample(endpoint, _, _, _, _, _, name, signature, input, output, _, extensibleType) and |
19 | | - tag = "negativeExample" and |
20 | | - suffix = "" |
21 | | - or |
22 | | - exists(string endpointType | |
23 | | - isPositiveExample(endpoint, endpointType, _, _, _, name, signature, input, output, _, |
24 | | - extensibleType) and |
25 | | - tag = "positiveExample" and |
26 | | - suffix = "(" + endpointType + ")" |
27 | | - ) |
| 15 | + Characteristics::isCandidate(endpoint, _, _, _, name, signature, input, output, _, |
| 16 | + extensibleType, _) |
28 | 17 | } |
29 | 18 |
|
30 | | - predicate hasActualResult(Location location, string element, string tag, string value) { |
31 | | - exists( |
32 | | - Endpoint endpoint, string name, string signature, string input, string output, |
33 | | - string extensibleType, string suffix |
34 | | - | |
35 | | - selectEndpoint(endpoint, name, signature, input, output, extensibleType, tag, suffix) |
36 | | - | |
37 | | - endpoint.asTop().getLocation() = location and |
38 | | - endpoint.toString() = element and |
39 | | - // for source models only the output is relevant, and vice versa for sink models |
40 | | - if extensibleType = "sourceModel" |
41 | | - then value = name + signature + ":" + output + suffix |
42 | | - else value = name + signature + ":" + input + suffix |
43 | | - ) |
| 19 | + predicate isPositiveExample( |
| 20 | + Characteristics::Endpoint endpoint, string endpointType, string name, string signature, |
| 21 | + string input, string output, string extensibleType |
| 22 | + ) { |
| 23 | + Characteristics::isPositiveExample(endpoint, endpointType, _, _, _, name, signature, input, |
| 24 | + output, _, extensibleType) |
| 25 | + } |
| 26 | + |
| 27 | + predicate isNegativeExample( |
| 28 | + Characteristics::Endpoint endpoint, string name, string signature, string input, string output, |
| 29 | + string extensibleType |
| 30 | + ) { |
| 31 | + Characteristics::isNegativeExample(endpoint, _, _, _, _, _, name, signature, input, output, _, |
| 32 | + extensibleType) |
44 | 33 | } |
45 | 34 | } |
46 | 35 |
|
47 | | -import MakeTest<Extraction> |
| 36 | +import MakeTest<Extraction<Characteristics::ApplicationCandidatesImpl, TestHelper>> |
0 commit comments