feat: Add proper handling in testcase runner and add testing json file

This commit is contained in:
Alivecow 2024-11-20 19:50:26 +01:00
parent c3ea652c87
commit bad946e9ac
2 changed files with 36 additions and 1 deletions

View file

@ -121,7 +121,13 @@ pub fn task_deploy(testcase: &Testcase) -> Result<Value> {
Ok(json)
}
"gfpoly_sort" => {
let result = gfpoly_sort(args)?;
let sorted_array = gfpoly_sort(args)?;
let mut result: Vec<Vec<String>> = vec![];
for poly in sorted_array {
result.push(poly.to_c_array());
}
let json = json!({"sorted_polys" : json!(result)});
Ok(json)

29
test_json/poly_algs.json Normal file
View file

@ -0,0 +1,29 @@
{
"testcases": {
"b856d760-023d-4b00-bad2-15d2b6da22fe": {
"action": "gfpoly_sort",
"arguments": {
"polys": [
[
"NeverGonnaGiveYouUpAAA==",
"NeverGonnaLetYouDownAA==",
"NeverGonnaRunAroundAAA==",
"AndDesertYouAAAAAAAAAA=="
],
[
"WereNoStrangersToLoveA==",
"YouKnowTheRulesAAAAAAA==",
"AndSoDoIAAAAAAAAAAAAAA=="
],
[
"NeverGonnaMakeYouCryAA==",
"NeverGonnaSayGoodbyeAA==",
"NeverGonnaTellALieAAAA==",
"AndHurtYouAAAAAAAAAAAA=="
]
]
}
}
}
}