Init new repository

This commit is contained in:
Krzosa Karol
2024-04-13 15:29:53 +02:00
commit 5a2e3dcec4
335 changed files with 61571 additions and 0 deletions

33
tests/pointers.txt Normal file
View File

@@ -0,0 +1,33 @@
import "libc";
main :: proc(): int {
{
arr: [100]int = {1, 2 ,3 ,4};
p0 := addptr(arr, 1);
assert(*p0 == 2);
p1 := addptr(p0, 1);
assert(p1[0] == 3);
}
{
i: *int = :*int(1);
if i {
i = nil;
assert(i == 0);
}
}
{
token_count :: 20;
tokens: [token_count]int;
x: *int = addptr(tokens, 0);
t: *int = addptr(tokens, 4);
r1 := x && (t >= &tokens[0] && t < &tokens[token_count]);
r2 := x && (t >= addptr(tokens, 0) && t < addptr(tokens, token_count));
assert(r1 == true);
assert(r2 == true);
}
return 0;
}