def test_get_stages_1(self): domain_file = "../../input/domain_grid.pddl" problem_file = "../../input/gw01.pddl" predicates_list = dom_par.get_domain_json( "../../input/domain_grid.pddl") plan = step1.get_plan(domain_file, problem_file) problem_json = step2.get_problem_json(problem_file, predicates_list) stages = step3.get_stages(plan, problem_json, problem_file, predicates_list) self.assertTrue(stages)
def test_get_problem_json(self): # the amount of stages generated domain_file = "../../input/domain_grid.pddl" problem_file = "../../input/gw01.pddl" predicates_list = dom_par.get_domain_json( "../../input/domain_grid.pddl") plan = step1.get_plan(domain_file, problem_file) problem_json = step2.get_problem_json(problem_file, predicates_list) self.assertTrue(problem_json)
def test_get_stages_2(self): # the amount of stages generated domain_file = "../../input/domain_grid.pddl" problem_file = "../../input/gw01.pddl" predicates_list = dom_par.get_domain_json( "../../input/domain_grid.pddl") plan = step1.get_plan(domain_file, problem_file) problem_json = step2.get_problem_json(problem_file, predicates_list) stages = step3.get_stages(plan, problem_json, problem_file, predicates_list) result = len(stages["stages"]) - 1 # minus initial stage # the amount of stages expected expect = plan['result']['length'] self.assertTrue(result is expect)
def test_integration_number_of_stages_step1234(self): # the amount of stages generated domain_file = "../../input/domain_grid.pddl" problem_file = "../../input/gw01.pddl" predicates_list = dom_par.get_domain_json("../../input/domain_grid.pddl") plan = step1.get_plan(domain_file, problem_file) problem_json = step2.get_problem_json(problem_file, predicates_list) stages = step3.get_stages(plan, problem_json, problem_file,predicates_list) objectList = copy.deepcopy(stages["objects"]) stages = copy.deepcopy(stages["stages"]) register = 1 for counter in range(0, len(stages)): if ("add" in stages[counter].keys()): register += 1 self.assertTrue(register - 1 == plan['result']['length'])
def test_output_contains_all_items(self): result = False test_input = "(key-shape ?k ?s) " \ "(lock-shape ?x ?s) " \ "(at ?r ?x )(at-robot ?x)" \ "(place ?p)(key ?k)(shape ?s)" \ "(locked ?x)(holding ?k)(open ?x)" \ "(arm-empty )" test_output = step1.get_domain_json("../../input/domain_grid.pddl") for k, v in test_output.items(): if k in test_output: result = True else: result = False break self.assertTrue(result)
def test_get_stages_3(self): # the amount of stages generated domain_file = "../../input/domain_grid.pddl" problem_file = "../../input/gw01.pddl" predicates_list = dom_par.get_domain_json( "../../input/domain_grid.pddl") plan = step1.get_plan(domain_file, problem_file) problem_json = step2.get_problem_json(problem_file, predicates_list) stages = step3.get_stages(plan, problem_json, problem_file, predicates_list) result = True for counter1 in range(0, len(stages)): temp = stages["stages"][counter1]["items"] for counter2 in range(0, len(temp)): if " " in temp[counter2]["name"]: result = False break self.assertTrue(result)
def test_integration_number_of_stages_step1234(self): # amount of stages from step 123 domain_file = "../../input/domain_blocks.pddl" problem_file = "../../input/bw08.pddl" predicates_list = dom_par.get_domain_json( "../../input/domain_blocks.pddl") plan = step1.get_plan(domain_file, problem_file) problem_json = step2.get_problem_json(problem_file, predicates_list) stages = step3.get_stages(plan, problem_json, problem_file, predicates_list) objectList = copy.deepcopy(stages["objects"]) stages = copy.deepcopy(stages["stages"]) register = 1 for counter in range(0, len(stages)): if ("add" in stages[counter].keys()): register += 1 # amount of stages from step 4 fileop = open("../../input/visualisation.json") strfile = fileop.read() st = json.loads(strfile)["visualStages"] self.assertTrue(len(st) == register)
def test_output_is_not_empty(self): test_output = step1.get_domain_json("../../input/domain_grid.pddl") self.assertTrue(test_output)