-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
73 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# vim ft=yaml | ||
# travis-ci.org definition for game-of-life build | ||
# | ||
|
||
language: c | ||
env: | ||
- PYTHON=python PYSUF='' PYVER=2.7 | ||
- PYTHON=python3 PYSUF='3' PYVER=3.3 | ||
install: | ||
- sudo apt-get update # needed for python3-numpy | ||
- sudo apt-get install $PYTHON-dev | ||
- sudo apt-get install $PYTHON-numpy | ||
- sudo apt-get install $PYTHON-scipy | ||
- sudo apt-get install $PYTHON-setuptools | ||
- sudo apt-get install $PYTHON-nose | ||
- sudo easy_install$PYSUF pip | ||
- sudo pip install Pillow | ||
- if [[ $PYVER == '2.7' ]]; then sudo apt-get install $PYTHON-matplotlib; fi | ||
- if [[ $PYVER == '3.3' ]]; then sudo pip-$PYVER install git+git://github.com/matplotlib/matplotlib.git@v1.2.x; fi | ||
- $PYTHON setup.py build | ||
- sudo $PYTHON setup.py install | ||
script: | ||
# Change into an innocuous directory and find tests from installation | ||
- mkdir $HOME/.matplotlib | ||
- "echo 'backend : Agg' > $HOME/.matplotlib/matplotlibrc" | ||
- "echo 'backend.qt4 : PyQt4' >> $HOME/.matplotlib/matplotlibrc" | ||
- "cd game-of-life" | ||
- if [[ $PYVER == '2.7' ]]; then nosetests-2.7; fi | ||
- if [[ $PYVER == '3.2' ]]; then nosetests-3.2; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from conway import conway | ||
import unittest | ||
import numpy as np | ||
|
||
class TestConway(unittest.TestCase): | ||
|
||
def test_still(self): | ||
"""2x2 block""" | ||
|
||
A = np.zeros((10,10)) | ||
A[1:3,1:3] = 1 | ||
B = conway(A) | ||
assert (A == B).all() | ||
|
||
def test_scillator(self): | ||
"""blinker""" | ||
A = np.zeros((10,10)) | ||
A[1:4,1] = 1 | ||
B = conway(A) | ||
assert (B[2, 0:3] == 1).all() | ||
|
||
B = conway(B) | ||
assert (A == B).all() | ||
|
||
def test_evolution(self): | ||
"""test that something changes""" | ||
m, n = 10, 10 | ||
A = np.random.random(m*n).reshape((m, n)).round() | ||
B = conway(A) | ||
assert (B != A).any() | ||
|
||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |