# Path: test/base.py
# def     preamble():
#     """
#     process command line flags - see <test-script> -h
#     """
#     flags, args = parseCommandLineArgs(sys.argv)
# 
#     for flag in flags:
#         if flag in ("-ee=0", "--lazy"):
#             systemVariables.setEvaluationMode(0)
# 
#         elif flag in ("-ee=1", "--eager"):
#             systemVariables.setEvaluationMode(1)
# 
#         elif flag in "-io=0":
#             systemVariables.setIndexOrigin(0)
# 
#         elif flag in "-io=1":
#             systemVariables.setIndexOrigin(1)
# 
#         elif flag in ("-h", "--help"):
#             print(_help())
#             aplQuit(0)
# 
#         else:
#             aplQuit(3, "{0} not recognised: perhaps try -h".format(flag))
# 
# def     testResult(expr, overrideLazy=False):
#     """
#     evaluate an expression then format and print the result
# 
#     handle both positive and negative outcomes
# 
#     Often the negative outcome in lazy evaluation mode involves printing backspaces
# 
#         doctest.NORMALIZE_WHITESPACE = 1
# 
#     does not have the desired effect, hence the messing around the with the evaluation mode.
#     """
#     if overrideLazy:
#         overrideLazy = not systemVariables.eagerEvaluation()
# 
#     if overrideLazy:
#         systemVariables.setEvaluationMode(1)
# 
#     try:
#         cio = aplCio()
#         cio.printResult(evaluate(expr, cio))
#     except aplException as error:
#         print(error.message)
# 
#     if overrideLazy:
#         systemVariables.setEvaluationMode(0)
# 
# Path: test/base.py
# def     saveIndexOrigin():
#     """
#     return ⎕IO so the test function can save it
#     """
#     return systemVariables.indexOrigin()
# 
# def     setIndexOrigin(io):
#     """
#     set ⎕IO:  it is assumed the test function has saved and will restore the original value
#     """
#     systemVariables.setIndexOrigin(io)
# 
# def     restoreIndexOrigin(io):
#     """
#     restore ⎕IO previously retrieved by the test function using saveIndexOrigin
#     """
#     systemVariables.setIndexOrigin(io)


from test.base import preamble, testResult as test
from test.base import saveIndexOrigin, setIndexOrigin, restoreIndexOrigin
        import doctest
#!/usr/bin/python3
"""
    doctest style unit tests for APL dyadic functions

    WIP - grows as more dyadic functions are implemented.

    The tests in this module exercise dyadic functions with

        numeric scalar and vector arguments only.

    Other cases are covered in other test modules.

    Each test passes an APL expression to the evaluate function.
    Both positive and negative (e.g. DOMAIN ERROR) cases are tested.

    Note:
        testDyadic --eager      # run with eager evaluation
        testDyadic --lazy       # run with lazy evaluation
"""


# Path: test/base.py
# def     preamble():
#     """
#     process command line flags - see <test-script> -h
#     """
#     flags, args = parseCommandLineArgs(sys.argv)
# 
#     for flag in flags:
#         if flag in ("-ee=0", "--lazy"):
#             systemVariables.setEvaluationMode(0)
# 
#         elif flag in ("-ee=1", "--eager"):
#             systemVariables.setEvaluationMode(1)
# 
#         elif flag in "-io=0":
#             systemVariables.setIndexOrigin(0)
# 
#         elif flag in "-io=1":
#             systemVariables.setIndexOrigin(1)
# 
#         elif flag in ("-h", "--help"):
#             print(_help())
#             aplQuit(0)
# 
#         else:
#             aplQuit(3, "{0} not recognised: perhaps try -h".format(flag))
# 
# def     testResult(expr, overrideLazy=False):
#     """
#     evaluate an expression then format and print the result
# 
#     handle both positive and negative outcomes
# 
#     Often the negative outcome in lazy evaluation mode involves printing backspaces
# 
#         doctest.NORMALIZE_WHITESPACE = 1
# 
#     does not have the desired effect, hence the messing around the with the evaluation mode.
#     """
#     if overrideLazy:
#         overrideLazy = not systemVariables.eagerEvaluation()
# 
#     if overrideLazy:
#         systemVariables.setEvaluationMode(1)
# 
#     try:
#         cio = aplCio()
#         cio.printResult(evaluate(expr, cio))
#     except aplException as error:
#         print(error.message)
# 
#     if overrideLazy:
#         systemVariables.setEvaluationMode(0)
# 
# Path: test/base.py
# def     saveIndexOrigin():
#     """
#     return ⎕IO so the test function can save it
#     """
#     return systemVariables.indexOrigin()
# 
# def     setIndexOrigin(io):
#     """
#     set ⎕IO:  it is assumed the test function has saved and will restore the original value
#     """
#     systemVariables.setIndexOrigin(io)
# 
# def     restoreIndexOrigin(io):
#     """
#     restore ⎕IO previously retrieved by the test function using saveIndexOrigin
#     """
#     systemVariables.setIndexOrigin(io)


# Path: test/dyadic.py
from test.base import preamble, testResult as test
from test.base import saveIndexOrigin, setIndexOrigin, restoreIndexOrigin
        import doctest

#!/usr/bin/python3
"""
    doctest style unit tests for APL dyadic functions

    WIP - grows as more dyadic functions are implemented.

    The tests in this module exercise dyadic functions with

        numeric scalar and vector arguments only.

    Other cases are covered in other test modules.

    Each test passes an APL expression to the evaluate function.
    Both positive and negative (e.g. DOMAIN ERROR) cases are tested.

    Note:
        testDyadic --eager      # run with eager evaluation
        testDyadic --lazy       # run with lazy evaluation
"""


from test.base import saveIndexOrigin, setIndexOrigin, restoreIndexOrigin