Mercurial > projects > dstress
diff run/o/opDiv_09_B.d @ 1602:56d43974b468
Fix broken tests fvbommel pointed out in #2.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Fri, 06 Mar 2009 15:48:16 +0100 |
parents | b8c0195059d9 |
children |
line wrap: on
line diff
--- a/run/o/opDiv_09_B.d Sun Jan 04 22:42:52 2009 +0100 +++ b/run/o/opDiv_09_B.d Fri Mar 06 15:48:16 2009 +0100 @@ -8,6 +8,15 @@ module dstress.run.o.opDiv_09_B; +bool isIdentical(real x, real y) +{ + long* x64 = cast(long*)&x; + long* y64 = cast(long*)&y; + ushort* x16 = cast(ushort*)&x + 4; + ushort* y16 = cast(ushort*)&y + 4; + return *x64 == *y64 && *x16 == *y16; +} + int main(){ real a = -1.0Li / 0.0Li; @@ -15,14 +24,9 @@ ireal c = 0.0Li; real d; - byte* X = cast(byte*) (cast(void*) &a); + d = b/c; - d = b/c; - byte* Y = cast(byte*) (cast(void*) &d); - - for(int i=0; i<a.sizeof; i++){ - assert(X[i]==Y[i]); - } + assert(isIdentical(a, d)); return 0; }