def test_reward_for_furniture_outside_room(self): """Test if there is an appropriate reward/penalty for furniture that doesn't fit into the room. """ furniture_dict = {'Sofa': fun.Sofa(30, 0)} self.set_furniture(furniture_dict) actual_reward = evals.reward_for_furniture_inside_room(self.room) self.assertEqual(actual_reward, -50)
def test_too_big_spectator_angle(self): """In this test spectator angle is bigger than 30 degrees.""" furniture_dict = {'TV': fun.TV(4, 14), 'Sofa': fun.Sofa(8, 18)} self.set_furniture(furniture_dict) actual_reward = evals.reward_for_tv_sofa_angle(self.room) self.assertAlmostEqual(actual_reward, -900.0, delta=0.01) flip(furniture_dict['TV'].figure) flip(furniture_dict['Sofa'].figure) actual_reward = evals.reward_for_tv_sofa_angle(self.room) self.assertAlmostEqual(actual_reward, -900.0, delta=0.01)
def test_no_intersections_exist(self): """In this test any item should not intersect.""" furniture_dict = { 'Wardrobe1': fun.Wardrobe(4, 10), 'Wardrobe2': fun.Wardrobe(1, -6), 'TV': fun.TV(6, 23), 'Sofa': fun.Sofa(7, 18), 'Table': fun.Table(-10, 4), 'Chair1': fun.Chair(-12, 11), 'Chair2': fun.Chair(-8, 12), 'Chair3': fun.Chair(1, 1), 'Chair4': fun.Chair(16, 15), 'Desk': fun.Desk(-20, 5) } self.set_furniture(furniture_dict) actual_reward = evals.reward_for_intersections(self.room) self.assertAlmostEqual(actual_reward, 0, delta=0.01)