Skip to content

Commit

Permalink
refactor orchestrator main to use asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
cpubot committed Sep 15, 2023
1 parent a598133 commit 0336df9
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions orchestrator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use paladin::{
directive::{apply, fold, indexed, lit, map, Evaluator},
get_runtime,
};
use tracing::info;
mod init;

#[derive(Parser, Debug)]
Expand All @@ -26,20 +25,19 @@ async fn main() -> Result<()> {

let concat_input = indexed(['h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', '!']);
let string_concat = fold(StringConcat, map(CharToString, lit(concat_input)));
let result = runtime.evaluate(string_concat).await?;
assert_eq!(result, "hello world!".to_string());

let multiplication = fold(
GenericMultiplication::<i32>::default(),
lit(indexed([1, 2, 3, 4, 5, 6])),
);
let result = runtime.evaluate(multiplication).await?;
assert_eq!(result, 720);

let result: String = runtime.evaluate(string_concat).await?;
info!("{result:?}");

let result: i32 = runtime.evaluate(multiplication).await?;
info!("{result:?}");

let mult: i32 = runtime.evaluate(apply(MultiplyBy(3), lit(2))).await?;
info!("{mult:?}");
let multiply_by = apply(MultiplyBy(3), lit(2));
let result = runtime.evaluate(multiply_by).await?;
assert_eq!(result, 6);

std::future::pending::<()>().await;
Ok(())
Expand Down

0 comments on commit 0336df9

Please sign in to comment.