feat: dagrunner, initial version

This commit is contained in:
swaits committed 2025-10-07 16:31:03 -07:00
commit 7412287ee4
122 files changed
+23101

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
//! Runtime integration tests - verify dagx works correctly across different runtimes
use dagx::{DagResult, DagRunner, Task};
struct Value(i32);
#[dagx::task]
impl Value {
async fn run(&mut self) -> i32 {
self.0
}
}
struct Add;
#[dagx::task]
impl Add {
async fn run(&mut self, a: &i32, b: &i32) -> i32 {
a + b
}
}
#[tokio::test]
async fn runtime_integration_tokio() -> DagResult<()> {
let dag = DagRunner::new();
let a = dag.add_task(Value(10));
let b = dag.add_task(Value(20));
let sum = dag.add_task(Add).depends_on((&a, &b));
dag.run(|fut| {
tokio::spawn(fut);
})
.await?;
assert_eq!(dag.get(sum)?, 30);
Ok(())
}