Skip to content

Commit 24a7c65

Browse files
committed
add a test script
1 parent 227df6f commit 24a7c65

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/python3
2+
3+
import os
4+
import sys
5+
6+
if len(sys.argv) != 2:
7+
print('Usage: ./test PYECM_PATH')
8+
sys.exit(-1)
9+
parent_dir = os.path.realpath(os.path.join(sys.argv[1], os.pardir))
10+
sys.path.insert(0, parent_dir)
11+
12+
from pyecm import *
13+
14+
for n in range(1, 1001):
15+
prod = 1
16+
for factor in factors(n, False, False, 7.97308847044, 1.0):
17+
prod *= factor
18+
if prod != n:
19+
print('Failed to factor %d.' % n, file=sys.stderr)
20+
sys.exit(1)
21+
print('All tests passed.')

0 commit comments

Comments
 (0)