Skip to content

Commit acea79a

Browse files
committed
Add rudimentary test for vect in 1.4
1 parent 4981462 commit acea79a

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

test/1.4/misc/T_vect.dml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
© 2025 Intel Corporation
3+
SPDX-License-Identifier: MPL-2.0
4+
*/
5+
dml 1.4;
6+
7+
provisional simics_util_vect;
8+
9+
device test;
10+
11+
import "internal.dml";
12+
13+
// Test the basic operations of vect types
14+
method test() throws {
15+
local int vect v;
16+
VINIT(v);
17+
VADD(v, 3);
18+
assert VLEN(v) == 1;
19+
assert VELEMSIZE(v) == sizeoftype(int);
20+
VRESIZE(v, 2);
21+
VRESIZE_FREE(v, 1);
22+
VADD(v, 4);
23+
VDELETE_ORDER(v, 0);
24+
assert VGET(v, 0) == 4;
25+
VREMOVE(v, 0);
26+
VADD(v, 5);
27+
VINSERT(v, 0, 6);
28+
VSETLAST(v, 7);
29+
assert VGET(v, 1) == 7;
30+
VGROW(v, 2);
31+
assert VLEN(v) == 4;
32+
VSHRINK(v, 2);
33+
VTRUNCATE(v, 1);
34+
assert VLEN(v) == 1;
35+
local int vect v2;
36+
VCOPY(v2, v1);
37+
VCLEAR(v2);
38+
assert VVEC(v1)[0] == 5;
39+
assert VLEN(v2) == 0;
40+
foreach i in (v) {
41+
assert i == 5;
42+
}
43+
VFREE(v);
44+
VFREE(v2);
45+
}

0 commit comments

Comments
 (0)