Add sizeof test

This commit is contained in:
2025-09-01 15:57:39 -04:00
parent 1be6175120
commit cf7d0320af

33
test/sizeof.w12 Normal file
View File

@@ -0,0 +1,33 @@
struct BigStruct {
name: [char],
number: int,
number2: int,
}
struct BiggerStruct {
character: char,
big: BigStruct,
}
struct SmallStruct {
value: int,
}
fn main() -> int {
printf("Size of int: %u\n", sizeof int);
printf("Size of uint: %u\n", sizeof uint);
printf("Size of float: %u\n", sizeof float);
printf("Size of [char]: %u\n", sizeof [char]);
printf("Size of [int]: %u\n", sizeof [int]);
printf("Size of bool: %u\n", sizeof bool);
printf("Size of int*: %u\n", sizeof int*);
printf("Size of bool*: %u\n", sizeof bool*);
printf("Size of BigStruct*: %u\n", sizeof BigStruct*);
printf("Size of SmallStruct*: %u\n", sizeof SmallStruct*);
printf("Size of BigStruct: %u\n", sizeof BigStruct);
printf("Size of BiggerStruct: %u\n", sizeof BiggerStruct);
printf("Size of SmallStruct: %u\n", sizeof SmallStruct);
return 0;
}