From: Ian Jackson Date: Mon, 18 Apr 2022 15:32:20 +0000 (+0100) Subject: currency: wip test X-Git-Tag: otter-1.1.0~405 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=04a7230661316d69a7531cb6da8d585a7ff4f1a5;p=otter.git currency: wip test So far we test that splitting appears to succeed, but not what the results look like. Signed-off-by: Ian Jackson --- diff --git a/apitest/at-currency.rs b/apitest/at-currency.rs new file mode 100644 index 00000000..d54bc3d3 --- /dev/null +++ b/apitest/at-currency.rs @@ -0,0 +1,41 @@ +// Copyright 2020-2021 Ian Jackson and contributors to Otter +// SPDX-License-Identifier: AGPL-3.0-or-later +// There is NO WARRANTY. + +use crate::*; + +type Ctx = UsualCtx; + +impl Ctx { + #[throws(Explode)] + fn multigrab(&mut self) { + let mut alice = self.connect_player(&self.alice)?; + let mut a_pieces = alice.pieces::()?; + + let [bn] = a_pieces.iter_enumerated() + .filter_map(|(i,p)| { + if ! p.info["desc"].as_str()?.contains("400") { return None } + Some(i) + }) + .collect::>() + .into_inner().unwrap(); + + let other_pile = [40,20]; + alice.api_piece_op_single(PuSynch((&mut a_pieces, bn)).id(), ( + "multigrab", json!({ "n": 50, 'z': "q000000000" }) + ))?; + alice.synch()?; + + let _ = other_pile; + } +} + +#[throws(Explode)] +fn tests(mut c: Ctx) { + test!(c, "multigrab", c.multigrab() ?); +} + +#[throws(Explode)] +pub fn main() { + tests(Ctx::setup()?)?; +} diff --git a/apitest/atmain.rs b/apitest/atmain.rs index a6cbc9fa..1f663bdd 100644 --- a/apitest/atmain.rs +++ b/apitest/atmain.rs @@ -687,6 +687,7 @@ impl UsualCtx { portmanteau_has!("at-otter.rs", at_otter); portmanteau_has!("at-bundles.rs", at_bundles); portmanteau_has!("at-hidden.rs", at_hidden); +portmanteau_has!("at-currency.rs", at_currency); #[throws(AE)] fn main() { portmanteau_main("at")? }