Commit d404ec8c authored by David Adam's avatar David Adam Committed by Alexandre Julliard

d3dx8: Implement D3DX8Vec2LengthSq with a test.

parent e4ba8eb4
......@@ -39,7 +39,19 @@ static void D3X8Vector2Test(void)
expected=0.0f;
got= D3DXVec2Length(NULL);
ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
/*_______________D3DXVec2LengthSq________________________*/
expected = 25.0f;
got = D3DXVec2LengthSq(&u);
ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
/* Tests the case NULL */
expected=0.0f;
got= D3DXVec2LengthSq(NULL);
ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
}
START_TEST(math)
{
D3X8Vector2Test();
......
......@@ -59,5 +59,6 @@ typedef struct D3DXCOLOR
} D3DXCOLOR, *LPD3DXCOLOR;
FLOAT D3DXVec2Length(CONST D3DXVECTOR2 *pv);
FLOAT D3DXVec2LengthSq(CONST D3DXVECTOR2 *pv);
#endif /* __D3DX8MATH_H__ */
......@@ -25,4 +25,10 @@ extern inline FLOAT D3DXVec2Length(CONST D3DXVECTOR2 *pv)
return sqrt( (pv->x) * (pv->x) + (pv->y) * (pv->y) );
}
extern inline FLOAT D3DXVec2LengthSq(CONST D3DXVECTOR2 *pv)
{
if (!pv) return 0.0f;
return( (pv->x) * (pv->x) + (pv->y) * (pv->y) );
}
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment