diff options
author | Kristóf Marussy <kristof@marussy.com> | 2024-01-31 18:26:32 +0100 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2024-01-31 18:45:13 +0100 |
commit | 286b6de0e20fedeb3cede1b90f4f728be3fdb74a (patch) | |
tree | 083546c8d47a8a12b8d64715995660a65da1581b /subprojects/language-semantics/src/test/java/tools/refinery/language/semantics/SolutionSerializerTest.java | |
parent | feat(language): validate module isolation (diff) | |
download | refinery-286b6de0e20fedeb3cede1b90f4f728be3fdb74a.tar.gz refinery-286b6de0e20fedeb3cede1b90f4f728be3fdb74a.tar.zst refinery-286b6de0e20fedeb3cede1b90f4f728be3fdb74a.zip |
refactor: serialize solutions as modules
Diffstat (limited to 'subprojects/language-semantics/src/test/java/tools/refinery/language/semantics/SolutionSerializerTest.java')
-rw-r--r-- | subprojects/language-semantics/src/test/java/tools/refinery/language/semantics/SolutionSerializerTest.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/subprojects/language-semantics/src/test/java/tools/refinery/language/semantics/SolutionSerializerTest.java b/subprojects/language-semantics/src/test/java/tools/refinery/language/semantics/SolutionSerializerTest.java index b682a7d6..949b7047 100644 --- a/subprojects/language-semantics/src/test/java/tools/refinery/language/semantics/SolutionSerializerTest.java +++ b/subprojects/language-semantics/src/test/java/tools/refinery/language/semantics/SolutionSerializerTest.java | |||
@@ -72,7 +72,7 @@ class SolutionSerializerTest { | |||
72 | solution.eResource().save(outputStream, Map.of()); | 72 | solution.eResource().save(outputStream, Map.of()); |
73 | actualOutput = outputStream.toString(); | 73 | actualOutput = outputStream.toString(); |
74 | } | 74 | } |
75 | assertThat(actualOutput, is(prefix + "\n" + expectedOutput)); | 75 | assertThat(actualOutput, is("module.\n\n" + prefix + "\n" + expectedOutput)); |
76 | } | 76 | } |
77 | 77 | ||
78 | static Stream<Arguments> solutionSerializerTest() { | 78 | static Stream<Arguments> solutionSerializerTest() { |
@@ -81,6 +81,7 @@ class SolutionSerializerTest { | |||
81 | """, """ | 81 | """, """ |
82 | scope Foo = 3. | 82 | scope Foo = 3. |
83 | """, """ | 83 | """, """ |
84 | declare foo1, foo2, foo3. | ||
84 | !exists(Foo::new). | 85 | !exists(Foo::new). |
85 | Foo(foo1). | 86 | Foo(foo1). |
86 | Foo(foo2). | 87 | Foo(foo2). |
@@ -94,6 +95,7 @@ class SolutionSerializerTest { | |||
94 | """, """ | 95 | """, """ |
95 | scope Foo = 1. | 96 | scope Foo = 1. |
96 | """, """ | 97 | """, """ |
98 | declare foo1, bar1, bar2. | ||
97 | !exists(Foo::new). | 99 | !exists(Foo::new). |
98 | !exists(Bar::new). | 100 | !exists(Bar::new). |
99 | Foo(foo1). | 101 | Foo(foo1). |
@@ -112,6 +114,7 @@ class SolutionSerializerTest { | |||
112 | """, """ | 114 | """, """ |
113 | scope Foo = 1, Bar = 2. | 115 | scope Foo = 1, Bar = 2. |
114 | """, """ | 116 | """, """ |
117 | declare foo1, bar1, bar2. | ||
115 | !exists(Foo::new). | 118 | !exists(Foo::new). |
116 | !exists(Bar::new). | 119 | !exists(Bar::new). |
117 | Foo(foo1). | 120 | Foo(foo1). |
@@ -131,6 +134,7 @@ class SolutionSerializerTest { | |||
131 | 134 | ||
132 | scope Person += 0. | 135 | scope Person += 0. |
133 | """, """ | 136 | """, """ |
137 | declare a, b, c. | ||
134 | !exists(Person::new). | 138 | !exists(Person::new). |
135 | Person(a). | 139 | Person(a). |
136 | Person(b). | 140 | Person(b). |
@@ -156,6 +160,7 @@ class SolutionSerializerTest { | |||
156 | 160 | ||
157 | scope Foo += 0. | 161 | scope Foo += 0. |
158 | """, """ | 162 | """, """ |
163 | declare foo. | ||
159 | !exists(Foo::new). | 164 | !exists(Foo::new). |
160 | Foo(foo). | 165 | Foo(foo). |
161 | default !bar(*, *). | 166 | default !bar(*, *). |
@@ -166,6 +171,7 @@ class SolutionSerializerTest { | |||
166 | """, """ | 171 | """, """ |
167 | scope Foo = 1, Bar = 0. | 172 | scope Foo = 1, Bar = 0. |
168 | """, """ | 173 | """, """ |
174 | declare foo1. | ||
169 | !exists(Foo::new). | 175 | !exists(Foo::new). |
170 | !exists(Bar::new). | 176 | !exists(Bar::new). |
171 | Foo(foo1). | 177 | Foo(foo1). |
@@ -180,6 +186,7 @@ class SolutionSerializerTest { | |||
180 | 186 | ||
181 | scope Foo += 0. | 187 | scope Foo += 0. |
182 | """, """ | 188 | """, """ |
189 | declare a. | ||
183 | !exists(Foo::new). | 190 | !exists(Foo::new). |
184 | Foo(a). | 191 | Foo(a). |
185 | default !ref(*, *). | 192 | default !ref(*, *). |
@@ -200,29 +207,32 @@ class SolutionSerializerTest { | |||
200 | !exists(Foo::new). | 207 | !exists(Foo::new). |
201 | scope Foo = 2. | 208 | scope Foo = 2. |
202 | """, """ | 209 | """, """ |
210 | declare foo1, foo2. | ||
203 | !exists(a). | 211 | !exists(a). |
204 | !exists(Foo::new). | 212 | !exists(Foo::new). |
205 | Foo(foo1). | 213 | Foo(foo1). |
206 | Foo(foo2). | 214 | Foo(foo2). |
207 | """), Arguments.of(""" | 215 | """), Arguments.of(""" |
208 | node a. | 216 | declare a. |
209 | class Foo. | 217 | class Foo. |
210 | """, """ | 218 | """, """ |
211 | Foo(a). | 219 | Foo(a). |
212 | ?exists(a). | 220 | ?exists(a). |
213 | scope Foo = 2, Foo += 1. | 221 | scope Foo = 2, Foo += 1. |
214 | """, """ | 222 | """, """ |
223 | declare foo1. | ||
215 | !exists(Foo::new). | 224 | !exists(Foo::new). |
216 | Foo(a). | 225 | Foo(a). |
217 | Foo(foo1). | 226 | Foo(foo1). |
218 | """), Arguments.of(""" | 227 | """), Arguments.of(""" |
219 | node a. | 228 | declare a. |
220 | class Foo. | 229 | class Foo. |
221 | """, """ | 230 | """, """ |
222 | Foo(a). | 231 | Foo(a). |
223 | ?exists(a). | 232 | ?exists(a). |
224 | scope Foo = 1, Foo += 1. | 233 | scope Foo = 1, Foo += 1. |
225 | """, """ | 234 | """, """ |
235 | declare foo1. | ||
226 | !exists(a). | 236 | !exists(a). |
227 | !exists(Foo::new). | 237 | !exists(Foo::new). |
228 | Foo(foo1). | 238 | Foo(foo1). |