# Copyright (C) 2022, H. Conrad Cunningham
# Exploring Languages with Interpreters and Functional Programming

# Modified modular programming example from Ch. 2
# Main Counting Module importing Arith

#234567890123456789012345678901234567890123456789012345678901234567890

# 2022-03-08: Developed from 2018-07-04 modular example
# 2022-03-10: Renamed incr() to be adv()
# 2022-03-13: Added more smoke testing

# python3 CountingModA.py

from Arith import reset, adv, get_count, has_more

def counter():
    while has_more():
        count = get_count()
        print(f'{count}')
        adv()

# Testing
if __name__ == '__main__':
    print('Begin smoke testing with default like reset(0,10,1)')
    counter()
    print(f'reset(-10,0,1)')
    reset(-10,0,1)
    counter()
    print(f'reset(10,0,-1)')
    reset(10,0,-1)
    counter()
    print(f'reset(0,-10,-1)')
    reset(0,-10,-1)
    counter()
    print(f'reset(0,10,-1) should print empty sequence')
    reset(0,10,-1)
    counter()
    print(f'reset(0,10,0) should give error')
    reset(0,10,0)
    counter()
    print('End smoke testing')

