def _test_jd2jcal():
 import random
 n = 1000
 year = [random.randint((-4699), 2200) for i in range(n)]
 month = [random.randint(1, 12) for i in range(n)]
 day = [random.randint(1, 28) for i in range(n)]
 jd = [jcal2jd(y, m, d)[1] for (y, m, d) in zip(year, month, day)]
 x = [jd2gcal(MJD_0, i) for i in jd]
 for i in range(n):
  assert (x[i][0] == year[i])
  assert (x[i][1] == month[i])
  assert (x[i][2] == day[i])
  assert (x[i][3] <= 1e-15)

def _test_jd2jcal ( ) : import random n = 1000 year = [ random . randint ( ( - 4699 ) , 2200 ) for i in range ( n ) ] month = [ random . randint ( 1 , 12 ) for i in range ( n ) ] day = [ random . randint ( 1 , 28 ) for i in range ( n ) ] jd = [ jcal2jd ( y , m , d ) [ 1 ] for ( y , m , d ) in zip ( year , month , day ) ] x = [ jd2gcal ( MJD_0 , i ) for i in jd ] for i in range ( n ) : assert ( x [ i ] [ 0 ] == year [ i ] ) assert ( x [ i ] [ 1 ] == month [ i ] ) assert ( x [ i ] [ 2 ] == day [ i ] ) assert ( x [ i ] [ 3 ] <= 1e-15 )
check jd2jcal as reverse of jcal2jd .