MCPcopy Index your code
hub / github.com/endbasic/endbasic / check

Method check

std/src/gfx/lcd/buffered/testutils.rs:158–186  ·  view source on GitHub ↗

Validates recorded expectations about the changes made by all executed `op`s.

(self)

Source from the content-addressed store, hash-verified

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}

Callers 15

test_cls_okFunction · 0.45
test_color_okFunction · 0.45
test_inkey_okFunction · 0.45
tFunction · 0.45
test_input_okFunction · 0.45
test_input_retryFunction · 0.45
test_input_errorsFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected