예제 #1
0
 def test_point_empty(self):
     _check_permutations(self, [
         Case(
             point(7),
             empty,
             union=PosNeg(point(7), unlimited),
             intersection=PosNeg(empty, unlimited),
         ),
     ])
예제 #2
0
 def test_point_unlimited(self):
     _check_permutations(
         self,
         [
             Case(
                 point(7),
                 unlimited,
                 union=PosNeg(unlimited,
                              empty),  # negering: kan få unlimited??
                 intersection=PosNeg(point(7), unlimited),
             ),
         ])
예제 #3
0
 def test_non_complex(self):
     _check_adaption_variant_cases(
         self,
         interval_of_unknown_class=unlimited_with_unlimited_inversion(),
         cases=[
             CaseWAdaptionVariants(
                 'constant F',
                 Negation(_constant_wo_interval(False)),
                 [
                     _without_adaption(_equals_interval(Unlimited())),
                     _w_max_upper_adaption(
                         20, _equals_interval(UpperLimit(20))),
                 ],
             ),
             CaseWAdaptionVariants(
                 'constant T',
                 Negation(_constant_wo_interval(True)),
                 [
                     _without_adaption(_equals_interval(Empty())),
                     _w_max_upper_adaption(20, _equals_interval(Empty())),
                 ],
             ),
             CaseWAdaptionVariants(
                 'matcher w interval / point',
                 Negation(_MatcherWInterval(point(5))),
                 [
                     _without_adaption(_equals_negation_of(point(5))),
                     _w_max_upper_adaption(
                         20, _equals_interval(UpperLimit(20))),
                 ],
             ),
             CaseWAdaptionVariants(
                 'matcher w interval / upper limit',
                 Negation(_MatcherWInterval(UpperLimit(10))),
                 [
                     _without_adaption(_equals_interval(
                         LowerLimit(10 + 1))),
                     _w_max_upper_adaption(
                         20, _equals_interval(Finite(10 + 1, 20))),
                 ],
             ),
             CaseWAdaptionVariants(
                 'matcher wo interval',
                 Negation(_matcher_wo_interval()),
                 [
                     _without_adaption(
                         _equals_interval(
                             unlimited_with_unlimited_inversion())),
                     _w_max_upper_adaption(
                         20, _equals_interval(UpperLimit(20))),
                 ],
             ),
         ])
예제 #4
0
 def test_point_lower(self):
     _check_permutations(self, [
         Case(
             point(3),
             LowerLimit(5),
             union=PosNeg(LowerLimit(3), UpperLimit(3 - 1)),
             intersection=PosNeg(empty, unlimited),
         ),
         Case(
             point(4),
             LowerLimit(5),
             union=PosNeg(LowerLimit(4), UpperLimit(4 - 1)),
             intersection=PosNeg(empty, unlimited),
         ),
         Case(
             point(5),
             LowerLimit(5),
             union=PosNeg(LowerLimit(5), UpperLimit(5 - 1)),
             intersection=PosNeg(point(5), unlimited),
         ),
         Case(
             point(6),
             LowerLimit(5),
             union=PosNeg(LowerLimit(5), UpperLimit(5 - 1)),
             intersection=PosNeg(point(6), unlimited),
         ),
         Case(
             point(7),
             LowerLimit(5),
             union=PosNeg(LowerLimit(5), UpperLimit(5 - 1)),
             intersection=PosNeg(point(7), unlimited),
         ),
     ])
예제 #5
0
 def runTest(self):
     _check_single(
         self,
         sut.point(7),
         matches_point(7),
         matches_unlimited(),
     )
예제 #6
0
 def test_lower_upper(self):
     _check_permutations(self, [
         Case(
             LowerLimit(3),
             UpperLimit(5),
             union=PosNeg(unlimited, empty),
             intersection=PosNeg(Finite(3, 5), unlimited),
         ),
         Case(
             LowerLimit(4),
             UpperLimit(5),
             union=PosNeg(unlimited, empty),
             intersection=PosNeg(Finite(4, 5), unlimited),
         ),
         Case(
             LowerLimit(5),
             UpperLimit(5),
             union=PosNeg(unlimited, empty),
             intersection=PosNeg(point(5), unlimited),
         ),
         Case(
             LowerLimit(6),
             UpperLimit(5),
             union=PosNeg(unlimited, empty),
             intersection=PosNeg(empty, unlimited),
         ),
         Case(
             LowerLimit(7),
             UpperLimit(5),
             union=PosNeg(unlimited, empty),
             intersection=PosNeg(empty, unlimited),
         ),
     ])
