From 72c88c9b5bf8269a2b1ec78234bf4051467b5d45 Mon Sep 17 00:00:00 2001 From: Sean Young Date: Mon, 6 May 2024 10:17:46 +0100 Subject: [PATCH] Fix ensure only enter repeat after down was encountered Signed-off-by: Sean Young --- irp/src/build_nfa.rs | 11 ++++++----- irp/tests/bpf_decoding.rs | 2 +- irp/tests/tests.rs | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/irp/src/build_nfa.rs b/irp/src/build_nfa.rs index 7ad0740..80c650e 100644 --- a/irp/src/build_nfa.rs +++ b/irp/src/build_nfa.rs @@ -1090,12 +1090,13 @@ impl<'a> Builder<'a> { if self.cur.seen_edges { self.add_done(event)?; - self.add_edge(Edge { - dest: 0, - actions: vec![], - }); + if event == Event::Repeat { + self.add_edge(Edge { + dest: node, + actions: vec![], + }); + } - self.set_head(0); self.cur.seen_edges = false; } diff --git a/irp/tests/bpf_decoding.rs b/irp/tests/bpf_decoding.rs index 6510bed..6257a4d 100644 --- a/irp/tests/bpf_decoding.rs +++ b/irp/tests/bpf_decoding.rs @@ -163,7 +163,7 @@ fn decode_all() { failing_protocols.len() ); - assert_eq!(failing_protocols.len(), 38); + assert_eq!(failing_protocols.len(), 36); } fn bpf_decode(dfa: &DFA, options: &Options, name: &str, message: &Message) -> Vec { diff --git a/irp/tests/tests.rs b/irp/tests/tests.rs index 7c224a7..517d1ba 100644 --- a/irp/tests/tests.rs +++ b/irp/tests/tests.rs @@ -573,7 +573,7 @@ fn decode_all() { println!("tests: {total_tests} fails: {fails}"); println!("Failed protocols: {failed_protocols:?}"); - let expected_failures = HashSet::from(["Pioneer-2Part", "Epson", "F12x", "Roku-8bit"]); + let expected_failures = HashSet::from(["Epson", "F12x"]); assert_eq!(failed_protocols, expected_failures); }