Next / Previous / Contents / Shipman's homepage

12. Truths.check(): Generate error messages

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

    def check(self):
        '''Generate the error messages in self, if any.
        '''

The checking algorithm is straightforward. We generate all possible combinations of the input conditions. For each set of inputs, we count the number of cases that match. This count should be exactly one.

The logic that generates all possible sets of inputs is in Section 13, “Truths._permuter(): Generate all possible input sets”. The logic that checks each input set is in Section 14, “Truths._inputCheck(): Check one input set”.

tracecase
        #-- 1
        # [ generate a sequence of messages describing uncovered or
        #       multiply-covered cases in self, if any ]
        for inputList in self._permuter(len(self._condList)):
            #-- 1 body --
            # [ inputList is a list of values for all the conditions
            #   in self as True or False ->
            #     if inputList matches exactly one of the cases
            #     in self ->
            #       I
            #     else ->
            #       yield an error message string ]
            #-- 1.1
            # [ if inputList matches exactly one of the cases in self ->
            #     message  :=  None
            #   else ->
            #     message  :=  an error message string ]
            message = self._inputCheck ( inputList )

            #-- 1.2
            if message is not None:
                yield message