From 63e8214974af74738e7faa32b21ba344e9cb6f01 Mon Sep 17 00:00:00 2001 From: polsevev Date: Fri, 3 Mar 2023 20:06:40 +0100 Subject: [PATCH] testing github action --- src/Algorithm.rs | 23 ++++++++--------------- src/main.rs | 1 + 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/Algorithm.rs b/src/Algorithm.rs index f61758e..8ba214c 100644 --- a/src/Algorithm.rs +++ b/src/Algorithm.rs @@ -1,6 +1,4 @@ -use crate::BarPlugin::Bar; -use crate::GuiHookVec; use crate::GuiHookVec::GuiVec; use crate::GuiHookVec::SortingList; @@ -9,9 +7,6 @@ use crate::GuiHookVec::SortingList; use std::collections::BinaryHeap; use std::collections::HashMap; -use std::collections::HashSet; -use std::f32::consts::PI; -use std::hash::Hash; #[derive(Debug, Clone)] @@ -34,6 +29,7 @@ impl Algorithm{ "binaryHeap" => Algorithm::binaryHeap(&mut list).await, "quickSort" => Algorithm::quickSort(&mut list).await, "radixSort" => Algorithm::radixSort(&mut list).await, + "stalinSort" => Algorithm::stalinSort(&mut list).await, _ => panic!("No algorithm with that name implemented!") } @@ -54,10 +50,8 @@ impl Algorithm{ } } - /* - pub fn stalinSort(length:i32){ - let mut list = GuiVec::new(screen_width(), screen_height(), length); - list.randomize(); + + pub async fn stalinSort(list:&mut impl SortingList){ let mut cur = 1; loop{ @@ -65,15 +59,17 @@ impl Algorithm{ break; } if list.lessThan(cur, cur-1){ - list.delete(cur); + let mut temp = list.get(cur).clone(); + temp.position = 0; + if list.set(cur, temp).await {return}; }else{ cur += 1; } - yield list.clone(); + } } - */ + pub async fn bubbleSort(list:&mut impl SortingList){ let n = list.len(); @@ -254,9 +250,6 @@ mod tests { use super::*; - - // ... the other async test - macro_rules! aw { ($e:expr) => { tokio_test::block_on($e) diff --git a/src/main.rs b/src/main.rs index 4dc96a2..c253f8c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -64,6 +64,7 @@ async fn main() { algo = "radixSort"; } + if algo != ""{ Algorithm::Algorithm::run(length, 1.0, algo.to_string()).await; }