Next / Previous / Contents / Shipman's homepage

15. Truths._caseCheck(): Check one case

tracecase
# - - -   T r u t h s . _ c a s e C h e c k

    def _caseCheck(self, inputList, casex):
        '''Check one set of inputs for its case coverage.

          [ (inputList is a list of len(self._condList) bool values) and
            (0 <= casex < self._caseCount) ->
              if case (casex) matches condSet ->
                return True
              else ->
                return False ]
        '''

The T/F/X codes that comprise a given case are a slice across the strings of self._condList at index casex. The code at self._condList[k][casex] is the code for input [k], case [casex].

tracecase
        #-- 1
        # [ if any of the inputs in inputList do not match the
        #   corresponding element of case [casex] ->
        #     return False
        #   else -> I ]
        for condx in range(len(self._condList)):
            #-- 1 body
            # [ if inputList[condx] does not match
            #   self._condList[condx][casex] ->
            #     return False
            #   else -> I ]
            if not self._codeMatch(inputList[condx],
                                   self._condList[condx][casex]):
                return False

If there were no mismatches, it's a match.

tracecase
        #-- 2
        return True