import isystem.connect as ic
winidea_id = ''
def init_target() -> ic.ConnectionMgr:
cmgr = ic.ConnectionMgr()
cmgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
debugCtrl = ic.CDebugFacade(cmgr)
debugCtrl.reset()
debugCtrl.runUntilFunction('main')
debugCtrl.waitUntilStopped()
return cmgr
def run_test(cmgr: ic.ConnectionMgr):
testCaseCtrl = ic.CTestCaseController(cmgr, 'sum', 'retVal')
testCaseCtrl.createParameter(0, 'param1')
testCaseCtrl.createParameter(1, 'param2')
testCaseCtrl.createParameter(2, 'param3')
testCaseCtrl.createVariable('newVariable', 'int[10]')
testCaseCtrl.init()
testCaseCtrl.modifyAsString('newVariable', "{0, 1, 2, -6, 4, 5, 6, 7, 8, 9}")
testCaseCtrl.modify('newVariable[0]', '10')
testCaseCtrl.modify('param1', '5')
testCaseCtrl.modify('param2', 'newVariable[0]')
testCaseCtrl.modify('param3', 'newVariable[3]')
print('Running test...')
testCaseCtrl.run()
testCaseCtrl.waitUntilStopped()
print('Finished.')
state = testCaseCtrl.getStatus()
if state == ic.IConnectTest.stateEnded:
print('Test finished normally.')
else:
print('Test ended in unexpected state: ', state)
rv = testCaseCtrl.evaluate('retVal,d')
print('return value: ', rv)
if rv != '9':
print('Test failed! retVal =', rv)
testCaseCtrl.destroy()
def main():
cmgr = init_target()
print('initialized')
run_test(cmgr)
if __name__ == '__main__':
main()