()
| 163 | |
| 164 | /// Extracts and returns the first fragment of `self` or returns [`None`] of `self` is empty. |
| 165 | fn next(&mut self) -> Option<u32> { |
| 166 | (self.fragments != 0).then(|| self.extract_first()) |
| 167 | //if self.fragments == 0 { None } else { Some(self.extract_first()) } |
| 168 | } |
| 169 | |
| 170 | fn size_hint(&self) -> (usize, Option<usize>) { |
| 171 | (self.fragments as usize, Some(self.fragments as usize)) |
| 172 | } |
| 173 | }*/ |
| 174 | |
| 175 | #[cfg(test)] |
| 176 | mod tests { |
| 177 | use crate::{BitsPerFragment, Degree}; |
| 178 | // Note this useful idiom: importing names from outer (for mod tests) scope. |
| 179 | use super::*; |
| 180 | |
| 181 | #[test] |
| 182 | fn code_2bits() { |
| 183 | let mut code = Code { content: 0b_11_10_01, len: 3 }; |
| 184 | assert_eq!(code.get_rev(0, BitsPerFragment(2)).unwrap(), 0b01); |
nothing calls this directly
no outgoing calls
no test coverage detected