compiler.c

tmi2/v21.7a10/testsuite/single/efuns/compiler.c · 588 B

From the archive tmi2_mudos_v1.tar.gz

Download the archive   « Back to the archive contents

inherit "/inherit/tests";

int test(int which) {
    mixed *code;
    
    switch (which) {
    case 0:
	describe_test("array constant optimizations: sizeof");
	code = __TREE__ ( sizeof( ({ 1, 3, 3 }) ) );
	return code[0] == "number" && code[1] == 3;
    case 1:
	describe_test("array constant optimizations: index");
	code = __TREE__ ( ({ 1, 3, 3 })[0] );
	return code[0] == "number" && code[1] == 1;
    case 2:
	describe_test("array constant optimizations: rindex");
	code = __TREE__ ( ({ 1, 3, 3 })[<2] );
	return code[0] == "number" && code[1] == 1;
    default:
	return -1;
    }
}

Site Stats

Snippets: 1791
Codebases: 571