diff --git a/irp/tests/rust-irptransmogrifier/Cargo.toml b/irp/tests/rust-irptransmogrifier/Cargo.toml index 5536b1ea..fab4f640 100644 --- a/irp/tests/rust-irptransmogrifier/Cargo.toml +++ b/irp/tests/rust-irptransmogrifier/Cargo.toml @@ -7,4 +7,4 @@ publish = false [dependencies] irp = { path = "../.." } rand = "0.8" -j4rs = "0.17" +j4rs = "0.18" diff --git a/irp/tests/rust-irptransmogrifier/src/lib.rs b/irp/tests/rust-irptransmogrifier/src/lib.rs index cb5e6e48..7fc25cd4 100644 --- a/irp/tests/rust-irptransmogrifier/src/lib.rs +++ b/irp/tests/rust-irptransmogrifier/src/lib.rs @@ -23,7 +23,8 @@ impl<'a> IrpTransmogrifierRender<'a> { pub fn new(jvm: &'a Jvm, irp: &str) -> Result { let irp = jvm.create_instance("java.lang.String", &[InvocationArg::try_from(irp)?])?; - let protocol = jvm.create_instance("org.harctoolbox.irp.Protocol", &[irp.into()])?; + let protocol = + jvm.create_instance("org.harctoolbox.irp.Protocol", &[InvocationArg::from(irp)])?; Ok(IrpTransmogrifierRender { protocol, jvm }) } @@ -34,23 +35,29 @@ impl<'a> IrpTransmogrifierRender<'a> { .java_map(JavaClass::String, JavaClass::Long, param)?; self.jvm - .invoke(&self.protocol, "toIrSignal", &[jparam.into()]) + .invoke(&self.protocol, "toIrSignal", &[InvocationArg::from(jparam)]) } pub fn render_raw(&self, param: HashMap) -> Result<[Vec; 3], J4RsError> { let res = self.render(param)?; - let intro: Vec = self - .jvm - .to_rust(self.jvm.invoke(&res, "getIntroInts", &[])?)?; + let intro: Vec = self.jvm.to_rust(self.jvm.invoke( + &res, + "getIntroInts", + InvocationArg::empty(), + )?)?; - let repeat: Vec = self - .jvm - .to_rust(self.jvm.invoke(&res, "getRepeatInts", &[])?)?; + let repeat: Vec = self.jvm.to_rust(self.jvm.invoke( + &res, + "getRepeatInts", + InvocationArg::empty(), + )?)?; - let ending: Vec = self - .jvm - .to_rust(self.jvm.invoke(&res, "getEndingInts", &[])?)?; + let ending: Vec = self.jvm.to_rust(self.jvm.invoke( + &res, + "getEndingInts", + InvocationArg::empty(), + )?)?; Ok([intro, repeat, ending]) } @@ -58,9 +65,11 @@ impl<'a> IrpTransmogrifierRender<'a> { pub fn render_pronto(&self, param: HashMap) -> Result { let res = self.render(param)?; - let res = - self.jvm - .invoke_static("org.harctoolbox.ircore.Pronto", "toString", &[res.into()])?; + let res = self.jvm.invoke_static( + "org.harctoolbox.ircore.Pronto", + "toString", + &[InvocationArg::from(res)], + )?; self.jvm.to_rust(res) } diff --git a/irp/tests/transmogrifier_compare/src/main.rs b/irp/tests/transmogrifier_compare/src/main.rs index 888549e0..84551787 100644 --- a/irp/tests/transmogrifier_compare/src/main.rs +++ b/irp/tests/transmogrifier_compare/src/main.rs @@ -1,4 +1,4 @@ -use irp::{InfraredData, Irp, Message, NFADecoder, Vartable}; +use irp::{Decoder, InfraredData, Irp, Message, Options, Vartable}; use irptransmogrifier::{create_jvm, IrpTransmogrifierRender}; use itertools::Itertools; use rand::Rng; @@ -29,6 +29,13 @@ fn main() { vars.set(param.name.to_owned(), value); } + let options = Options { + aeps: 100, + eps: 3, + max_gap: 100000, + ..Default::default() + }; + // encode with irp crate match irp.encode(vars.clone()) { Ok(our) => { @@ -42,9 +49,9 @@ fn main() { assert!(compare_with_rounding(&our[i], &their[i])); } - match irp.build_nfa() { - Ok(nfa) => { - let mut decoder = NFADecoder::new(100, 3, 100000); + match irp.compile(&options) { + Ok(dfa) => { + let mut decoder = Decoder::new(options); let mut decoded = false; for part in our { @@ -53,7 +60,7 @@ fn main() { let mut failed = false; for i in ir { - decoder.input(i, &nfa, |ev, fields| { + decoder.dfa_input(i, &dfa, |ev, fields| { println!( "decode {i} {ev}: {}", fields diff --git a/tests/lirc_compare/Cargo.toml b/tests/lirc_compare/Cargo.toml index 8e60195d..55dc63e1 100644 --- a/tests/lirc_compare/Cargo.toml +++ b/tests/lirc_compare/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] cir = { path = "../.." } irp = { path = "../../irp" } -liblircd = { path = "../../liblircd" } +liblircd = { path = "../../tests/liblircd" } num-integer = "0.1" [workspace]