nexgenomics 0.2.7

The official Rust crate for NexGenomics
Documentation

// tests/agents.rs


use nexgenomics::threads;

#[tokio::test]
#[cfg(feature="async")]
async fn test_threads() {
    let _ = threads::get_threads().await.unwrap();
    //println!("ASYNC GET THREADS ^^^ {:#?} &&&&",r)

}

#[test]
#[cfg(feature="blocking")]
fn test_threads() {
    let r = threads::get_threads().unwrap();
    println!("BLOCKING GET THREADS ^^^ {:#?} &&&&",r)
}

#[tokio::test]
#[cfg(feature="async")]
async fn test_create_thread() -> Result<(),Box<dyn std::error::Error>> {
    let title = "This is a title";
    let t = threads::create_thread (title).await?;
    println!("{:#?}",t);
    assert_eq!(title,t.title);

    let _ = t.post_message ("This is the symphony that Schubert wrote but never finished. Also, you're a pirate.").await?;
    let _ = t.post_message ("This is the symphony that Bruckner wrote but never finished. Also, you're an organist.").await?;
    let _ = t.ask_assistant ("How many symphonies did Brahms write?").await?;

    let r = t.get_messages().await?;
    println!("{:#?}",r);

    assert_eq!(r.len(),4);

    Ok(())
}