add some tests

This commit is contained in:
koniifer 2024-09-01 21:11:45 +01:00
parent 581c4d531c
commit 34f0c071a1
2 changed files with 34 additions and 0 deletions

View file

@ -558,3 +558,35 @@ main := fn(): int {
return 1 return 1
} }
``` ```
#### comptime_function_from_another_file
```hb
.{min} := @use("math.hb")
a := min(100, 50)
main := fn(): int {
return a
}
// in module: math.hb
SIZEOF_INT := 32
SHIFT := SIZEOF_INT - 1
min := fn(a: int, b: int): int {
c := a - b
return b + (c & c >> SHIFT)
}
```
#### using_structs_in_registers
```hb
ColorBGRA := struct {b: u8, g: u8, r: u8, a: u8}
MAGENTA := ColorBGRA.{b: 205, g: 0, r: 205, a: 255}
main := fn(): int {
color := MAGENTA
return color.r
}
```

View file

@ -3341,5 +3341,7 @@ mod tests {
comptime_pointers => README; comptime_pointers => README;
sort_something_viredly => README; sort_something_viredly => README;
hex_octal_binary_literals => README; hex_octal_binary_literals => README;
comptime_function_from_another_file => README;
using_structs_in_registers => README;
} }
} }