< Summary - Igor Pro Universal Testing Framework

Information
Class: procedures.igortest-test-md
Assembly: procedures
File(s): /builds/mirror/igortest/procedures/igortest-test-md.ipf
Tag: 74147b3
Line coverage
8%
Covered lines: 9
Uncovered lines: 92
Coverable lines: 101
Total lines: 151
Line coverage: 8.9%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
IUTF_Test_MD#GetFunctionSignatureTCMD()100%110%
IUTF_Test_MD#GetDataGeneratorListTC()50%439.13%
IUTF_Test_MD#CheckFunctionSignatureTC()100%50%

File(s)

/builds/mirror/igortest/procedures/igortest-test-md.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_Test_MD
 6
 7/// Checks functions signature of each multi data test case candidate
 8/// returns 1 if ok, 0 otherwise
 9/// when 1 is returned the wave type variable contain the format
 010static Function GetFunctionSignatureTCMD(testCase, wType0, wType1, wrefSubType)
 11  string    testCase
 12  variable &wType0
 13  variable &wType1
 14  variable &wrefSubType
 15
 016  wType0      = NaN
 017  wType1      = NaN
 018  wrefSubType = NaN
 19
 20#if (IgorVersion() < 7.00)
 021  string funcInfo = FunctionInfo(testCase)
 022  if(NumberByKey("N_PARAMS", funcInfo) != NumberByKey("N_OPT_PARAMS", funcInfo))
 023    // test cases are required to have only optional parameter.
 024    return 0
 025  endif
 26#endif
 27
 028  // Check function signature
 029  FUNCREF TEST_CASE_PROTO_MD_VAR       fTCMDVAR       = $testCase
 030  FUNCREF TEST_CASE_PROTO_MD_STR       fTCMDSTR       = $testCase
 031  FUNCREF TEST_CASE_PROTO_MD_DFR       fTCMDDFR       = $testCase
 032  FUNCREF TEST_CASE_PROTO_MD_WV        fTCMDWV        = $testCase
 033  FUNCREF TEST_CASE_PROTO_MD_WVTEXT    fTCMDWVTEXT    = $testCase
 034  FUNCREF TEST_CASE_PROTO_MD_WVDFREF   fTCMDWVDFREF   = $testCase
 035  FUNCREF TEST_CASE_PROTO_MD_WVWAVEREF fTCMDWVWAVEREF = $testCase
 036  FUNCREF TEST_CASE_PROTO_MD_CMPL      fTCMDCMPL      = $testCase
 037  FUNCREF TEST_CASE_PROTO_MD_INT       fTCMDINT       = $testCase
 038  if(IUTF_FuncRefIsAssigned(FuncRefInfo(fTCMDVAR)))
 039    wType0 = 0xff %^ IUTF_WAVETYPE0_CMPL %^ IUTF_WAVETYPE0_INT64
 040    wType1 = IUTF_WAVETYPE1_NUM
 041  elseif(IUTF_FuncRefIsAssigned(FuncRefInfo(fTCMDSTR)))
 042    wType1 = IUTF_WAVETYPE1_TEXT
 043  elseif(IUTF_FuncRefIsAssigned(FuncRefInfo(fTCMDDFR)))
 044    wType1 = IUTF_WAVETYPE1_DFR
 045  elseif(IUTF_FuncRefIsAssigned(FuncRefInfo(fTCMDWV)))
 046    wType1 = IUTF_WAVETYPE1_WREF
 047  elseif(IUTF_FuncRefIsAssigned(FuncRefInfo(fTCMDWVTEXT)))
 048    wType1      = IUTF_WAVETYPE1_WREF
 049    wrefSubType = IUTF_WAVETYPE1_TEXT
 050  elseif(IUTF_FuncRefIsAssigned(FuncRefInfo(fTCMDWVDFREF)))
 051    wType1      = IUTF_WAVETYPE1_WREF
 052    wrefSubType = IUTF_WAVETYPE1_DFR
 053  elseif(IUTF_FuncRefIsAssigned(FuncRefInfo(fTCMDWVWAVEREF)))
 054    wType1      = IUTF_WAVETYPE1_WREF
 055    wrefSubType = IUTF_WAVETYPE1_WREF
 056  elseif(IUTF_FuncRefIsAssigned(FuncRefInfo(fTCMDCMPL)))
 057    wType0 = IUTF_WAVETYPE0_CMPL
 058    wType1 = IUTF_WAVETYPE1_NUM
 059  elseif(IUTF_FuncRefIsAssigned(FuncRefInfo(fTCMDINT)))
 060    wType0 = IUTF_WAVETYPE0_INT64
 061    wType1 = IUTF_WAVETYPE1_NUM
 062  else
 063    return 0
 064  endif
 65
 066  return 1
 067End
 68
 69/// @brief Load the list of the data generators that have to be executed for the specified testcase.
 70///
 71/// @param      procWin       The procedure window name
 72/// @param      fullFuncName  The full function name of the test case
 73/// @param[out] dgenList      The list of required data generator functions
 74///
 75/// @returns 1 on error, 0 on success
 7976static Function GetDataGeneratorListTC(procWin, fullFuncName, dgenList)
 77  string procWin, fullFuncName
 78  string &dgenList
 79
 7980  variable wType1, wType0, wRefSubType
 7981  string dgen
 82
 7983  dgenList = ""
 84
 7985  // Simple Test Cases
 7986  FUNCREF TEST_CASE_PROTO fTC = $fullFuncName
 7987  if(IUTF_FuncRefIsAssigned(FuncRefInfo(fTC)))
 7988    return 0
 089  endif
 090  // MMD Test Case
 091  FUNCREF TEST_CASE_PROTO_MD fTCmmd = $fullFuncName
 092  if(IUTF_FuncRefIsAssigned(FuncRefInfo(fTCmmd)))
 093    dgenList = IUTF_Test_MD_Gen#GetDataGeneratorForMMD(procWin, fullFuncName)
 094    return 0
 095  endif
 96
 097  // Multi Data Test Cases
 098  if(!GetFunctionSignatureTCMD(fullFuncName, wType0, wType1, wRefSubType))
 099    return 1
 0100  endif
 101
 0102  dgen = IUTF_Test_MD_Gen#GetDataGenFullFunctionName(procWin, fullFuncName)
 103
 0104  dgenList = AddListItem(dgen, dgenList, ";", Inf)
 105
 0106  return 0
 79107End
 108
 109/// Checks functions signature of a test case candidate
 110/// and its attributed data generator function
 111/// Returns 1 on error, 0 on success
 0112static Function CheckFunctionSignatureTC(procWin, fullFuncName, markSkip)
 113  string    procWin
 114  string    fullFuncName
 115  variable &markSkip
 116
 0117  variable err, wType1, wType0, wRefSubType
 0118  string dgen, msg
 0119  string funcInfo
 120
 0121  markSkip = 0
 122
 0123  // Require only optional parameter
 0124  funcInfo = FunctionInfo(fullFuncName)
 0125  if(NumberByKey("N_PARAMS", funcInfo) != NumberByKey("N_OPT_PARAMS", funcInfo))
 0126    return 1
 0127  endif
 128
 0129  // Simple Test Cases
 0130  FUNCREF TEST_CASE_PROTO fTC = $fullFuncName
 0131  if(IUTF_FuncRefIsAssigned(FuncRefInfo(fTC)))
 0132    return 0
 0133  endif
 0134  // MMD Test Case
 0135  FUNCREF TEST_CASE_PROTO_MD fTCmmd = $fullFuncName
 0136  if(IUTF_FuncRefIsAssigned(FuncRefInfo(fTCmmd)))
 0137    IUTF_Test_MD_Gen#CheckFunctionSignatureMDgen(procWin, fullFuncName, markSkip)
 0138    return 0
 0139  endif
 140
 0141  // Multi Data Test Cases
 0142  if(!GetFunctionSignatureTCMD(fullFuncName, wType0, wType1, wRefSubType))
 0143    return 1
 0144  endif
 145
 0146  dgen = IUTF_Test_MD_Gen#GetDataGenFullFunctionName(procWin, fullFuncName)
 0147  WAVE wGenerator = IUTF_Test_MD_Gen#CheckDGenOutput(fullFuncName, dgen, wType0, wType1, wRefSubType)
 0148  markSkip = IUTF_Test_MD_Gen#CheckDataGenZeroSize(wGenerator, fullFuncName, dgen)
 149
 0150  return 0
 0151End