예제 #7
0
 def test_upper_finite(self):
     _check_permutations(self, [
         Case(
             UpperLimit(3),
             Finite(5, 9),
             union=PosNeg(UpperLimit(9), LowerLimit(9 + 1)),
             intersection=PosNeg(empty, unlimited),
         ),
         Case(
             UpperLimit(4),
             Finite(5, 9),
             union=PosNeg(UpperLimit(9), LowerLimit(9 + 1)),
             intersection=PosNeg(empty, unlimited),
         ),
         Case(
             UpperLimit(5),
             Finite(5, 9),
             union=PosNeg(UpperLimit(9), LowerLimit(9 + 1)),
             intersection=PosNeg(point(5), unlimited),
         ),
         Case(
             UpperLimit(6),
             Finite(5, 9),
             union=PosNeg(UpperLimit(9), LowerLimit(9 + 1)),
             intersection=PosNeg(Finite(5, 6), unlimited),
         ),
         Case(
             UpperLimit(7),
             Finite(5, 9),
             union=PosNeg(UpperLimit(9), LowerLimit(9 + 1)),
             intersection=PosNeg(Finite(5, 7), unlimited),
         ),
         Case(
             UpperLimit(8),
             Finite(5, 9),
             union=PosNeg(UpperLimit(9), LowerLimit(9 + 1)),
             intersection=PosNeg(Finite(5, 8), unlimited),
         ),
         Case(
             UpperLimit(9),
             Finite(5, 9),
             union=PosNeg(UpperLimit(9), LowerLimit(9 + 1)),
             intersection=PosNeg(Finite(5, 9), unlimited),
         ),
         Case(
             UpperLimit(10),
             Finite(5, 9),
             union=PosNeg(UpperLimit(10), LowerLimit(10 + 1)),
             intersection=PosNeg(Finite(5, 9), unlimited),
         ),
         Case(
             UpperLimit(11),
             Finite(5, 9),
             union=PosNeg(UpperLimit(11), LowerLimit(11 + 1)),
             intersection=PosNeg(Finite(5, 9), unlimited),
         ),
     ])
예제 #8
0
 def test_lower_finite(self):
     _check_permutations(self, [
         Case(
             LowerLimit(3),
             Finite(5, 9),
             union=PosNeg(LowerLimit(3), UpperLimit(3 - 1)),
             intersection=PosNeg(Finite(5, 9), unlimited),
         ),
         Case(
             LowerLimit(4),
             Finite(5, 9),
             union=PosNeg(LowerLimit(4), UpperLimit(4 - 1)),
             intersection=PosNeg(Finite(5, 9), unlimited),
         ),
         Case(
             LowerLimit(5),
             Finite(5, 9),
             union=PosNeg(LowerLimit(5), UpperLimit(5 - 1)),
             intersection=PosNeg(Finite(5, 9), unlimited),
         ),
         Case(
             LowerLimit(6),
             Finite(5, 9),
             union=PosNeg(LowerLimit(5), UpperLimit(5 - 1)),
             intersection=PosNeg(Finite(6, 9), unlimited),
         ),
         Case(
             LowerLimit(7),
             Finite(5, 9),
             union=PosNeg(LowerLimit(5), UpperLimit(5 - 1)),
             intersection=PosNeg(Finite(7, 9), unlimited),
         ),
         Case(
             LowerLimit(8),
             Finite(5, 9),
             union=PosNeg(LowerLimit(5), UpperLimit(5 - 1)),
             intersection=PosNeg(Finite(8, 9), unlimited),
         ),
         Case(
             LowerLimit(9),
             Finite(5, 9),
             union=PosNeg(LowerLimit(5), UpperLimit(5 - 1)),
             intersection=PosNeg(point(9), unlimited),
         ),
         Case(
             LowerLimit(10),
             Finite(5, 9),
             union=PosNeg(LowerLimit(5), UpperLimit(5 - 1)),
             intersection=PosNeg(empty, unlimited),
         ),
         Case(
             LowerLimit(11),
             Finite(5, 9),
             union=PosNeg(LowerLimit(5), UpperLimit(5 - 1)),
             intersection=PosNeg(empty, unlimited),
         ),
     ])
