def test_quantize_api(method, prec, exprange, restricted_range, itr, stat):
 for op in all_binary(prec, restricted_range, itr):
  for rounding in RoundModes:
   c = randcontext(exprange)
   quantizeop = (op[0], op[1], rounding, c)
   t = TestSet(method, quantizeop)
   try:
    if (not convert(t)):
     continue
    callfuncs(t)
    verify(t, stat)
   except VerifyError as err:
    log(err)

def test_quantize_api ( method , prec , exprange , restricted_range , itr , stat ) : for op in all_binary ( prec , restricted_range , itr ) : for rounding in RoundModes : c = randcontext ( exprange ) quantizeop = ( op [ 0 ] , op [ 1 ] , rounding , c ) t = TestSet ( method , quantizeop ) try : if ( not convert ( t ) ) : continue callfuncs ( t ) verify ( t , stat ) except VerifyError as err : log ( err )
iterate the quantize method through many test cases .