예제 #1
0
파일: start.py 프로젝트: adrianPascan/FP
def start ():
    runTests()
    listNumbers = initialiseList()
    print ("Which UI would you like to use? command-based / menu-based?\nType 'command' or 'menu':")
    answer = ''
    while answer != 'command' and answer != 'menu':
        answer = input('\t > ')
        if answer == 'command':
            UI_executeCommmands(listNumbers)
        elif answer == 'menu':
            UI_menuExecuteCommands(listNumbers)
        else:
            print('Invalid answer!')
예제 #2
0
def test_filterByModulo():
    listNumbers = initialiseList()
    listModulo = filterByModulo(listNumbers, '<', 2)
    assert len(listModulo) == 2 and listModulo == [[1, 1], [0, 0]]
예제 #3
0
def test_filterByRealBetweenPositions():
    listNumbers = initialiseList()
    listReal = filterByRealBetweenPositions(listNumbers, 0, 8)
    assert len(listReal) == 1 and listReal == [[0, 0]]
예제 #4
0
def test_filterByReal():
    listNumbers = initialiseList()
    listReal = filterByReal(listNumbers)
    assert len(listReal) == 2 and listReal == [[0, 0], [15, 0]]
예제 #5
0
def test_replace():
    listNumbers = initialiseList()
    replace(listNumbers, [0, 0], [-1, -1])
    assert len(listNumbers) == 10 and listNumbers[1] == [-1, -1]
예제 #6
0
def test_removeBetweenPositions():
    listNumbers = initialiseList()
    removeBetweenPositions(listNumbers, 1, 5)
    assert len(listNumbers) == 5 and listNumbers[1] == [-4, 11]
예제 #7
0
def test_removePosition():
    listNumbers = initialiseList()
    removePosition(listNumbers, 2)
    assert len(listNumbers) == 9 and listNumbers[2] == [-12, -9]
예제 #8
0
def test_productBetweenPositions():
    listNumbers = initialiseList()
    assert productBetweenPositions(listNumbers, 7, 9) == [720, 210]
예제 #9
0
def test_sumBetweenPositions():
    listNumbers = initialiseList()
    assert sumBetweenPositions(listNumbers, 0, 2) == [20, -9]