mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
20 lines
344 B
Plaintext
20 lines
344 B
Plaintext
module regression;
|
|
import std;
|
|
|
|
|
|
fn void lenof_test() @test
|
|
{
|
|
List{int} l;
|
|
l.push(123);
|
|
l.push(222);
|
|
l.push(111);
|
|
test::eq(lengthof(l), 3);
|
|
int[] x = { 1, 2 };
|
|
test::eq(lengthof(x), 2);
|
|
l.push(111);
|
|
test::eq(lengthof(l), 4);
|
|
assert(!$defined(lengthof(1)));
|
|
assert($defined(lengthof(x)));
|
|
int* zz;
|
|
assert(!$defined(lengthof(zz)));
|
|
} |