Skip to content

Commit 0e1163f

Browse files
committed
Added test case for sizeof on values
1 parent 151c18f commit 0e1163f

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Diff for: tests/success/sizeof_value/main.adept

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
pragma => adept("3.0")
3+
4+
#[foreign]
5+
func printf(format ptr#char, ...) int
6+
7+
struct FullName (firstname ptr#char, lastname ptr#char)
8+
9+
func main {
10+
c := c'A'
11+
sh := 123.short()
12+
i_3_2 := 0
13+
14+
fullname := FullName {
15+
firstname: c"Isaac",
16+
lastname: c"Shelton",
17+
}
18+
19+
printf(c"sizeof#(c) = %d\n", sizeof#(c).int())
20+
printf(c"sizeof#(sh) = %d\n", sizeof#(sh).int())
21+
printf(c"sizeof#(i_3_2) = %d\n", sizeof#(i_3_2).int())
22+
printf(c"sizeof#(fullname) = %d\n", sizeof#(fullname).int())
23+
24+
// This syntax is also accepted
25+
printf(c"sizeof<(fullname)> = %d\n", sizeof<(fullname)>.int())
26+
printf(c"sizeof<(fullname.firstname)> = %d\n", sizeof<(fullname.firstname)>.int())
27+
printf(c"sizeof#(fullname.firstname.ptr()) = %d\n", sizeof#(fullname.firstname.ptr()).int())
28+
}
29+

0 commit comments

Comments
 (0)