@@ -281,17 +281,34 @@ end
281
281
282
282
@testset " Arrays using vanilla-@variable syntax" begin
283
283
@mtkmodel TupleInArrayDef begin
284
+ @structural_parameters begin
285
+ N
286
+ M
287
+ end
284
288
@parameters begin
285
289
(l (t)[1 : 2 , 1 : 3 ] = 1 ), [description = " l is more than 1D" ]
286
- (l2 (t)[1 : 3 ] = 2 ), [description = " l2 is 1D" ]
287
- (l3 (t)[1 : 3 ]:: Int = 3 ), [description = " l3 is 1D and has a type" ]
290
+ (l2 (t)[1 : N, 1 : M] = 2 ),
291
+ [description = " l is more than 1D, with arbitrary length" ]
292
+ (l3 (t)[1 : 3 ] = 3 ), [description = " l2 is 1D" ]
293
+ (l4 (t)[1 : N] = 4 ), [description = " l2 is 1D, with arbitrary length" ]
294
+ (l5 (t)[1 : 3 ]:: Int = 5 ), [description = " l3 is 1D and has a type" ]
295
+ (l6 (t)[1 : N]:: Int = 6 ),
296
+ [description = " l3 is 1D and has a type, with arbitrary length" ]
288
297
end
289
298
end
290
299
291
- @named arr = TupleInArrayDef ()
300
+ N, M = 4 , 5
301
+ @named arr = TupleInArrayDef (; N, M)
292
302
@test getdefault (arr. l) == 1
293
303
@test getdefault (arr. l2) == 2
294
304
@test getdefault (arr. l3) == 3
305
+ @test getdefault (arr. l4) == 4
306
+ @test getdefault (arr. l5) == 5
307
+ @test getdefault (arr. l6) == 6
308
+
309
+ @test size (arr. l2) == (N, M)
310
+ @test size (arr. l4) == (N,)
311
+ @test size (arr. l6) == (N,)
295
312
end
296
313
297
314
@testset " Type annotation" begin
0 commit comments