예제 #9
0
 def runTest(self):
     _check_adaption_variant_cases(
         self,
         interval_of_unknown_class=point(72),
         cases=[
             CaseWAdaptionVariants(
                 'point',
                 _MatcherWInterval(point(5)),
                 [
                     _without_adaption(_equals_interval(point(5))),
                     _w_max_upper_adaption(3, _equals_interval(Empty())),
                 ],
             ),
             CaseWAdaptionVariants(
                 'upper limit',
                 _MatcherWInterval(UpperLimit(12)),
                 [
                     _without_adaption(_equals_interval(UpperLimit(12))),
                     _w_max_upper_adaption(
                         10, _equals_interval(UpperLimit(10))),
                 ],
             ),
         ])
예제 #10
0
 def runTest(self):
     interval_of_matcher = point(28)
     _check_adaption_variant_cases(
         self,
         interval_of_unknown_class=point(72),
         cases=[
             CaseWAdaptionVariants(
                 str(False),
                 _ConstantMatcherWInterval(False, interval_of_matcher),
                 [
                     _without_adaption(_equals_interval(Empty())),
                     _w_max_upper_adaption(50, _equals_interval(Empty())),
                 ],
             ),
             CaseWAdaptionVariants(
                 str(True),
                 _ConstantMatcherWInterval(True, interval_of_matcher),
                 [
                     _without_adaption(_equals_interval(Unlimited())),
                     _w_max_upper_adaption(
                         50, _equals_interval(UpperLimit(50))),
                 ],
             ),
         ])
예제 #11
0
 def test_point_point(self):
     _check_permutations(self, [
         Case(
             point(7),
             point(7),
             union=PosNeg(point(7), unlimited),
             intersection=PosNeg(point(7), unlimited),
         ),
         Case(
             point(3),
             point(7),
             union=PosNeg(Finite(3, 7), unlimited),
             intersection=PosNeg(empty, unlimited),
         ),
     ])
예제 #12
0
def _int_interval_of_ne(x: int) -> IntIntervalWInversion:
    return intervals.unlimited_with_finite_inversion(intervals.point(x))
예제 #13
0
 def test_finite_finite(self):
     _check_permutations(
         self,
         [
             Case(
                 Finite(2, 3),
                 Finite(5, 9),
                 union=PosNeg(Finite(2, 9), unlimited),
                 intersection=PosNeg(empty, unlimited),
             ),
             Case(
                 Finite(2, 4),
                 Finite(5, 9),
                 union=PosNeg(Finite(2, 9), unlimited),
                 intersection=PosNeg(empty, unlimited),
             ),
             Case(
                 Finite(2, 5),
                 Finite(5, 9),
                 union=PosNeg(Finite(2, 9), unlimited),
                 intersection=PosNeg(point(5), unlimited),
             ),
             Case(
                 Finite(2, 6),
                 Finite(5, 9),
                 union=PosNeg(Finite(2, 9), unlimited),
                 intersection=PosNeg(Finite(5, 6), unlimited),
             ),
             Case(
                 Finite(2, 7),
                 Finite(5, 9),
                 union=PosNeg(Finite(2, 9), unlimited),
                 intersection=PosNeg(Finite(5, 7), unlimited),
             ),
             Case(
                 Finite(2, 8),
                 Finite(5, 9),
                 union=PosNeg(Finite(2, 9), unlimited),
                 intersection=PosNeg(Finite(5, 8), unlimited),
             ),
             Case(
                 Finite(2, 9),
                 Finite(5, 9),
                 union=PosNeg(Finite(2, 9), unlimited),
                 intersection=PosNeg(Finite(5, 9), unlimited),
             ),
             Case(
                 Finite(2, 10),
                 Finite(5, 9),
                 union=PosNeg(Finite(2, 10), unlimited),
                 intersection=PosNeg(Finite(5, 9), unlimited),
             ),
             Case(
                 Finite(2, 11),
                 Finite(5, 9),
                 union=PosNeg(Finite(2, 11), unlimited),
                 intersection=PosNeg(Finite(5, 9), unlimited),
             ),
             # same lower
             Case(
                 Finite(5, 6),
                 Finite(5, 9),
                 union=PosNeg(Finite(5, 9), unlimited),
                 intersection=PosNeg(Finite(5, 6), unlimited),
             ),
             Case(
                 Finite(5, 7),
                 Finite(5, 9),
                 union=PosNeg(Finite(5, 9), unlimited),
                 intersection=PosNeg(Finite(5, 7), unlimited),
             ),
             Case(
                 Finite(5, 8),
                 Finite(5, 9),
                 union=PosNeg(Finite(5, 9), unlimited),
                 intersection=PosNeg(Finite(5, 8), unlimited),
             ),
             Case(
                 Finite(5, 9),
                 Finite(5, 9),
                 union=PosNeg(Finite(5, 9), unlimited),
                 intersection=PosNeg(Finite(5, 9), unlimited),
             ),
             Case(
                 Finite(5, 10),
                 Finite(5, 9),
                 union=PosNeg(Finite(5, 10), unlimited),
                 intersection=PosNeg(Finite(5, 9), unlimited),
             ),
             Case(
                 Finite(5, 11),
                 Finite(5, 9),
                 union=PosNeg(Finite(5, 11), unlimited),
                 intersection=PosNeg(Finite(5, 9), unlimited),
             ),
             # lower inside the other
             Case(
                 Finite(7, 8),
                 Finite(5, 9),
                 union=PosNeg(Finite(5, 9), unlimited),
                 intersection=PosNeg(Finite(7, 8), unlimited),
             ),
             Case(
                 Finite(7, 9),
                 Finite(5, 9),
                 union=PosNeg(Finite(5, 9), unlimited),
                 intersection=PosNeg(Finite(7, 9), unlimited),
             ),
             Case(
                 Finite(7, 10),
                 Finite(5, 9),
                 union=PosNeg(Finite(5, 10), unlimited),
                 intersection=PosNeg(Finite(7, 9), unlimited),
             ),
             Case(
                 Finite(7, 11),
                 Finite(5, 9),
                 union=PosNeg(Finite(5, 11), unlimited),
                 intersection=PosNeg(Finite(7, 9), unlimited),
             ),
             # same upper,lower
             Case(
                 Finite(9, 10),
                 Finite(5, 9),
                 union=PosNeg(Finite(5, 10), unlimited),
                 intersection=PosNeg(point(9), unlimited),
             ),
             Case(
                 Finite(9, 11),
                 Finite(5, 9),
                 union=PosNeg(Finite(5, 11), unlimited),
                 intersection=PosNeg(point(9), unlimited),
             ),
         ])
