Validates recorded expectations about the changes made by all executed `op`s.
(self)
| 156 | |
| 157 | /// Validates recorded expectations about the changes made by all executed `op`s. |
| 158 | pub(super) fn check(self) { |
| 159 | if self.exp_fb != self.buffered.fb { |
| 160 | for y in 0..self.size.height { |
| 161 | for x in 0..self.size.width { |
| 162 | let offset = (y * self.size.width + x) * 3; |
| 163 | let exp_pixel = &self.exp_fb[offset..offset + 3]; |
| 164 | let pixel = &self.buffered.fb[offset..offset + 3]; |
| 165 | if exp_pixel != pixel { |
| 166 | // Print the difference as a bunch of expect_pixel lines that can be |
| 167 | // copy-pasted into the code to re-define golden data. |
| 168 | eprintln!( |
| 169 | ".expect_pixel(xy({:3}, {:3}), ({:3}, {:3}, {:3})) // got ({:3}, {:3}, {:3})", |
| 170 | x, |
| 171 | y, |
| 172 | pixel[0], |
| 173 | pixel[1], |
| 174 | pixel[2], |
| 175 | exp_pixel[0], |
| 176 | exp_pixel[1], |
| 177 | exp_pixel[2], |
| 178 | ); |
| 179 | } |
| 180 | } |
| 181 | } |
| 182 | panic!("Pixel contents differ; see output above"); |
| 183 | } |
| 184 | assert_eq!(self.exp_damage, self.buffered.damage); |
| 185 | assert_eq!(self.exp_ops, self.buffered.lcd.ops); |
| 186 | } |
| 187 | } |
no outgoing calls
no test coverage detected