From bd5d9f99289c319942ad188d8ad43c4e62fee7ba Mon Sep 17 00:00:00 2001 From: AfaqQureshi007 <106330573+AfaqQureshi007@users.noreply.github.com> Date: Fri, 24 Feb 2023 07:54:55 +0500 Subject: [PATCH 1/6] added testcases added testcases and resolve one != issue --- gem/vector.py | 2 +- test.py | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 test.py diff --git a/gem/vector.py b/gem/vector.py index cdfea44..c22c0cb 100644 --- a/gem/vector.py +++ b/gem/vector.py @@ -111,7 +111,7 @@ def magnitude(size, vecA): def normalize(size, vecA): length = magnitude(size, vecA) temp = zero_vector(size) - if length is not 0: + if length != 0: for i in sm.range(size): temp[i] = vecA[i] / length return temp diff --git a/test.py b/test.py new file mode 100644 index 0000000..c4cc58c --- /dev/null +++ b/test.py @@ -0,0 +1,57 @@ +import pytest +import math +from gem import matrix + + + + + + +def test_fun(): + b=[[0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0]] + assert matrix.zero_matrix(5)==b +def test_fun1(): + a=[[0.0, 0.0, 0.0], + [0.0, 0.0, 0.0], + [0.0, 0.0, 0.0]] + assert matrix.zero_matrix(3)==a +def test_fun2(): + a=[[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]] + assert matrix.zero_matrix(7)==a + + + + +def test_fun3(): + b=[[1.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 1.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 1.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 1.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 1.0]] + assert matrix.identity(5)==b +def test_fun4(): + b=[[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]] + assert matrix.identity(3)==b +def test_fun5(): + b=[[1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0]] + assert matrix.identity(7)==b + + + + From a19c00b44cb9e4511ab944678f17f762de450ec0 Mon Sep 17 00:00:00 2001 From: AfaqQureshi007 <106330573+AfaqQureshi007@users.noreply.github.com> Date: Fri, 24 Feb 2023 09:04:45 +0500 Subject: [PATCH 2/6] Update README.rst --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 8ec204a..9dd18fa 100644 --- a/README.rst +++ b/README.rst @@ -7,7 +7,7 @@ pyGameMath |Build Status| |Code Health| |Codacy Badge| which is also compatible with pypy. I made it while I was learning more about the math used in graphics development and for personal use in OpenGL related projects. -| It’s still a work in progress. +| It’s still a work in progress.Teat cases edit. Dependencies: ------------- @@ -137,4 +137,4 @@ Legendre Polynomial (Experimental, not complete): .. |Code Health| image:: https://landscape.io/github/explosiveduck/pyGameMath/master/landscape.svg?style=flat :target: https://landscape.io/github/explosiveduck/pyGameMath/master .. |Codacy Badge| image:: https://api.codacy.com/project/badge/907e4230379f40a8bedcfc0a9a0ed43c - :target: https://www.codacy.com \ No newline at end of file + :target: https://www.codacy.com From e2b0baa8edcfdf64bec60686bbed7d78d9842303 Mon Sep 17 00:00:00 2001 From: AfaqQureshi007 <106330573+AfaqQureshi007@users.noreply.github.com> Date: Fri, 24 Feb 2023 09:06:29 +0500 Subject: [PATCH 3/6] Update README.rst --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 9dd18fa..f4e7c7c 100644 --- a/README.rst +++ b/README.rst @@ -7,7 +7,7 @@ pyGameMath |Build Status| |Code Health| |Codacy Badge| which is also compatible with pypy. I made it while I was learning more about the math used in graphics development and for personal use in OpenGL related projects. -| It’s still a work in progress.Teat cases edit. +| It’s still a work in progress. Test cases edit. Dependencies: ------------- From 38bba5b894a40055d07d3d57e3d7832d29bb72ea Mon Sep 17 00:00:00 2001 From: nnoman-asif <122397862+nnoman-asif@users.noreply.github.com> Date: Fri, 24 Feb 2023 12:07:24 +0500 Subject: [PATCH 4/6] Add files via upload --- test_noman.py | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 test_noman.py diff --git a/test_noman.py b/test_noman.py new file mode 100644 index 0000000..100a9f0 --- /dev/null +++ b/test_noman.py @@ -0,0 +1,48 @@ +import pytest +from gem import matrix + + + + +def test_function(): + b=[[1.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 1.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 1.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 1.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 1.0]] + a=matrix.identity(5) + + assert matrix.transpose(a)==b +def test_function1(): + b=[[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]] + a=matrix.identity(3) + + assert matrix.transpose(a)==b +def test_function2(): + b=[[1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0]] + a=matrix.identity(7) + + assert matrix.transpose(a)==b + + + + + +def test_function3(): + + a=matrix.identity(3) + + assert matrix.inverse3(a)==a +def test_function5(): + + a=matrix.identity(4) + + assert matrix.inverse4(a)==a + + \ No newline at end of file From ebb6d6162479bc13fdf11be02befac1636818fdf Mon Sep 17 00:00:00 2001 From: AfaqQureshi007 <106330573+AfaqQureshi007@users.noreply.github.com> Date: Tue, 28 Feb 2023 05:26:29 +0500 Subject: [PATCH 5/6] Update README.rst --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index f4e7c7c..1e9b4af 100644 --- a/README.rst +++ b/README.rst @@ -1,7 +1,7 @@ |ScreenShot| pyGameMath |Build Status| |Code Health| |Codacy Badge| -====================================================== +===================================================== | This is a math library written in python for 2D/3D game development which is also compatible with pypy. I made it while I was learning From 2a78b9067ab684a2cef1fe6967352a0923d33bc6 Mon Sep 17 00:00:00 2001 From: AfaqQureshi007 <106330573+AfaqQureshi007@users.noreply.github.com> Date: Tue, 28 Feb 2023 05:27:24 +0500 Subject: [PATCH 6/6] Update README.rst --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 1e9b4af..39f3beb 100644 --- a/README.rst +++ b/README.rst @@ -1,7 +1,7 @@ |ScreenShot| pyGameMath |Build Status| |Code Health| |Codacy Badge| -===================================================== +==================================================== | This is a math library written in python for 2D/3D game development which is also compatible with pypy. I made it while I was learning