mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
20
test/unit/regression/lenof.c3
Normal file
20
test/unit/regression/lenof.c3
Normal file
@@ -0,0 +1,20 @@
|
||||
module regression;
|
||||
import std;
|
||||
|
||||
|
||||
fn void lenof_test() @test
|
||||
{
|
||||
List{int} l;
|
||||
l.push(123);
|
||||
l.push(222);
|
||||
l.push(111);
|
||||
test::eq(lenof(l), 3);
|
||||
int[] x = { 1, 2 };
|
||||
test::eq(lenof(x), 2);
|
||||
l.push(111);
|
||||
test::eq(lenof(l), 4);
|
||||
assert(!$defined(lenof(1)));
|
||||
assert($defined(lenof(x)));
|
||||
int* zz;
|
||||
assert(!$defined(lenof(zz)));
|
||||
}
|
||||
Reference in New Issue
Block a user