예제 #14
0
 def test_point_finite(self):
     _check_permutations(self, [
         Case(
             point(3),
             Finite(5, 9),
             union=PosNeg(Finite(3, 9), unlimited),
             intersection=PosNeg(empty, unlimited),
         ),
         Case(
             point(4),
             Finite(5, 9),
             union=PosNeg(Finite(4, 9), unlimited),
             intersection=PosNeg(empty, unlimited),
         ),
         Case(
             point(5),
             Finite(5, 9),
             union=PosNeg(Finite(5, 9), unlimited),
             intersection=PosNeg(point(5), unlimited),
         ),
         Case(
             point(6),
             Finite(5, 9),
             union=PosNeg(Finite(5, 9), unlimited),
             intersection=PosNeg(point(6), unlimited),
         ),
         Case(
             point(7),
             Finite(5, 9),
             union=PosNeg(Finite(5, 9), unlimited),
             intersection=PosNeg(point(7), unlimited),
         ),
         Case(
             point(8),
             Finite(5, 9),
             union=PosNeg(Finite(5, 9), unlimited),
             intersection=PosNeg(point(8), unlimited),
         ),
         Case(
             point(9),
             Finite(5, 9),
             union=PosNeg(Finite(5, 9), unlimited),
             intersection=PosNeg(point(9), unlimited),
         ),
         Case(
             point(10),
             Finite(5, 9),
             union=PosNeg(Finite(5, 10), unlimited),
             intersection=PosNeg(empty, unlimited),
         ),
         Case(
             point(11),
             Finite(5, 9),
             union=PosNeg(Finite(5, 11), unlimited),
             intersection=PosNeg(empty, unlimited),
         ),
     ])
