Permalink
Browse files

testing: move smoke tests in utils.py to run-unit

  • Loading branch information...
kba committed Dec 12, 2017
1 parent d79fb4d commit df35f9eaf068ca3fc162a96229b5273a6a82f589
Showing with 8 additions and 6 deletions.
  1. +0 −5 ocrolib/utils.py
  2. +8 −1 tests/run-unit
View
@@ -12,8 +12,3 @@ def sumprod(u,v,out=None):
n = u.shape[1]
out = np.zeros(n)
return np.einsum('ki,ki->i',u,v,out=out)
def test():
from pylab import randn
sumouter(randn(11,3),randn(11,4),out=randn(3,4))
sumprod(randn(11,7),randn(11,7),out=randn(7))
View
@@ -2,7 +2,7 @@
import sys
from ocrolib import edist
from ocrolib import edist, utils
# Test the levenshtein function and returns 0 if the computed value
# equals the one it should be, otherwise returns 1 for failed tests.
@@ -44,4 +44,11 @@ failed_tests += testXLevenshtein('', 'test', 1, should=(4.0, []))
failed_tests += testXLevenshtein('aaaaaaaaaaa', 'a', 1, should=(10.0, [('aaaaaaaaaaa ', 'a__________ ')]))
failed_tests += testXLevenshtein('123 111 456', '132 111 444', 1, should=(4.0, [('123_ ', '1_32 '), ('456 ', '444 ')]))
print('\n# 3 utils.sumouter / utils.sumprod')
from pylab import randn
utils.sumouter(randn(10,3),randn(10,4),out=randn(3,4))
print('ok - dimensions of sumouter')
utils.sumprod(randn(11,7),randn(11,7),out=randn(7))
print('ok - dimensions of sumprod')
sys.exit(failed_tests)

0 comments on commit df35f9e

Please sign in to comment.