mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 20:11:17 +00:00
- Remove `[?]` syntax. - Change `int!` to `int?` syntax. - New `fault` declarations. - Enum associated values can reference the calling enum.
31 lines
590 B
Plaintext
31 lines
590 B
Plaintext
module test @test;
|
|
|
|
fn void vector_array_inferred()
|
|
{
|
|
int[<2>] x = { 4, 7 };
|
|
int[2] y = x;
|
|
int[*] y1 = y;
|
|
int[*] y2 = x;
|
|
int[<*>] z = x;
|
|
int[<*>] w = y;
|
|
double[<2>] ww = x;
|
|
assert((int[<2>])y == { 4, 7});
|
|
assert((int[<2>])y1 == { 4, 7 });
|
|
assert((int[<2>])y2 == { 4, 7 });
|
|
assert(z == { 4, 7 });
|
|
assert(w == { 4, 7 });
|
|
}
|
|
|
|
fn void vector_convert_slice()
|
|
{
|
|
int[<2>] x = { 1, 2 };
|
|
int[2] y = { 4, 4 };
|
|
x *= y[:2];
|
|
assert(x == { 4, 8 });
|
|
}
|
|
fn void vector_convert_bool()
|
|
{
|
|
bool[<2>] a = { true, false };
|
|
assert({ -1, 0 } == (int[<2>])a);
|
|
assert({ 1.0, 0 } == (float[<2>])a);
|
|
} |