Skip to content
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

Docstrings #96

Open
wants to merge 8 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
53,442 changes: 53,442 additions & 0 deletions Tests/CosmicRayResults.html

Large diffs are not rendered by default.

111 changes: 111 additions & 0 deletions Tests/Manual Pytest/ManualPytest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import pytest

from main import cube_vertices
from main import tex_coord
from main import Model
from main import normalize

m = Model()

#Test the verticies and bounds, why is this useful?
class mainTests():
position = (10,10,10)

assert normalize(position) == (10,10,10)
assert normalize(position) != (11,9,10)

position = (1,-1,100)

assert normalize(position) == (1,-1,100)
assert normalize(position) != (1,1,100)

#test that the cube is defined correctly
#x,y,z,n
#x-n,y+n,z-n, x-n,y+n,z+n, x+n,y+n,z+n, x+n,y+n,z-n, # top
#x-n,y-n,z-n, x+n,y-n,z-n, x+n,y-n,z+n, x-n,y-n,z+n, # bottom
#x-n,y-n,z-n, x-n,y-n,z+n, x-n,y+n,z+n, x-n,y+n,z-n, # left
#x+n,y-n,z+n, x+n,y-n,z-n, x+n,y+n,z-n, x+n,y+n,z+n, # right
#x-n,y-n,z+n, x+n,y-n,z+n, x+n,y+n,z+n, x-n,y+n,z+n, # front
#x+n,y-n,z-n, x-n,y-n,z-n, x-n,y+n,z-n, x+n,y+n,z-n, # back

assert cube_vertices(1,1,1,1) == [0, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0,
0, 0, 0, 2, 0, 0, 2, 0, 2, 0, 0, 2,
0, 0, 0, 0, 0, 2, 0, 2, 2, 0, 2, 0,
2, 0, 2, 2, 0, 0, 2, 2, 0, 2, 2, 2,
0, 0, 2, 2, 0, 2, 2, 2, 2, 0, 2, 2,
2, 0, 0, 0, 0, 0, 0, 2, 0, 2, 2, 0]
assert cube_vertices(1,0,0,1) != [0, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0,
0, 0, 0, 2, 0, 0, 2, 0, 2, 0, 0, 2,
0, 0, 0, 0, 0, 2, 0, 2, 2, 0, 2, 0,
2, 0, 2, 2, 0, 0, 2, 2, 0, 2, 2, 2,
0, 0, 2, 2, 0, 2, 2, 2, 2, 0, 2, 2,
2, 0, 0, 0, 0, 0, 0, 2, 0, 2, 2, 0]
assert cube_vertices(1,1,1,0) != [0, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0,
0, 0, 0, 2, 0, 0, 2, 0, 2, 0, 0, 2,
0, 0, 0, 0, 0, 2, 0, 2, 2, 0, 2, 0,
2, 0, 2, 2, 0, 0, 2, 2, 0, 2, 2, 2,
0, 0, 2, 2, 0, 2, 2, 2, 2, 0, 2, 2,
2, 0, 0, 0, 0, 0, 0, 2, 0, 2, 2, 0]

#dx, dy, dx + m, dy, dx + m, dy + m, dx, dy + m
#Test that bounds of the square are correct
assert tex_coord(1,1, n=4) == (.25, .25, .5, .25, .5, .5, .25, .5)
assert tex_coord(2,1, n=4) != (.25, .25, .5, .25, .5, .5, .25, .5)
assert tex_coord(1,2, n=4) != (.25, .25, .5, .25, .5, .5, .25, .5)
assert tex_coord(2,1, n=4) == (.5, .25, .75, .25, .75, .5, .5, .5)
assert tex_coord(8,2, n=4) != (.25, .25, .5, .25, .5, .5, .25, .5)
assert tex_coord(2,24, n=4) != (.5, .25, .75, .25, .75, .5, .5, .5)
assert tex_coord(1,1, n=4) != (1, 1, 2, 1, 2, 2, 1, 2)
assert tex_coord(3,2, n=4) == (.75, .5, 1, .5, 1, .75, .75, .75)
assert tex_coord(3,-2, n=4) == (.75, -.5, 1, -.5, 1, -.25, .75, -.25)
assert tex_coord(-3,-2, n=4) != (.75, -.5, 1, -.5, .1, -.25, .75, -.25)
assert tex_coord(8,8, n=4) != (2, 2, 2.25, 2, 2.25, 2.25, 2, 2.26)
assert tex_coord(8,8, n=4) == (2, 2, 2.25, 2, 2.25, 2.25, 2, 2.25)

position = (1,0,8)

assert normalize(position) == (1,0,8)
assert normalize(position) != (1,0,8.25)

position = (-.25,-1,12)

