コード例 #1
0
 def test_check_invariant_different_number_parameters(self):
     invariant = Function('inv', 2)
     invariant.parameters = []
     invariant.parameters.append(Parameter('t1', 'int'))
     variables = []
     variables.append(Variable('t1','int', 10))
     variables.append(Variable('t2','bool', 11))
     invariant.returndt = 'bool'
     checker = ComplianceChecker()
     with pytest.raises(ComplianceError):
         checker.check_invariant(invariant, variables)
コード例 #2
0
 def test_check_invariant_compliant_invariant(self):
     invariant = Function('inv', 2)
     invariant.parameters = []
     invariant.parameters.append(Parameter('t1', 'int'))
     invariant.parameters.append(Parameter('t2', 'bool'))
     variables = []
     variables.append(Variable('t1','int', 10))
     variables.append(Variable('t2','bool', 11))
     invariant.returndt = 'bool'
     checker = ComplianceChecker()
     assert checker.check_invariant(invariant, variables) == True
コード例 #3
0
 def test_check_invariant_invariant_not_defined(self):
     invariant = None
     variables = []
     checker = ComplianceChecker()
     with pytest.raises(ComplianceError):
         checker.check_invariant(invariant, variables)