def test_port_check_float_gt(self): entity = TestEntity() c = check(entity.port) > 200 assert c.check() c = check(entity.port) > 400 self.assertFalse(c.check()) c = check(entity.port) > 314.13 self.assertFalse(c.check())
def test_port_check_float_ge(self): entity = TestEntity() c = check(entity.port) >= 200 assert c.check() c = check(entity.port) >= 314.13 assert c.check() c = check(entity.port) >= 400 self.assertFalse(c.check())
def test_check_false(self): entity = TestEntity() c1 = check(entity.port2) == "ONE" c2 = check(entity) == entity.state chk = c1 & c2 verifier = verif.Verifier() self.assertFalse(verifier.is_possible(chk).check())
def test_port_check_float_ne(self): entity = TestEntity() c = check(entity.port) != 314.13 self.assertFalse(c.check()) c = check(entity.port) != 400 assert c.check() c = check(entity.port) != 200 assert c.check()
def test_system(self): entity = TestEntity() c1 = check(entity.port2) == "TWO" c2 = check(entity) == entity.state chk = c1 | c2 verifier = verif.Verifier() verifier.is_possible(chk) self.assertEqual(verifier.system, entity)
def brainstorming(self): system = System() chk = check(system.port) <= 30 chk2 = check(system) == system.state verif.is_possible(chk & chk2).before(15).after(30).check() verif.never(chk).after(25) verif.always(chk3).before(25) verif.always_possible(chk3, within=25) verif.forever(chk2).after(33) # not(always(not(chk2))) verif.after(40).forever(chk2)
def test_system_different_entities_in_other_port(self): entity = TestEntity() entity2 = TestEntity() c1 = check(entity.port2) < entity2.port2 c2 = check(entity) == entity.state chk = c1 | c2 verifier = verif.Verifier() verifier.is_possible(chk) with self.assertRaises(ValueError) as context: sys = verifier.system self.assertEqual( str(context.exception), f"The checks are from different systems. Please make sure that you only check properties from the same system." )
def test_state_check_neq_string(self): entity = TestEntity() c = check(entity) != "state2" assert c.check()
def test_state_check_neq_fails(self): entity = TestEntity() c = check(entity) != entity.state self.assertFalse(c.check())
def test_state_check_neq(self): entity = TestEntity() c = check(entity) != entity.state2 assert c.check()
def test_state_check_eq(self): entity = TestEntity() c = check(entity) == entity.state assert c.check()
def test_duplicate_check(self): entity = TestEntity() c1 = check(entity.port2) == "TWO" c2 = check(entity) == entity.state c = -(c1 | c2) & c2 self.assertSetEqual(c.get_atomic_checks(), {c1, c2})
def test_state_check(self): entity = TestEntity() c = check(entity) == entity.state self.assertSetEqual(c.get_atomic_checks(), {c})
def test_port_check(self): entity = TestEntity() c = check(entity.port2) == "TWO" self.assertSetEqual(c.get_atomic_checks(), {c})
def test_port_check_list_ne(self): entity = TestEntity() c = check(entity.port2) != "first" assert c.check() c = check(entity.port2) != "TWO" self.assertFalse(c.check())