From 6ac297d61f7de0f7fb4c33ef8b3b868c81c658b0 Mon Sep 17 00:00:00 2001 From: Loong <40141251+wangl-cc@users.noreply.github.com> Date: Sat, 12 Oct 2024 11:40:20 -0700 Subject: [PATCH] fix: task name of reclamation algorithm (#336) Part of #335 --- maa-cli/src/run/preset/reclamation.rs | 4 ++-- maa-sys/src/task_type.rs | 15 ++++++--------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/maa-cli/src/run/preset/reclamation.rs b/maa-cli/src/run/preset/reclamation.rs index cb7945fd..9065c47a 100644 --- a/maa-cli/src/run/preset/reclamation.rs +++ b/maa-cli/src/run/preset/reclamation.rs @@ -63,7 +63,7 @@ pub struct ReclamationParams { impl super::ToTaskType for ReclamationParams { fn to_task_type(&self) -> super::TaskType { - super::TaskType::ReclamationAlgorithm + super::TaskType::Reclamation } } @@ -121,7 +121,7 @@ mod tests { match command { crate::Command::Reclamation { params, .. } => { use super::super::{TaskType, ToTaskType}; - assert_eq!(params.to_task_type(), TaskType::ReclamationAlgorithm); + assert_eq!(params.to_task_type(), TaskType::Reclamation); params.into() } _ => panic!("Not a Reclamation command"), diff --git a/maa-sys/src/task_type.rs b/maa-sys/src/task_type.rs index d5cbba95..13d99c90 100644 --- a/maa-sys/src/task_type.rs +++ b/maa-sys/src/task_type.rs @@ -14,7 +14,7 @@ pub enum TaskType { SSSCopilot, Depot, OperBox, - ReclamationAlgorithm, + Reclamation, Custom, SingleStep, VideoRecognition, @@ -55,7 +55,7 @@ impl TaskType { Self::SSSCopilot => "SSSCopilot", Self::Depot => "Depot", Self::OperBox => "OperBox", - Self::ReclamationAlgorithm => "ReclamationAlgorithm", + Self::Reclamation => "Reclamation", Self::Custom => "Custom", Self::SingleStep => "SingleStep", Self::VideoRecognition => "VideoRecognition", @@ -164,7 +164,7 @@ mod tests { assert_eq!("SSSCopilot".parse(), Ok(SSSCopilot)); assert_eq!("Depot".parse(), Ok(Depot)); assert_eq!("OperBox".parse(), Ok(OperBox)); - assert_eq!("ReclamationAlgorithm".parse(), Ok(ReclamationAlgorithm)); + assert_eq!("Reclamation".parse(), Ok(Reclamation)); assert_eq!("Custom".parse(), Ok(Custom)); assert_eq!("SingleStep".parse(), Ok(SingleStep)); assert_eq!("VideoRecognition".parse(), Ok(VideoRecognition)); @@ -176,7 +176,7 @@ mod tests { UnknownTaskType("Unknown".to_owned()).to_string(), "unknown task type `Unknown`, expected one of `StartUp`, `CloseDown`, `Fight`, \ `Recruit`, `Infrast`, `Mall`, `Award`, `Roguelike`, `Copilot`, `SSSCopilot`, \ - `Depot`, `OperBox`, `ReclamationAlgorithm`, `Custom`, `SingleStep`, `VideoRecognition`", + `Depot`, `OperBox`, `Reclamation`, `Custom`, `SingleStep`, `VideoRecognition`", ); } @@ -204,7 +204,7 @@ mod tests { &[Token::Str("Unknown")], "unknown variant `Unknown`, expected one of `StartUp`, `CloseDown`, `Fight`, \ `Recruit`, `Infrast`, `Mall`, `Award`, `Roguelike`, `Copilot`, `SSSCopilot`, \ - `Depot`, `OperBox`, `ReclamationAlgorithm`, `Custom`, `SingleStep`, `VideoRecognition`", + `Depot`, `OperBox`, `Reclamation`, `Custom`, `SingleStep`, `VideoRecognition`", ); } } @@ -223,10 +223,7 @@ mod tests { assert_eq!(SSSCopilot.to_str(), "SSSCopilot"); assert_eq!(Depot.to_str(), "Depot"); assert_eq!(OperBox.to_str(), "OperBox"); - assert_eq!( - TaskType::ReclamationAlgorithm.to_str(), - "ReclamationAlgorithm", - ); + assert_eq!(Reclamation.to_str(), "Reclamation",); assert_eq!(Custom.to_str(), "Custom"); assert_eq!(SingleStep.to_str(), "SingleStep"); assert_eq!(VideoRecognition.to_str(), "VideoRecognition");