Skip to content

Afaq dev branch #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Code Quality Workflow

on:
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
continue-on-error:true
- name: Run code linters
run: |
flake8 --ignore=E501 .
pylint --fail-under=8 .
continue-on-error:true
- name: Run tests
run: pytest tests/
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
|ScreenShot|

pyGameMath |Build Status| |Code Health| |Codacy Badge|
======================================================
====================================================

| This is a math library written in python for 2D/3D game development
| This is a math library written in python for 2D/3D game development c klfkjfjk
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. Test cases edit.

Dependencies:
-------------
Expand Down Expand Up @@ -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
:target: https://www.codacy.com
2 changes: 1 addition & 1 deletion gem/vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
57 changes: 57 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
@@ -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