assert normalize(position) != (-.25,-1,12)
assert normalize(position) != (.25,1,1)
#x,y,z,n
#x-n,y+n,z-n, x-n,y+n,z+n, x+n,y+n,z+n, x+n,y+n,z-n, # top
#x-n,y-n,z-n, x+n,y-n,z-n, x+n,y-n,z+n, x-n,y-n,z+n, # bottom
#x-n,y-n,z-n, x-n,y-n,z+n, x-n,y+n,z+n, x-n,y+n,z-n, # left
#x+n,y-n,z+n, x+n,y-n,z-n, x+n,y+n,z-n, x+n,y+n,z+n, # right
#x-n,y-n,z+n, x+n,y-n,z+n, x+n,y+n,z+n, x-n,y+n,z+n, # front
#x+n,y-n,z-n, x-n,y-n,z-n, x-n,y+n,z-n, x+n,y+n,z-n, # back

assert cube_vertices(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 cube_vertices(2,3,4,5) == [-3, 8, -1, -3, 8, 9, 7, 8, 9, 7, 8, -1,
-3, -2, -1, 7, -2, -1, 7, -2, 9, -3, -2, 9,
-3, -2, -1, -3, -2, 9, -3, 8, 9, -3, 8, -1,
7, -2, 9, 7, -2, -1, 7, 8, -1, 7, 8, 9,
-3, -2, 9, 7, -2, 9, 7, 8, 9, -3, 8, 9,
7, -2, -1, -3, -2, -1, -3, 8, -1, 7, 8, -1]
assert cube_vertices(5,0,0,0) != [0, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0,
0, 0, 0, 2, 0, 0, 2, 0, 2, 0, 0, 2,
0, 0, 0, 0, 0, 2, 0, 2, 2, 0, 2, 0,
2, 0, 2, 2, 0, 0, 2, 2, 0, 2, 2, 2,
0, 0, 2, 2, 0, 2, 2, 2, 2, 0, 2, 2,
2, 0, 0, 0, 0, 0, 0, 2, 0, 2, 2, 0]
assert cube_vertices(-1,1,1,1) != [0, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0,
0, 0, 0, 2, 0, 0, 2, 0, 2, 0, 0, 2,
0, 0, 0, 0, 0, 2, 0, 2, 2, 0, 2, 0,
2, 0, 2, 2, 0, 0, 2, 2, 0, 2, 2, 2,
0, 0, 2, 2, 0, 2, 2, 2, 2, 0, 2, 2,
2, 0, 0, 0, 0, 0, 0, 2, 0, 2, 2, 0]
assert cube_vertices(2,3,4,-5) != [-3, 8, -1, -3, 8, 9, 7, 8, 9, 7, 8, -1,
-3, -2, -1, 7, -2, -1, 7, -2, 9, -3, -2, 9,
-3, -2, -1, -3, -2, 9, -3, 8, 9, -3, 8, -1,
7, -2, 9, 7, -2, -1, 7, 8, -1, 7, 8, 9,
-3, -2, 9, 7, -2, 9, 7, 8, 9, -3, 8, 9,
7, -2, -1, -3, -2, -1, -3, 8, -1, 7, 8, -1]
Binary file added Tests/Manual Pytest/PytestsFail.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Tests/Manual Pytest/PytestsPass.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Tests/Manual Pytest/Tests.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions Tests/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Here are the results of running the cosmic-ray test suite.
I followed a number of tutorials on setting up this application
for use with our project. Primarily, https://cosmic-ray.readthedocs.io/en/latest/quickstart.html
46 changes: 46 additions & 0 deletions Tests/mctestscript.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
arr := ["w", "a", "s", "d","Lbutton","Rbutton","Space"]

$q::
sendinput {w DOWN}
sleep 1000
sendinput {w UP}
sendinput {a DOWN}
sleep 1000
sendinput {a UP}
sendinput {s DOWN}
sleep 1000
sendinput {s UP}
sendinput {d DOWN}
sleep 1000
sendinput {d UP}
MouseMove, 0, 60, 50, R
sendinput {Lbutton DOWN}
sleep 1000
sendinput {Lbutton UP}
MouseMove, 20, -5, 50, R
sendinput {w DOWN}
sleep 5000
sendinput {w UP}
MouseMove, 0, 5, 50, R
sendinput {Lbutton DOWN}
sleep 1000
sendinput {Lbutton UP}
sendinput {Rbutton DOWN}
sleep 1000
sendinput {Rbutton UP}

loop 300
{
Random, oVar, 65, 122
sendinput {chr(oVar) DOWN}
sleep 100000
sendinput {chr(oVar) UP}
}
loop 1000
{
Random, oVar, 1, 7
sendinput {arr[oVar] DOWN}
sleep 100000
sendinput {arr[oVar] UP}
}
return
Loading