Update docs
This commit is contained in:
1 parent
df39dd80b9
commit
f4160d2387
13 files changed
+106
-197
No files matched your search
+14
-40
@@ -6,9 +6,7 @@ use dagx::*;
|
||||
#[tokio::test]
|
||||
async fn test_empty_dag() {
|
||||
let dag = DagRunner::new();
|
||||
dag.run(|fut| {
|
||||
tokio::spawn(fut);
|
||||
})
|
||||
dag.run()
|
||||
.await
|
||||
.unwrap(); // Should complete without error
|
||||
}
|
||||
@@ -17,9 +15,7 @@ async fn test_empty_dag() {
|
||||
async fn test_single_task() {
|
||||
let dag = DagRunner::new();
|
||||
let task = dag.add_task(task_fn(|_: ()| async { 42 }));
|
||||
dag.run(|fut| {
|
||||
tokio::spawn(fut);
|
||||
})
|
||||
dag.run()
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(dag.get(task).unwrap(), 42);
|
||||
@@ -43,9 +39,7 @@ async fn test_deep_chain() {
|
||||
.add_task(task_fn(|x: i32| async move { x + 1 }))
|
||||
.depends_on(d);
|
||||
|
||||
dag.run(|fut| {
|
||||
tokio::spawn(fut);
|
||||
})
|
||||
dag.run()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -62,9 +56,7 @@ async fn test_wide_parallel() {
|
||||
.map(|i| dag.add_task(task_fn(move |_: ()| async move { i * 2 })))
|
||||
.collect();
|
||||
|
||||
dag.run(|fut| {
|
||||
tokio::spawn(fut);
|
||||
})
|
||||
dag.run()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -88,9 +80,7 @@ async fn test_diamond_dependency() {
|
||||
.add_task(task_fn(|(x, y): (i32, i32)| async move { x + y }))
|
||||
.depends_on((&b, &c));
|
||||
|
||||
dag.run(|fut| {
|
||||
tokio::spawn(fut);
|
||||
})
|
||||
dag.run()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -118,9 +108,7 @@ async fn test_different_output_types() {
|
||||
}
|
||||
}));
|
||||
|
||||
dag.run(|fut| {
|
||||
tokio::spawn(fut);
|
||||
})
|
||||
dag.run()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -153,9 +141,7 @@ async fn test_multiple_sinks() {
|
||||
.add_task(task_fn(|x: i32| async move { x * 3 }))
|
||||
.depends_on(branch2);
|
||||
|
||||
dag.run(|fut| {
|
||||
tokio::spawn(fut);
|
||||
})
|
||||
dag.run()
|
||||
.await
|
||||
.unwrap(); // Should wait for both sinks
|
||||
|
||||
@@ -177,9 +163,7 @@ async fn test_single_task_inline_path() {
|
||||
.add_task(task_fn(|x: i32| async move { x + 5 }))
|
||||
.depends_on(t2);
|
||||
|
||||
dag.run(|fut| {
|
||||
tokio::spawn(fut);
|
||||
})
|
||||
dag.run()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -204,9 +188,7 @@ async fn test_multi_task_spawn_path() {
|
||||
.add_task(task_fn(|x: i32| async move { x + 3 }))
|
||||
.depends_on(&source);
|
||||
|
||||
dag.run(|fut| {
|
||||
tokio::spawn(fut);
|
||||
})
|
||||
dag.run()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -230,9 +212,7 @@ async fn test_producer_consumer_channels() {
|
||||
))
|
||||
.depends_on(&producer);
|
||||
|
||||
dag.run(|fut| {
|
||||
tokio::spawn(fut);
|
||||
})
|
||||
dag.run()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -241,7 +221,7 @@ async fn test_producer_consumer_channels() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_multi_consumer_fanout() {
|
||||
// Test fanout with multiple consumers from one producer (channel creation)
|
||||
// Test fanout with multiple consumers from one producer
|
||||
let dag = DagRunner::new();
|
||||
|
||||
let producer = dag.add_task(task_fn(|_: ()| async { 42 }));
|
||||
@@ -257,9 +237,7 @@ async fn test_multi_consumer_fanout() {
|
||||
.add_task(task_fn(|x: i32| async move { x - 5 }))
|
||||
.depends_on(&producer);
|
||||
|
||||
dag.run(|fut| {
|
||||
tokio::spawn(fut);
|
||||
})
|
||||
dag.run()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -287,9 +265,7 @@ async fn test_compute_layers_with_dependents_tracking() {
|
||||
.add_task(task_fn(|(l, r): (i32, i32)| async move { l + r }))
|
||||
.depends_on((&left, &right));
|
||||
|
||||
dag.run(|fut| {
|
||||
tokio::spawn(fut);
|
||||
})
|
||||
dag.run()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -337,9 +313,7 @@ async fn test_layer_execution_order() {
|
||||
}))
|
||||
.depends_on(t2);
|
||||
|
||||
dag.run(|fut| {
|
||||
tokio::spawn(fut);
|
||||
})
|
||||
dag.run()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
||||
Reference in new issue
Block a user