@@ -39,33 +39,30 @@ mod anchors {
3939 Ok ( ( ) )
4040 } ) ;
4141
42- atomically ( |t| {
43- // Node merges
44- assert ! ( storage. merge( t, 1 , 1 , 2 ) . is_ok( ) ) ;
45- assert ! ( storage. read( t, 1 ) ?. is_some( ) ) ;
46- assert ! ( storage. read( t, 2 ) ?. is_none( ) ) ;
47- assert ! ( storage. merge( t, 1 , 1 , 3 ) . is_err( ) ) ;
48- assert ! ( storage. read( t, 3 ) ?. is_some( ) ) ;
49- // Curve merges
50- assert ! ( storage. merge( t, 4 , 4 , 5 ) . is_ok( ) ) ;
51- assert ! ( storage. read( t, 4 ) ?. is_some( ) ) ;
52- assert ! ( storage. read( t, 5 ) ?. is_none( ) ) ;
53- assert ! ( storage. merge( t, 6 , 4 , 6 ) . is_err( ) ) ;
54- assert ! ( storage. read( t, 6 ) ?. is_some( ) ) ;
55- // Surface merges
56- assert ! ( storage. merge( t, 7 , 7 , 8 ) . is_ok( ) ) ;
57- assert ! ( storage. read( t, 7 ) ?. is_some( ) ) ;
58- assert ! ( storage. read( t, 8 ) ?. is_none( ) ) ;
59- assert ! ( storage. merge( t, 7 , 7 , 9 ) . is_err( ) ) ;
60- assert ! ( storage. read( t, 9 ) ?. is_some( ) ) ;
61- // Body merges
62- assert ! ( storage. merge( t, 11 , 12 , 11 ) . is_ok( ) ) ;
63- assert ! ( storage. read( t, 11 ) ?. is_some( ) ) ;
64- assert ! ( storage. read( t, 12 ) ?. is_none( ) ) ;
65- assert ! ( storage. merge( t, 10 , 10 , 11 ) . is_err( ) ) ;
66- assert ! ( storage. read( t, 11 ) ?. is_some( ) ) ;
67- Ok ( ( ) )
68- } ) ;
42+ // Node merges
43+ assert ! ( atomically_with_err( |t| storage. merge( t, 1 , 1 , 2 ) ) . is_ok( ) ) ;
44+ assert ! ( atomically( |t| storage. read( t, 1 ) ) . is_some( ) ) ;
45+ assert ! ( atomically( |t| storage. read( t, 2 ) ) . is_none( ) ) ;
46+ assert ! ( atomically_with_err( |t| storage. merge( t, 1 , 1 , 3 ) ) . is_err( ) ) ;
47+ assert ! ( atomically( |t| storage. read( t, 3 ) ) . is_some( ) ) ;
48+ // Curve merges
49+ assert ! ( atomically_with_err( |t| storage. merge( t, 4 , 4 , 5 ) ) . is_ok( ) ) ;
50+ assert ! ( atomically( |t| storage. read( t, 4 ) ) . is_some( ) ) ;
51+ assert ! ( atomically( |t| storage. read( t, 5 ) ) . is_none( ) ) ;
52+ assert ! ( atomically_with_err( |t| storage. merge( t, 6 , 4 , 6 ) ) . is_err( ) ) ;
53+ assert ! ( atomically( |t| storage. read( t, 6 ) ) . is_some( ) ) ;
54+ // Surface merges
55+ assert ! ( atomically_with_err( |t| storage. merge( t, 7 , 7 , 8 ) ) . is_ok( ) ) ;
56+ assert ! ( atomically( |t| storage. read( t, 7 ) ) . is_some( ) ) ;
57+ assert ! ( atomically( |t| storage. read( t, 8 ) ) . is_none( ) ) ;
58+ assert ! ( atomically_with_err( |t| storage. merge( t, 7 , 7 , 9 ) ) . is_err( ) ) ;
59+ assert ! ( atomically( |t| storage. read( t, 9 ) ) . is_some( ) ) ;
60+ // Body merges
61+ assert ! ( atomically_with_err( |t| storage. merge( t, 11 , 12 , 11 ) ) . is_ok( ) ) ;
62+ assert ! ( atomically( |t| storage. read( t, 11 ) ) . is_some( ) ) ;
63+ assert ! ( atomically( |t| storage. read( t, 12 ) ) . is_none( ) ) ;
64+ assert ! ( atomically_with_err( |t| storage. merge( t, 10 , 10 , 11 ) ) . is_err( ) ) ;
65+ assert ! ( atomically( |t| storage. read( t, 11 ) ) . is_some( ) ) ;
6966 }
7067
7168 #[ test]
@@ -85,61 +82,23 @@ mod anchors {
8582 Ok ( ( ) )
8683 } ) ;
8784
88- atomically ( |t| {
89- assert ! ( storage. merge( t, 3 , 4 , 3 ) . is_ok( ) ) ;
90- assert ! (
91- storage
92- . read( t, 3 ) ?
93- . is_some_and( |v| v == VertexAnchor :: Surface ( 3 ) )
94- ) ;
95- assert ! ( storage. merge( t, 2 , 3 , 2 ) . is_ok( ) ) ;
96- assert ! (
97- storage
98- . read( t, 2 ) ?
99- . is_some_and( |v| v == VertexAnchor :: Curve ( 2 ) )
100- ) ;
101- assert ! ( storage. merge( t, 1 , 2 , 1 ) . is_ok( ) ) ;
102- assert ! (
103- storage
104- . read( t, 1 ) ?
105- . is_some_and( |v| v == VertexAnchor :: Node ( 1 ) )
106- ) ;
107- assert ! ( storage. merge( t, 5 , 1 , 5 ) . is_ok( ) ) ;
108- assert ! (
109- storage
110- . read( t, 5 ) ?
111- . is_some_and( |v| v == VertexAnchor :: Node ( 1 ) )
112- ) ;
113- Ok ( ( ) )
114- } ) ;
115-
116- atomically ( |t| {
117- assert ! ( storage. merge( t, 6 , 10 , 6 ) . is_ok( ) ) ;
118- assert ! (
119- storage
120- . read( t, 6 ) ?
121- . is_some_and( |v| v == VertexAnchor :: Node ( 10 ) )
122- ) ;
123- assert ! ( storage. merge( t, 8 , 8 , 9 ) . is_ok( ) ) ;
124- assert ! (
125- storage
126- . read( t, 8 ) ?
127- . is_some_and( |v| v == VertexAnchor :: Surface ( 8 ) )
128- ) ;
129- assert ! ( storage. merge( t, 7 , 7 , 8 ) . is_ok( ) ) ;
130- assert ! (
131- storage
132- . read( t, 7 ) ?
133- . is_some_and( |v| v == VertexAnchor :: Curve ( 9 ) )
134- ) ;
135- assert ! ( storage. merge( t, 6 , 6 , 7 ) . is_ok( ) ) ;
136- assert ! (
137- storage
138- . read( t, 6 ) ?
139- . is_some_and( |v| v == VertexAnchor :: Node ( 10 ) )
140- ) ;
141- Ok ( ( ) )
142- } ) ;
85+ assert ! ( atomically_with_err( |t| storage. merge( t, 3 , 4 , 3 ) ) . is_ok( ) ) ;
86+ assert ! ( atomically( |t| storage. read( t, 3 ) ) . is_some_and( |v| v == VertexAnchor :: Surface ( 3 ) ) ) ;
87+ assert ! ( atomically_with_err( |t| storage. merge( t, 2 , 3 , 2 ) ) . is_ok( ) ) ;
88+ assert ! ( atomically( |t| storage. read( t, 2 ) ) . is_some_and( |v| v == VertexAnchor :: Curve ( 2 ) ) ) ;
89+ assert ! ( atomically_with_err( |t| storage. merge( t, 1 , 2 , 1 ) ) . is_ok( ) ) ;
90+ assert ! ( atomically( |t| storage. read( t, 1 ) ) . is_some_and( |v| v == VertexAnchor :: Node ( 1 ) ) ) ;
91+ assert ! ( atomically_with_err( |t| storage. merge( t, 5 , 1 , 5 ) ) . is_ok( ) ) ;
92+ assert ! ( atomically( |t| storage. read( t, 5 ) ) . is_some_and( |v| v == VertexAnchor :: Node ( 1 ) ) ) ;
93+
94+ assert ! ( atomically_with_err( |t| storage. merge( t, 6 , 10 , 6 ) ) . is_ok( ) ) ;
95+ assert ! ( atomically( |t| storage. read( t, 6 ) ) . is_some_and( |v| v == VertexAnchor :: Node ( 10 ) ) ) ;
96+ assert ! ( atomically_with_err( |t| storage. merge( t, 8 , 8 , 9 ) ) . is_ok( ) ) ;
97+ assert ! ( atomically( |t| storage. read( t, 8 ) ) . is_some_and( |v| v == VertexAnchor :: Surface ( 8 ) ) ) ;
98+ assert ! ( atomically_with_err( |t| storage. merge( t, 7 , 7 , 8 ) ) . is_ok( ) ) ;
99+ assert ! ( atomically( |t| storage. read( t, 7 ) ) . is_some_and( |v| v == VertexAnchor :: Curve ( 9 ) ) ) ;
100+ assert ! ( atomically_with_err( |t| storage. merge( t, 6 , 6 , 7 ) ) . is_ok( ) ) ;
101+ assert ! ( atomically( |t| storage. read( t, 6 ) ) . is_some_and( |v| v == VertexAnchor :: Node ( 10 ) ) ) ;
143102 }
144103
145104 #[ test]
@@ -158,27 +117,24 @@ mod anchors {
158117 Ok ( ( ) )
159118 } ) ;
160119
161- atomically ( |t| {
162- // Curve merges
163- assert ! ( storage. merge( t, 4 , 4 , 5 ) . is_ok( ) ) ;
164- assert ! ( storage. read( t, 4 ) ?. is_some( ) ) ;
165- assert ! ( storage. read( t, 5 ) ?. is_none( ) ) ;
166- assert ! ( storage. merge( t, 6 , 4 , 6 ) . is_err( ) ) ;
167- assert ! ( storage. read( t, 6 ) ?. is_some( ) ) ;
168- // Surface merges
169- assert ! ( storage. merge( t, 7 , 7 , 8 ) . is_ok( ) ) ;
170- assert ! ( storage. read( t, 7 ) ?. is_some( ) ) ;
171- assert ! ( storage. read( t, 8 ) ?. is_none( ) ) ;
172- assert ! ( storage. merge( t, 7 , 7 , 9 ) . is_err( ) ) ;
173- assert ! ( storage. read( t, 9 ) ?. is_some( ) ) ;
174- // Body merges
175- assert ! ( storage. merge( t, 11 , 12 , 11 ) . is_ok( ) ) ;
176- assert ! ( storage. read( t, 11 ) ?. is_some( ) ) ;
177- assert ! ( storage. read( t, 12 ) ?. is_none( ) ) ;
178- assert ! ( storage. merge( t, 10 , 10 , 11 ) . is_err( ) ) ;
179- assert ! ( storage. read( t, 11 ) ?. is_some( ) ) ;
180- Ok ( ( ) )
181- } ) ;
120+ // Curve merges
121+ assert ! ( atomically_with_err( |t| storage. merge( t, 4 , 4 , 5 ) ) . is_ok( ) ) ;
122+ assert ! ( atomically( |t| storage. read( t, 4 ) ) . is_some( ) ) ;
123+ assert ! ( atomically( |t| storage. read( t, 5 ) ) . is_none( ) ) ;
124+ assert ! ( atomically_with_err( |t| storage. merge( t, 6 , 4 , 6 ) ) . is_err( ) ) ;
125+ assert ! ( atomically( |t| storage. read( t, 6 ) ) . is_some( ) ) ;
126+ // Surface merges
127+ assert ! ( atomically_with_err( |t| storage. merge( t, 7 , 7 , 8 ) ) . is_ok( ) ) ;
128+ assert ! ( atomically( |t| storage. read( t, 7 ) ) . is_some( ) ) ;
129+ assert ! ( atomically( |t| storage. read( t, 8 ) ) . is_none( ) ) ;
130+ assert ! ( atomically_with_err( |t| storage. merge( t, 7 , 7 , 9 ) ) . is_err( ) ) ;
131+ assert ! ( atomically( |t| storage. read( t, 9 ) ) . is_some( ) ) ;
132+ // Body merges
133+ assert ! ( atomically_with_err( |t| storage. merge( t, 11 , 12 , 11 ) ) . is_ok( ) ) ;
134+ assert ! ( atomically( |t| storage. read( t, 11 ) ) . is_some( ) ) ;
135+ assert ! ( atomically( |t| storage. read( t, 12 ) ) . is_none( ) ) ;
136+ assert ! ( atomically_with_err( |t| storage. merge( t, 10 , 10 , 11 ) ) . is_err( ) ) ;
137+ assert ! ( atomically( |t| storage. read( t, 11 ) ) . is_some( ) ) ;
182138 }
183139
184140 #[ test]
@@ -196,49 +152,19 @@ mod anchors {
196152 Ok ( ( ) )
197153 } ) ;
198154
199- atomically ( |t| {
200- assert ! ( storage. merge( t, 3 , 4 , 3 ) . is_ok( ) ) ;
201- assert ! (
202- storage
203- . read( t, 3 ) ?
204- . is_some_and( |v| v == EdgeAnchor :: Surface ( 3 ) )
205- ) ;
206- assert ! ( storage. merge( t, 2 , 3 , 2 ) . is_ok( ) ) ;
207- assert ! (
208- storage
209- . read( t, 2 ) ?
210- . is_some_and( |v| v == EdgeAnchor :: Curve ( 2 ) )
211- ) ;
212- assert ! ( storage. merge( t, 5 , 2 , 5 ) . is_ok( ) ) ;
213- assert ! (
214- storage
215- . read( t, 5 ) ?
216- . is_some_and( |v| v == EdgeAnchor :: Curve ( 2 ) )
217- ) ;
218- Ok ( ( ) )
219- } ) ;
220-
221- atomically ( |t| {
222- assert ! ( storage. merge( t, 8 , 8 , 9 ) . is_ok( ) ) ;
223- assert ! (
224- storage
225- . read( t, 8 ) ?
226- . is_some_and( |v| v == EdgeAnchor :: Surface ( 8 ) )
227- ) ;
228- assert ! ( storage. merge( t, 7 , 7 , 8 ) . is_ok( ) ) ;
229- assert ! (
230- storage
231- . read( t, 7 ) ?
232- . is_some_and( |v| v == EdgeAnchor :: Curve ( 9 ) )
233- ) ;
234- assert ! ( storage. merge( t, 10 , 10 , 7 ) . is_ok( ) ) ;
235- assert ! (
236- storage
237- . read( t, 10 ) ?
238- . is_some_and( |v| v == EdgeAnchor :: Curve ( 9 ) )
239- ) ;
240- Ok ( ( ) )
241- } ) ;
155+ assert ! ( atomically_with_err( |t| storage. merge( t, 3 , 4 , 3 ) ) . is_ok( ) ) ;
156+ assert ! ( atomically( |t| storage. read( t, 3 ) ) . is_some_and( |v| v == EdgeAnchor :: Surface ( 3 ) ) ) ;
157+ assert ! ( atomically_with_err( |t| storage. merge( t, 2 , 3 , 2 ) ) . is_ok( ) ) ;
158+ assert ! ( atomically( |t| storage. read( t, 2 ) ) . is_some_and( |v| v == EdgeAnchor :: Curve ( 2 ) ) ) ;
159+ assert ! ( atomically_with_err( |t| storage. merge( t, 5 , 2 , 5 ) ) . is_ok( ) ) ;
160+ assert ! ( atomically( |t| storage. read( t, 5 ) ) . is_some_and( |v| v == EdgeAnchor :: Curve ( 2 ) ) ) ;
161+
162+ assert ! ( atomically_with_err( |t| storage. merge( t, 8 , 8 , 9 ) ) . is_ok( ) ) ;
163+ assert ! ( atomically( |t| storage. read( t, 8 ) ) . is_some_and( |v| v == EdgeAnchor :: Surface ( 8 ) ) ) ;
164+ assert ! ( atomically_with_err( |t| storage. merge( t, 7 , 7 , 8 ) ) . is_ok( ) ) ;
165+ assert ! ( atomically( |t| storage. read( t, 7 ) ) . is_some_and( |v| v == EdgeAnchor :: Curve ( 9 ) ) ) ;
166+ assert ! ( atomically_with_err( |t| storage. merge( t, 10 , 10 , 7 ) ) . is_ok( ) ) ;
167+ assert ! ( atomically( |t| storage. read( t, 10 ) ) . is_some_and( |v| v == EdgeAnchor :: Curve ( 9 ) ) ) ;
242168 }
243169
244170 #[ test]
@@ -254,21 +180,18 @@ mod anchors {
254180 Ok ( ( ) )
255181 } ) ;
256182
257- atomically ( |t| {
258- // Surface merges
259- assert ! ( storage. merge( t, 7 , 7 , 8 ) . is_ok( ) ) ;
260- assert ! ( storage. read( t, 7 ) ?. is_some( ) ) ;
261- assert ! ( storage. read( t, 8 ) ?. is_none( ) ) ;
262- assert ! ( storage. merge( t, 7 , 7 , 9 ) . is_err( ) ) ;
263- assert ! ( storage. read( t, 9 ) ?. is_some( ) ) ;
264- // Body merges
265- assert ! ( storage. merge( t, 11 , 12 , 11 ) . is_ok( ) ) ;
266- assert ! ( storage. read( t, 11 ) ?. is_some( ) ) ;
267- assert ! ( storage. read( t, 12 ) ?. is_none( ) ) ;
268- assert ! ( storage. merge( t, 10 , 10 , 11 ) . is_err( ) ) ;
269- assert ! ( storage. read( t, 11 ) ?. is_some( ) ) ;
270- Ok ( ( ) )
271- } ) ;
183+ // Surface merges
184+ assert ! ( atomically_with_err( |t| storage. merge( t, 7 , 7 , 8 ) ) . is_ok( ) ) ;
185+ assert ! ( atomically( |t| storage. read( t, 7 ) ) . is_some( ) ) ;
186+ assert ! ( atomically( |t| storage. read( t, 8 ) ) . is_none( ) ) ;
187+ assert ! ( atomically_with_err( |t| storage. merge( t, 7 , 7 , 9 ) ) . is_err( ) ) ;
188+ assert ! ( atomically( |t| storage. read( t, 9 ) ) . is_some( ) ) ;
189+ // Body merges
190+ assert ! ( atomically_with_err( |t| storage. merge( t, 11 , 12 , 11 ) ) . is_ok( ) ) ;
191+ assert ! ( atomically( |t| storage. read( t, 11 ) ) . is_some( ) ) ;
192+ assert ! ( atomically( |t| storage. read( t, 12 ) ) . is_none( ) ) ;
193+ assert ! ( atomically_with_err( |t| storage. merge( t, 10 , 10 , 11 ) ) . is_err( ) ) ;
194+ assert ! ( atomically( |t| storage. read( t, 11 ) ) . is_some( ) ) ;
272195 }
273196
274197 #[ test]
@@ -284,37 +207,15 @@ mod anchors {
284207 Ok ( ( ) )
285208 } ) ;
286209
287- atomically ( |t| {
288- assert ! ( storage. merge( t, 3 , 4 , 3 ) . is_ok( ) ) ;
289- assert ! (
290- storage
291- . read( t, 3 ) ?
292- . is_some_and( |v| v == FaceAnchor :: Surface ( 3 ) )
293- ) ;
294- assert ! ( storage. merge( t, 5 , 3 , 5 ) . is_ok( ) ) ;
295- assert ! (
296- storage
297- . read( t, 5 ) ?
298- . is_some_and( |v| v == FaceAnchor :: Surface ( 3 ) )
299- ) ;
300- Ok ( ( ) )
301- } ) ;
210+ assert ! ( atomically_with_err( |t| storage. merge( t, 3 , 4 , 3 ) ) . is_ok( ) ) ;
211+ assert ! ( atomically( |t| storage. read( t, 3 ) ) . is_some_and( |v| v == FaceAnchor :: Surface ( 3 ) ) ) ;
212+ assert ! ( atomically_with_err( |t| storage. merge( t, 5 , 3 , 5 ) ) . is_ok( ) ) ;
213+ assert ! ( atomically( |t| storage. read( t, 5 ) ) . is_some_and( |v| v == FaceAnchor :: Surface ( 3 ) ) ) ;
302214
303- atomically ( |t| {
304- assert ! ( storage. merge( t, 8 , 8 , 9 ) . is_ok( ) ) ;
305- assert ! (
306- storage
307- . read( t, 8 ) ?
308- . is_some_and( |v| v == FaceAnchor :: Surface ( 8 ) )
309- ) ;
310- assert ! ( storage. merge( t, 10 , 10 , 8 ) . is_ok( ) ) ;
311- assert ! (
312- storage
313- . read( t, 10 ) ?
314- . is_some_and( |v| v == FaceAnchor :: Surface ( 8 ) )
315- ) ;
316- Ok ( ( ) )
317- } ) ;
215+ assert ! ( atomically_with_err( |t| storage. merge( t, 8 , 8 , 9 ) ) . is_ok( ) ) ;
216+ assert ! ( atomically( |t| storage. read( t, 8 ) ) . is_some_and( |v| v == FaceAnchor :: Surface ( 8 ) ) ) ;
217+ assert ! ( atomically_with_err( |t| storage. merge( t, 10 , 10 , 8 ) ) . is_ok( ) ) ;
218+ assert ! ( atomically( |t| storage. read( t, 10 ) ) . is_some_and( |v| v == FaceAnchor :: Surface ( 8 ) ) ) ;
318219 }
319220
320221 #[ test]
0 commit comments