program_check.py

back to table · edit · history · where entries came from · files · download

558 bytes, as of the version from 2026-12-01 13:13 (current). Recorded here, not run.

import json
from generate import LiouvilleReals
from program import liouville
from numberdb._write import to_text
for b in range(2,17):
 a=liouville(b);c=LiouvilleReals().value({'b':b},100)
 assert (a.lower().exact_rational(),a.upper().exact_rational()) == (c.lower().exact_rational(),c.upper().exact_rational())
for b in [0,1,2.5,True]:
 try:liouville(b)
 except (ValueError,TypeError):pass
 else:raise AssertionError('invalid argument accepted')
print('PROGRAM_CHECK_JSON='+json.dumps({'entries':15,'matched':15,'invalid_inputs_rejected':[0,1,2.5,True]}))