""" Authors: Peter Mawhorter Consulted: Date: 2022-5-1 Purpose: Testing code for lab extra fruitful recursion practice. """ import os import extra import optimism testSE = optimism.testFunctionMaybe(extra, "sumEvens") testSE.case([1, 2, 3, 4]).checkReturnValue(6) testSE.case([2, 4, 1, 3]).checkReturnValue(6) testSE.case([]).checkReturnValue(0) testSE.case([1, 3, 5]).checkReturnValue(0) testSE.case([4, 6, 8, 9]).checkReturnValue(18) testEOS = optimism.testFunctionMaybe(extra, "evenOddSums") testEOS.case([1, 2, 3]).checkReturnValue((4, 2)) testEOS.case([]).checkReturnValue((0, 0)) testEOS.case([2, 4, 6]).checkReturnValue((0, 12)) testEOS.case([11, 12, 15, 4, 3]).checkReturnValue((29, 16)) testCPF = optimism.testFunctionMaybe(extra, "countPythonFiles") testCPF.case('testdir').checkReturnValue(5) testCPF.case(os.path.join('testdir', 'remember')).checkReturnValue(2) testCPF.case(os.path.join('testdir', 'pset')).checkReturnValue(2) testCPF.case( os.path.join('testdir', 'pset', 'shrub', 'images') ).checkReturnValue(0)