[PATCH] Implement D3DXVecLenghtSq with a test
David Adam
David.Adam at math.cnrs.fr
Fri Oct 5 13:32:35 CDT 2007
---
Makefile.in | 1 +
configure | 2 ++
dlls/d3dx8/Makefile.in | 3 ++-
dlls/d3dx8/d3dx8.spec | 1 +
dlls/d3dx8/math.c | 33 +++++++++++++++++++++++++++++++++
dlls/d3dx8/tests/Makefile.in | 13 +++++++++++++
dlls/d3dx8/tests/math.c | 41 +++++++++++++++++++++++++++++++++++++++=
++
7 files changed, 93 insertions(+), 1 deletions(-)
create mode 100644 dlls/d3dx8/math.c
create mode 100644 dlls/d3dx8/tests/Makefile.in
create mode 100644 dlls/d3dx8/tests/math.c
diff --git a/Makefile.in b/Makefile.in
index a977a55..fa20db6 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -198,6 +198,7 @@ ALL_MAKEFILES =3D \
=09dlls/d3drm/Makefile \
=09dlls/d3drm/tests/Makefile \
=09dlls/d3dx8/Makefile \
+=09dlls/d3dx8/tests/Makefile \
=09dlls/d3dxof/Makefile \
=09dlls/dbghelp/Makefile \
=09dlls/dciman32/Makefile \
diff --git a/configure b/configure
index e9a92da..fb8e789 100755
--- a/configure
+++ b/configure
@@ -20352,6 +20352,8 @@ ac_config_files=3D"$ac_config_files dlls/d3drm/tests=
/Makefile"
=20
ac_config_files=3D"$ac_config_files dlls/d3dx8/Makefile"
=20
+ac_config_files=3D"$ac_config_files dlls/d3dx8/tests/Makefile"
+
ac_config_files=3D"$ac_config_files dlls/d3dxof/Makefile"
=20
ac_config_files=3D"$ac_config_files dlls/dbghelp/Makefile"
diff --git a/dlls/d3dx8/Makefile.in b/dlls/d3dx8/Makefile.in
index f8159bb..800bb54 100644
--- a/dlls/d3dx8/Makefile.in
+++ b/dlls/d3dx8/Makefile.in
@@ -9,7 +9,8 @@ EXTRALIBS =3D -ldxguid -luuid
=20
C_SRCS =3D \
=09d3dx8_main.c \
-=09d3dxbuffer.c
+=09d3dxbuffer.c \
+=09math.c
=20
@MAKE_DLL_RULES@
=20
diff --git a/dlls/d3dx8/d3dx8.spec b/dlls/d3dx8/d3dx8.spec
index 3293614..325d0a5 100644
--- a/dlls/d3dx8/d3dx8.spec
+++ b/dlls/d3dx8/d3dx8.spec
@@ -1,4 +1,5 @@
@ stub D3DXVec2Normalize
+@ stdcall D3DXVec2LengthSq(ptr)
@ stub D3DXVec2Hermite
@ stub D3DXVec2CatmullRom
@ stub D3DXVec2BaryCentric
diff --git a/dlls/d3dx8/math.c b/dlls/d3dx8/math.c
new file mode 100644
index 0000000..0b456e3
--- /dev/null
+++ b/dlls/d3dx8/math.c
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2007 David Adam
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, US=
A
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <assert.h>
+#include "windef.h"
+#include "winbase.h"
+#include "wingdi.h"
+#include "d3dx8.h"
+
+#include "wine/debug.h"
+
+FLOAT D3DXVec2LengthSq(CONST LPD3DXVECTOR2 pv)
+{
+ return (pv->x)*(pv->x)+(pv->y)*(pv->y);
+}
diff --git a/dlls/d3dx8/tests/Makefile.in b/dlls/d3dx8/tests/Makefile.in
new file mode 100644
index 0000000..b0f9fee
--- /dev/null
+++ b/dlls/d3dx8/tests/Makefile.in
@@ -0,0 +1,13 @@
+TOPSRCDIR =3D @top_srcdir@
+TOPOBJDIR =3D ../../..
+SRCDIR =3D @srcdir@
+VPATH =3D @srcdir@
+TESTDLL =3D d3dx8.dll
+IMPORTS =3D kernel32 d3dx8
+EXTRALIBS =3D -ldxguid
+
+CTESTS =3D math.c
+
+ at MAKE_TEST_RULES@
+
+ at DEPENDENCIES@ # everything below this line is overwritten by make depend
diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c
new file mode 100644
index 0000000..8e03ae9
--- /dev/null
+++ b/dlls/d3dx8/tests/math.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2007 David Adam
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, US=
A
+*/
+
+#include <assert.h>
+#include "d3dx8.h"
+#include "wine/test.h"
+#include "d3dx8math.h"
+#define admitted_error 0.000001f
+
+static void Vector2Test(void)
+{
+ D3DXVECTOR2 u;
+ FLOAT long2;
+
+ u.x=3D3.0f; u.y=3D4.0f;
+
+/*__________________Vect2LengthSq_______________________*/
+ long2=3DD3DXVec2LengthSq(&u);
+ ok((long2 =3D=3D 25.0f), "Expected 25.0f, Got %f\n", long2);
+}
+
+START_TEST(math)
+{
+ Vector2Test();
+}
+
--=20
1.5.2.4
--=_5rxr737yq000--
More information about the wine-patches
mailing list