comparison test/funcptr.d @ 102:027b8d8b71ec trunk

[svn r106] Turns out the last commit wasn't enough, now the D->LLVM process is even more split up. Basically it tries to do the following in order: Resolve types, Declare symbols, Create constant initializers, Apply initializers, Generate functions bodies. ClassInfo is now has the most useful(biased?) members working. Probably other stuf...
author lindquist
date Sun, 18 Nov 2007 06:52:57 +0100
parents c53b6e3fe49a
children d9d5d59873d8
comparison
equal deleted inserted replaced
101:169fda3a77d4 102:027b8d8b71ec
40 int function() fn = &return_six; 40 int function() fn = &return_six;
41 assert(fn() == 6); 41 assert(fn() == 6);
42 42
43 binfn_t binfn = &add_int; 43 binfn_t binfn = &add_int;
44 assert(binfn(4,1045) == 1049); 44 assert(binfn(4,1045) == 1049);
45 45
46 assert(binop_int(binfn, 10,656) == 666); 46 assert(binop_int(binfn, 10,656) == 666);
47 47
48 binfn = get_binop_int('+'); 48 binfn = get_binop_int('+');
49 assert(binop_int(binfn, 10,100) == 110); 49 assert(binop_int(binfn, 10,100) == 110);
50 binfn = get_binop_int('-'); 50 binfn = get_binop_int('-');
51 assert(binop_int(binfn, 10,100) == -90); 51 assert(binop_int(binfn, 10,100) == -90);
52 52
53 { 53 {
54 auto ffn = &mul_float; 54 auto ffn = &mul_float;
55 float ftmp = mul_float(2.5,5); 55 float ftmp = mul_float(2.5,5);
56 assert(ftmp == 12.5); 56 assert(ftmp == 12.5);
57 assert(ftmp > 12.49 && ftmp < 12.51); 57 assert(ftmp > 12.49 && ftmp < 12.51);