예제 #15
0
 def test_point_upper(self):
     _check_permutations(self, [
         Case(
             point(-3),
             UpperLimit(0),
             union=PosNeg(UpperLimit(0), LowerLimit(0 + 1)),
             intersection=PosNeg(point(-3), unlimited),
         ),
         Case(
             point(6),
             UpperLimit(9),
             union=PosNeg(UpperLimit(9), LowerLimit(9 + 1)),
             intersection=PosNeg(point(6), unlimited),
         ),
         Case(
             point(7),
             UpperLimit(9),
             union=PosNeg(UpperLimit(9), LowerLimit(9 + 1)),
             intersection=PosNeg(point(7), unlimited),
         ),
         Case(
             point(8),
             UpperLimit(9),
             union=PosNeg(UpperLimit(9), LowerLimit(9 + 1)),
             intersection=PosNeg(point(8), unlimited),
         ),
         Case(
             point(9),
             UpperLimit(9),
             union=PosNeg(UpperLimit(9), LowerLimit(9 + 1)),
             intersection=PosNeg(point(9), unlimited),
         ),
         Case(
             point(10),
             UpperLimit(9),
             union=PosNeg(UpperLimit(10), LowerLimit(10 + 1)),
             intersection=PosNeg(empty, unlimited),
         ),
         Case(
             point(11),
             UpperLimit(9),
             union=PosNeg(UpperLimit(11), LowerLimit(11 + 1)),
             intersection=PosNeg(empty, unlimited),
         ),
     ])
예제 #16
0
 def test_double_negation(self):
     _check_adaption_variant_cases(
         self,
         interval_of_unknown_class=unlimited_with_unlimited_inversion(),
         cases=[
             CaseWAdaptionVariants(
                 'constant F',
                 Negation(Negation(_constant_wo_interval(False))),
                 [
                     _without_adaption(_equals_interval(Empty())),
                     _w_max_upper_adaption(20, _equals_interval(Empty())),
                 ],
             ),
             CaseWAdaptionVariants(
                 'constant T',
                 Negation(Negation(_constant_wo_interval(True))),
                 [
                     _without_adaption(_equals_interval(Unlimited())),
                     _w_max_upper_adaption(
                         20, _equals_interval(UpperLimit(20))),
                 ],
             ),
             CaseWAdaptionVariants(
                 'matcher w interval / point',
                 Negation(Negation(_MatcherWInterval(point(5)))),
                 [
                     _without_adaption(_equals_interval(point(5))),
                     _w_max_upper_adaption(0, _equals_interval(Empty())),
                 ],
             ),
             CaseWAdaptionVariants(
                 'matcher w interval / upper limit',
                 Negation(Negation(_MatcherWInterval(UpperLimit(10)))),
                 [
                     _without_adaption(_equals_interval(UpperLimit(10))),
                     _w_max_upper_adaption(5, _equals_interval(
                         UpperLimit(5))),
                 ],
             ),
             CaseWAdaptionVariants(
                 'matcher wo interval',
                 Negation(Negation(_matcher_wo_interval())),
                 [
                     _without_adaption(
                         _equals_interval(
                             unlimited_with_unlimited_inversion())),
                     _w_max_upper_adaption(
                         20, _equals_interval(UpperLimit(20))),
                 ],
             ),
             CaseWAdaptionVariants(
                 'conjunction, all w interval',
                 Negation(
                     Negation(
                         Conjunction([
                             _MatcherWInterval(UpperLimit(10)),
                             _MatcherWInterval(UpperLimit(10 + 5)),
                         ]))),
                 [
                     _without_adaption(_equals_interval(UpperLimit(10))),
                     _w_max_upper_adaption(5, _equals_interval(
                         UpperLimit(5))),
                 ],
             ),
             CaseWAdaptionVariants(
                 'conjunction, one w unlimited-negation',
                 Negation(
                     Negation(
                         Conjunction([
                             _MatcherWInterval(UpperLimit(10)),
                             _matcher_wo_interval(),
                         ]))),
                 [
                     _without_adaption(_equals_interval(UpperLimit(10))),
                     _w_max_upper_adaption(5, _equals_interval(
                         UpperLimit(5))),
                 ],
             ),
             CaseWAdaptionVariants(
                 'disjunction, all w interval',
                 Negation(
                     Negation(
                         Disjunction([
                             _MatcherWInterval(UpperLimit(10)),
                             _MatcherWInterval(UpperLimit(10 + 5)),
                         ]))),
                 [
                     _without_adaption(_equals_interval(
                         UpperLimit(10 + 5))),
                     _w_max_upper_adaption(5, _equals_interval(
                         UpperLimit(5))),
                 ],
             ),
             CaseWAdaptionVariants(
                 'disjunction, one w unlimited-negation',
                 Negation(
                     Negation(
                         Disjunction([
                             _MatcherWInterval(UpperLimit(10)),
                             _matcher_wo_interval(),
                         ]))),
                 [
                     _without_adaption(_equals_interval(Unlimited())),
                     _w_max_upper_adaption(5, _equals_interval(
                         UpperLimit(5))),
                 ],
             ),
         ])