mirror of
https://github.com/status-im/spiff-arena.git
synced 2025-01-31 12:15:45 +00:00
7c219fd731
git-subtree-dir: SpiffWorkflow git-subtree-split: 63db3e45947ec66b8d0efc2c74064004f8ff482c
75 lines
2.7 KiB
Python
75 lines
2.7 KiB
Python
import unittest
|
|
|
|
from .FeelDecisionRunner import FeelDecisionRunner
|
|
|
|
|
|
class FeelIntegerDecisionRangeTestClass(unittest.TestCase):
|
|
"""
|
|
Doc: https://docs.camunda.org/manual/7.7/user-guide/dmn-engine/
|
|
"""
|
|
def test_integer_decision_string_output_inclusive(self):
|
|
runner = FeelDecisionRunner('integer_decision_range_inclusive_feel.dmn')
|
|
|
|
res = runner.decide({"Age":100})
|
|
self.assertEqual(res.description, '100-110 Inclusive Annotation')
|
|
|
|
res = runner.decide({"Age":99})
|
|
self.assertEqual(res.description, 'ELSE Row Annotation')
|
|
|
|
res = runner.decide({"Age":110})
|
|
self.assertEqual(res.description, '100-110 Inclusive Annotation')
|
|
|
|
res = runner.decide({"Age":111})
|
|
self.assertEqual(res.description, 'ELSE Row Annotation')
|
|
|
|
def test_integer_decision_string_output_exclusive(self):
|
|
runner = FeelDecisionRunner('integer_decision_range_exclusive_feel.dmn')
|
|
|
|
res = runner.decide({"Age":100})
|
|
self.assertEqual(res.description, 'ELSE Row Annotation')
|
|
|
|
res = runner.decide({"Age":101})
|
|
self.assertEqual(res.description, '100-110 Exclusive Annotation')
|
|
|
|
res = runner.decide({"Age":110})
|
|
self.assertEqual(res.description, 'ELSE Row Annotation')
|
|
|
|
res = runner.decide({"Age":109})
|
|
self.assertEqual(res.description, '100-110 Exclusive Annotation')
|
|
|
|
def test_integer_decision_string_output_excl_inclusive(self):
|
|
runner = FeelDecisionRunner('integer_decision_range_excl_inclusive_feel.dmn')
|
|
|
|
res = runner.decide({'Age': 100})
|
|
self.assertEqual(res.description, 'ELSE Row Annotation')
|
|
|
|
res = runner.decide({'Age':101})
|
|
self.assertEqual(res.description, '100-110 ExclInclusive Annotation')
|
|
|
|
res = runner.decide({'Age':110})
|
|
self.assertEqual(res.description, '100-110 ExclInclusive Annotation')
|
|
|
|
res = runner.decide({'Age':111})
|
|
self.assertEqual(res.description, 'ELSE Row Annotation')
|
|
|
|
def test_integer_decision_string_output_incl_exclusive(self):
|
|
runner = FeelDecisionRunner('integer_decision_range_incl_exclusive_feel.dmn')
|
|
|
|
res = runner.decide({"Age":100})
|
|
self.assertEqual(res.description, '100-110 InclExclusive Annotation')
|
|
|
|
res = runner.decide({"Age":99})
|
|
self.assertEqual(res.description, 'ELSE Row Annotation')
|
|
|
|
res = runner.decide({"Age":110})
|
|
self.assertEqual(res.description, 'ELSE Row Annotation')
|
|
|
|
res = runner.decide({"Age":109})
|
|
self.assertEqual(res.description, '100-110 InclExclusive Annotation')
|
|
|
|
def suite():
|
|
return unittest.TestLoader().loadTestsFromTestCase(FeelIntegerDecisionRangeTestClass)
|
|
|
|
if __name__ == '__main__':
|
|
unittest.TextTestRunner(verbosity=2).run(suite())
|