< Summary - Igor Pro Universal Testing Framework

Information
Class: procedures.igortest-debug
Assembly: procedures
File(s): /builds/mirror/igortest/procedures/igortest-debug.ipf
Tag: 74147b3
Line coverage
93%
Covered lines: 40
Uncovered lines: 3
Coverable lines: 43
Total lines: 82
Line coverage: 93%
Branch coverage
50%
Covered branches: 3
Total branches: 6
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

File(s)

/builds/mirror/igortest/procedures/igortest-debug.ipf

#LineLine coverage
 1#pragma rtGlobals=3
 2#pragma TextEncoding="UTF-8"
 3#pragma rtFunctionErrors=1
 4#pragma version=1.10
 5#pragma ModuleName=IUTF_Debug
 6
 7///@cond HIDDEN_SYMBOL
 8
 9/// @brief Set the debug mode at the start of the test run
 610static Function SetDebugger(debugMode)
 11  variable debugMode
 12
 613  InitIgorDebugVariables()
 614  DFREF dfr = GetPackageFolder()
 615  NVAR/SDFR=dfr igor_debug_state
 616  NVAR/SDFR=dfr igor_debug_assertion
 17
 618  if(!debugMode)
 619    igor_debug_state = SetIgorDebugger(IUTF_DEBUG_DISABLE)
 620  endif
 621  if(debugMode & (IUTF_DEBUG_ENABLE | IUTF_DEBUG_ON_ERROR | IUTF_DEBUG_NVAR_SVAR_WAVE | IUTF_DEBUG_FAILED_ASSERTION))
 022    igor_debug_assertion = !!(debugMode & IUTF_DEBUG_FAILED_ASSERTION)
 023    igor_debug_state     = SetIgorDebugger(debugMode | IUTF_DEBUG_ENABLE)
 624  endif
 625End
 26
 27/// @brief Restores the debugger to the state before SetDebugger(debugMode)
 528static Function RestoreDebugger()
 529  DFREF dfr = GetPackageFolder()
 530  NVAR/SDFR=dfr igor_debug_state
 531  SetIgorDebugger(igor_debug_state)
 532End
 33
 34/// Create the variables igor_debug_state and igor_debug_assertion
 35/// in PKG_FOLDER and initialize it to zero
 636static Function InitIgorDebugVariables()
 637  DFREF      dfr                      = GetPackageFolder()
 638  variable/G dfr:igor_debug_state     = 0
 639  variable/G dfr:igor_debug_assertion = 0
 640End
 41
 42/// Set the Igor Debugger, returns the previous state
 43/// @param state    3 bits to set
 44///            0x01: debugger enable
 45///            0x02: debug on error
 46///            0x04: debug on NVAR SVAR WAVE reference error
 1147static Function SetIgorDebugger(state)
 48  variable state
 49
 1150  variable prevState, enable, debugOnError, nvarSvarWave
 51
 1152  prevState = GetCurrentDebuggerState()
 53
 1154  enable       = !!(state & IUTF_DEBUG_ENABLE)
 1155  debugOnError = !!(state & IUTF_DEBUG_ON_ERROR)
 1156  nvarSvarWave = !!(state & IUTF_DEBUG_NVAR_SVAR_WAVE)
 57
 1158  DebuggerOptions enable=enable, debugOnError=debugOnError, NVAR_SVAR_WAVE_Checking=nvarSvarWave
 59
 1160  return prevState
 1161End
 62
 63/// Opens the Debugger if the assertion failed and the debugMode option is set
 35564static Function DebugFailedAssertion(result)
 65  variable result
 66
 35567  DFREF dfr = GetPackageFolder()
 35568  NVAR/SDFR=dfr igor_debug_assertion
 69
 35570  if(igor_debug_assertion && !result)
 071    Debugger
 35572  endif
 35573End
 74
 75/// Returns the current state of the Igor Debugger as ORed bitmask of IUTF_DEBUG_* constants
 1176static Function GetCurrentDebuggerState()
 77
 1178  DebuggerOptions
 1179  return (!!V_enable) * IUTF_DEBUG_ENABLE | (!!V_debugOnError) * IUTF_DEBUG_ON_ERROR | (!!V_NVAR_SVAR_WAVE_Checking) * I
 1180End
 81
 82///@endcond // HIDDEN_SYMBOL