Skip to content

Commit

Permalink
update unittesting
Browse files Browse the repository at this point in the history
  • Loading branch information
Shawnsdaddy committed Dec 13, 2024
1 parent 29ad47a commit 77f47a1
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions arknights_mower/tests/scheduler_task_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,37 +374,41 @@ def test_adjust_three_orders(self):
def test_reorder_1(self):
# 高优先级被拉前面
op_data = self.init_opdata()
tasks = []
op_data.dorm[0].name = "麒麟R夜刀"
op_data.dorm[1].name = "凯尔希"
op_data.operators["凯尔希"].current_room = "dormitory_2"
op_data.operators["凯尔希"].current_index = 2
op_data.dorm[2].name = "夕"
try_reorder(op_data.plan, None, op_data, tasks)
plan = try_reorder(op_data)
self.assertEqual(len(plan), 2)

def test_reorder_2(self):
# 非高优高效不会被移动
op_data = self.init_opdata()
tasks = []
op_data.dorm[0].name = "麒麟R夜刀"
op_data.dorm[1].name = "凯尔希"
op_data.dorm[2].name = "夕"
op_data.dorm[3].name = "见行者"
op_data.dorm[4].name = "森蚺"
try_reorder(op_data.plan, None, op_data, tasks)
plan = try_reorder(op_data)
self.assertEqual(len(plan), 3)
self.assertEqual(plan["dormitory_1"][2], "夕")
self.assertEqual(plan["dormitory_1"][4], "凯尔希")

def test_reorder_3(self):
# 如果高优都占了,则不动
op_data = self.init_opdata()
tasks = []
op_data.dorm[0].name = "夕"
op_data.dorm[1].name = "焰尾"
op_data.dorm[2].name = "森蚺"
op_data.dorm[3].name = "玛恩纳"
op_data.operators["见行者"].current_room = "dormitory_2"
op_data.operators["见行者"].current_index = 2
op_data.dorm[4].name = "见行者"
try_reorder(op_data.plan, None, op_data, tasks)
try_reorder(op_data)
plan = try_reorder(op_data)
self.assertEqual(plan["dormitory_1"][2], "夕")
self.assertEqual(plan["dormitory_1"][3], "见行者")

def init_opdata(self):
agent_base_config = PlanConfig(
Expand Down

0 comments on commit 77f47a1

Please sign in to comment.