mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
24 lines
536 B
C
24 lines
536 B
C
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 == int[<2>]{ 4, 7});
|
|
assert((int[<2>])y1 == int[<2>] { 4, 7 });
|
|
assert((int[<2>])y2 == int[<2>] { 4, 7 });
|
|
assert(z == int[<2>] { 4, 7 });
|
|
assert(w == int[<2>] { 4, 7 });
|
|
}
|
|
|
|
fn void vector_convert_bool()
|
|
{
|
|
bool[<2>] a = { true, false };
|
|
assert(int[<2>] { -1, 0 } == (int[<2>])a);
|
|
assert(float[<2>] { 1.0, 0 } == (float[<2>])a);
|
|
} |