# Path: pycket/test/testhelper.py
# def run_fix(p, v=None, stdlib=False, extra="", equal_huh=False):
#     new = pytest.config.new_pycket
#     if new:
#         return run_expr(p, v, equal_huh=equal_huh)
#     ov = run_mod_expr(p,stdlib=stdlib, extra=extra)
#     assert isinstance(ov, values.W_Fixnum)
#     if v is not None:
#         assert ov.value == v
#     return ov.value
# 
# def run(p, v=None, stdlib=False, extra="", expect_to_fail=False):
#     if pytest.config.new_pycket:
#         return run_expr_result(p, expect_to_fail=expect_to_fail, v=v)
#     return run_mod_expr(p,v=v,stdlib=stdlib, extra=extra)
# 
# def run_top(p, v=None, stdlib=False, extra=""):
#     return run_mod_expr(p,v=v,stdlib=stdlib, wrap=True, extra=extra)
# 
# def run_std(c, v):
#     return run_top(c, v, stdlib=True)
# 
# def run_flo(p, v=None, stdlib=False, extra=""):
#     ov = run_mod_expr(p,stdlib=stdlib, extra=extra)
#     assert isinstance(ov, values.W_Flonum)
#     if v is not None:
#         assert ov.value == v
#     return ov.value


import math
import pytest
    import math
    import random
from pycket.interpreter import *
from pycket.values import *
from pycket.prims import *
from pycket.test.testhelper import run_fix, run, run_top, run_std, run_flo
from pycket.error import SchemeException
    from rpython.rtyper.test.test_llinterp import interpret
    from rpython.rlib.rbigint import rbigint
    from pycket.arithmetic import gcd
    from rpython.rlib.rbigint import rbigint
    from pycket.arithmetic import gcd
    from rpython.rlib.rbigint import ONERBIGINT
    from pycket.arithmetic    import count_trailing_zeros

def test_flonum_tostring():
    s = '3.141592653589793' # racket -e "pi"
    def float_tostring(x):
        print W_Flonum(x).tostring()
        return s in W_Flonum(x).tostring()
    res = interpret(float_tostring, [math.pi])
    assert res

def test_mul_zero():
    run_fix("(* 0 1.2)", 0)
    run_fix("(* 1.2 0)", 0)

def test_quotient():
    run_fix("(quotient 0 1)", 0)
    run_fix("(quotient 0 -1)", 0)
    run_fix("(quotient 0 2)", 0)
    run_fix("(quotient 0 -2)", 0)
    run_fix("(quotient 0 3)", 0)
    run_fix("(quotient 1 1)", 1)
    run_fix("(quotient -1 1)", -1)
    run_fix("(quotient 1 -1)", -1)

# Path: pycket/test/testhelper.py
# def run_fix(p, v=None, stdlib=False, extra="", equal_huh=False):
#     new = pytest.config.new_pycket
#     if new:
#         return run_expr(p, v, equal_huh=equal_huh)
#     ov = run_mod_expr(p,stdlib=stdlib, extra=extra)
#     assert isinstance(ov, values.W_Fixnum)
#     if v is not None:
#         assert ov.value == v
#     return ov.value
# 
# def run(p, v=None, stdlib=False, extra="", expect_to_fail=False):
#     if pytest.config.new_pycket:
#         return run_expr_result(p, expect_to_fail=expect_to_fail, v=v)
#     return run_mod_expr(p,v=v,stdlib=stdlib, extra=extra)
# 
# def run_top(p, v=None, stdlib=False, extra=""):
#     return run_mod_expr(p,v=v,stdlib=stdlib, wrap=True, extra=extra)
# 
# def run_std(c, v):
#     return run_top(c, v, stdlib=True)
# 
# def run_flo(p, v=None, stdlib=False, extra=""):
#     ov = run_mod_expr(p,stdlib=stdlib, extra=extra)
#     assert isinstance(ov, values.W_Flonum)
#     if v is not None:
#         assert ov.value == v
#     return ov.value


# Path: pycket/test/test_arithmetic.py
import math
import pytest
    import math
    import random
from pycket.interpreter import *
from pycket.values import *
from pycket.prims import *
from pycket.test.testhelper import run_fix, run, run_top, run_std, run_flo
from pycket.error import SchemeException
    from rpython.rtyper.test.test_llinterp import interpret
    from rpython.rlib.rbigint import rbigint
    from pycket.arithmetic import gcd
    from rpython.rlib.rbigint import rbigint
    from pycket.arithmetic import gcd
    from rpython.rlib.rbigint import ONERBIGINT
    from pycket.arithmetic    import count_trailing_zeros


def test_flonum_tostring():
    s = '3.141592653589793' # racket -e "pi"
    def float_tostring(x):
        print W_Flonum(x).tostring()
        return s in W_Flonum(x).tostring()
    res = interpret(float_tostring, [math.pi])
    assert res

def test_mul_zero():
    run_fix("(* 0 1.2)", 0)
    run_fix("(* 1.2 0)", 0)

def test_quotient():
    run_fix("(quotient 0 1)", 0)
    run_fix("(quotient 0 -1)", 0)
    run_fix("(quotient 0 2)", 0)
    run_fix("(quotient 0 -2)", 0)
    run_fix("(quotient 0 3)", 0)
    run_fix("(quotient 1 1)", 1)
    run_fix("(quotient -1 1)", -1)
    run_fix("(quotient 1 -1)", -1)

    run_fix("(quotient -1 -1)", 1)