mirror of
https://forge.katzen.cafe/katzen-cafe/iowo.git
synced 2024-11-26 23:08:44 +01:00
app, prowocessing: move dev commands to tests
This commit is contained in:
parent
0705702d4a
commit
18309ec919
|
@ -60,38 +60,11 @@ mod dev {
|
||||||
use clap::Subcommand;
|
use clap::Subcommand;
|
||||||
|
|
||||||
#[derive(Subcommand)]
|
#[derive(Subcommand)]
|
||||||
pub(crate) enum DevCommands {
|
pub(crate) enum DevCommands {}
|
||||||
Enums { test_str: String },
|
|
||||||
Add { num0: i32, num1: i32 },
|
|
||||||
}
|
|
||||||
|
|
||||||
impl DevCommands {
|
impl DevCommands {
|
||||||
pub fn run(self) {
|
pub fn run(self) {
|
||||||
match self {
|
println!("There are currently no dev commands.");
|
||||||
DevCommands::Enums { test_str } => {
|
|
||||||
use prowocessing::experimental::enum_based::PipelineBuilder;
|
|
||||||
|
|
||||||
let upr = PipelineBuilder::new()
|
|
||||||
.insert(prowocessing::experimental::enum_based::Instruction::Uppercase)
|
|
||||||
.build();
|
|
||||||
let lwr = PipelineBuilder::new()
|
|
||||||
.insert(prowocessing::experimental::enum_based::Instruction::Lowercase)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
println!("Upr: {}", upr.run(test_str.clone()));
|
|
||||||
println!("Lwr: {}", lwr.run(test_str.clone()));
|
|
||||||
}
|
|
||||||
DevCommands::Add { num0, num1 } => {
|
|
||||||
use prowocessing::experimental::trait_based::pipeline::PipelineBuilder;
|
|
||||||
|
|
||||||
let pipe = PipelineBuilder::new().add(1).stringify().build();
|
|
||||||
println!(
|
|
||||||
"{:?}",
|
|
||||||
pipe.run(vec![&num0.into(), &num1.into()].into())
|
|
||||||
.into_inner()[0]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,13 +8,33 @@
|
||||||
/// Gonna first try string processing...
|
/// Gonna first try string processing...
|
||||||
pub mod experimental;
|
pub mod experimental;
|
||||||
|
|
||||||
#[test]
|
#[cfg(test)]
|
||||||
fn test_enums() {
|
mod tests {
|
||||||
use crate::experimental::enum_based::{Instruction, PipelineBuilder};
|
use crate::experimental::{
|
||||||
let builder = PipelineBuilder::new().insert(Instruction::Uppercase);
|
enum_based,
|
||||||
let upr = builder.build();
|
trait_based::{self, data::io::Outputs},
|
||||||
let upr_lowr = builder.insert(Instruction::Lowercase).build();
|
};
|
||||||
|
|
||||||
assert_eq!(upr.run(String::from("Test")), String::from("TEST"));
|
#[test]
|
||||||
assert_eq!(upr_lowr.run(String::from("Test")), String::from("test"));
|
fn test_enums() {
|
||||||
|
let builder = enum_based::PipelineBuilder::new().insert(enum_based::Instruction::Uppercase);
|
||||||
|
let upr = builder.build();
|
||||||
|
let upr_lowr = builder.insert(enum_based::Instruction::Lowercase).build();
|
||||||
|
|
||||||
|
assert_eq!(upr.run(String::from("Test")), String::from("TEST"));
|
||||||
|
assert_eq!(upr_lowr.run(String::from("Test")), String::from("test"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn add() {
|
||||||
|
let pipe = trait_based::pipeline::PipelineBuilder::new()
|
||||||
|
.add(0)
|
||||||
|
.stringify()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
pipe.run(vec![&2.into(), &3.into()].into()),
|
||||||
|
Outputs(vec![String::from("5").into()])
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue