Exemplo n.º 1
0
 def test_maps_evaluation(self):
     """ Tests the mapping function for an evaluation """
     condition = Condition(None, "NoneCondition")
     measurement = Measurement(None)
     in_evaluation = Evaluation(measurement, condition, True)
     out_evaluation = rospit.test_runner.map_evaluation(in_evaluation)
     self.assertEqual("NoneCondition", out_evaluation.condition.name.data)
Exemplo n.º 2
0
    def evaluate_internal(self, condition, measurement=None):
        if measurement is None:
            measurement = numeric_measure(self)
        else:
            measurement = measurement_wrapper(measurement)
        assert (isinstance(measurement, NumericMeasurement))

        return Evaluation(measurement, condition,
                          measurement.value < condition.value)
Exemplo n.º 3
0
    def evaluate_internal(self, condition, measurement=None):
        if measurement is None:
            current = self.test_case.execution_result
            if self.field is not None:
                fields = self.field.split("/")
                for field in fields:
                    current = getattr(current, field)
            measurement = Measurement(current)

        evaluation = Evaluation(measurement, condition,
                                measurement.value == condition.value)
        return evaluation
Exemplo n.º 4
0
    def evaluate_internal(self, condition, measurement=None):
        """
        Verifies whether measurement matches the upper limit condition
        """
        if measurement is None:
            measurement = numeric_measure(self)
        else:
            measurement = measurement_wrapper(measurement)
        assert (isinstance(measurement, NumericMeasurement))

        if condition.upper_limit_is_inclusive:
            nominal = measurement.value <= condition.upper_limit
        else:
            nominal = measurement.value < condition.upper_limit

        return Evaluation(measurement, condition, nominal)
Exemplo n.º 5
0
    def evaluate_internal(self, condition, measurement=None):
        if measurement is None:
            measurement = binary_measure(self)
        else:
            measurement = measurement_wrapper(measurement)
        assert (isinstance(measurement, BinaryMeasurement))

        if isinstance(measurement, BinaryMeasurement):
            self.last_measurement_value = measurement.value
        elif isinstance(measurement, bool):
            self.last_measurement_value = measurement
        else:
            raise Exception("Measurement is of unexpected type")

        if isinstance(condition, BinaryCondition):
            self.last_condition_value = condition.value
        elif isinstance(condition, bool):
            self.last_condition_value = condition
        else:
            raise Exception("Condition is of unexpected type")

        nominal = self.last_measurement_value == self.last_condition_value
        return Evaluation(measurement, condition, nominal)
Exemplo n.º 6
0
 def evaluate_internal(self, condition, measurement=None):
     if measurement is None:
         measurement = self.data
     return Evaluation(measurement, condition, self.data == condition.value)
Exemplo n.º 7
0
 def evaluate_internal(self, condition, measurement=None):
     if measurement is None:
         measurement = BinaryMeasurement(self.received)
     return Evaluation(measurement, condition,
                       self.received == condition.value)
Exemplo n.º 8
0
 def execute(self, logger=None):
     return TestCaseReport(self, [
         Evaluation(Measurement(0), Condition(None, "Failed condition"),
                    False)
     ], [], [], [])
Exemplo n.º 9
0
 def evaluate_internal(self, condition, measurement=None):
     return Evaluation(BinaryMeasurement(self.always_true), condition, True)
Exemplo n.º 10
0
 def evaluate_internal(self, condition, measurement=None):
     if measurement is None:
         measurement = self.call_evaluator()
     nominal = measurement.category in condition.categories
     return Evaluation(measurement, condition, nominal)