feat: task runner adapted for sea128 task

This commit is contained in:
0xalivecow 2024-10-22 12:28:23 +02:00
parent c21c11aed0
commit 3a777cab00
No known key found for this signature in database
3 changed files with 102 additions and 22 deletions

View file

@ -8,6 +8,7 @@ use crate::utils::parse::{Responses, Testcase, Testcases};
use tasks01::{
block2poly::block2poly,
poly2block::{self, poly2block},
sea128::sea128,
};
use anyhow::{anyhow, Result};
@ -36,6 +37,11 @@ pub fn task_deploy(testcase: &Testcase) -> Result<Value> {
let json = json!({"coefficients" : result});
Ok(json)
}
"sea128" => {
let result = sea128(args)?;
let json = json!({"output" : result});
Ok(json)
}
_ => Err(anyhow!("Fatal. No compatible action found")),
}
}
@ -86,4 +92,26 @@ mod tests {
serde_json::to_value(expected).unwrap()
);
}
#[test]
fn test_task_sea128_task_full() {
let json = fs::read_to_string("src/test_json/sea128.json").unwrap();
let parsed = parse_json(json).unwrap();
let expected = json!({
"responses": {
"b856d760-023d-4b00-bad2-15d2b6da22fe": {
"output": "D5FDo3iVBoBN9gVi9/MSKQ=="
},
"254eaee7-05fd-4e0d-8292-9b658a852245": {
"output": "yv66vvrO263eyviIiDNEVQ=="
}
}
});
assert_eq!(
serde_json::to_value(task_distrubute(&parsed)).unwrap(),
serde_json::to_value(expected).unwrap()
);
}
}