use demo_constructor::{Calls, Scheme, WASM_BINARY};
use gclient::{EventProcessor, GearApi};
use parity_scale_codec::Encode;
#[tokio::test]
async fn inf_loop() -> anyhow::Result<()> {
let api = GearApi::dev_from_path("../target/release/gear").await?;
let gas_limit = api.block_gas_limit()?;
let _balance = api.total_balance(api.account_id()).await?;
let mut listener = api.subscribe().await?;
let (mid, _pid, _) = api
.upload_program_bytes(
WASM_BINARY,
gclient::now_micros().to_le_bytes(),
Scheme::direct(Calls::builder().infinite_loop()).encode(),
gas_limit,
0,
)
.await?;
assert!(listener.message_processed(mid).await?.failed());
assert!(!api.queue_processing_stalled().await?);
Ok(())
}