Skip to content
Snippets Groups Projects
Verified Commit dc2f83d0 authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

feat: new test stage

parent 9e0a00c2
No related branches found
No related tags found
1 merge request!18Multiple PPU fixes that make Boytacean pass dmg_acid2 🎉
Pipeline #1653 failed
......@@ -51,6 +51,17 @@ build-wasm:
- frontends/web/lib
expire_in: 1 day
test-rust:
stage: test
parallel:
matrix:
- RUST_VERSION: ["1.56.1", "1.60.0", "stable", "nightly"]
script:
- rustup toolchain install $RUST_VERSION
- rustup override set $RUST_VERSION
- rustc --version
- cargo test
deploy-netlify-preview:
stage: deploy
script:
......
......@@ -656,7 +656,7 @@ impl Ppu {
let mut mask;
for x in 0..TILE_WIDTH {
mask = 1 << (7 - x);
mask = 1 << (TILE_WIDTH - 1 - x);
tile.set(
x,
y,
......@@ -725,14 +725,6 @@ impl Ppu {
return;
}
if wx >= 166 {
return;
}
if wy >= 143 {
return;
}
// calculates the LD (line delta) useful for draw operations where the window
// is repositioned, as the current line for tile calculus is different from
// the one currently in drawing
......@@ -1022,3 +1014,36 @@ impl Default for Ppu {
Self::new()
}
}
#[cfg(test)]
mod tests {
use crate::ppu::Ppu;
#[test]
fn test_update_tile_simple() {
let mut ppu = Ppu::new();
ppu.vram[0x0000] = 0xff;
ppu.vram[0x0001] = 0xff;
let result = ppu.tiles()[0].get(0, 0);
assert_eq!(result, 0);
ppu.update_tile(0x8000, 0x00);
let result = ppu.tiles()[0].get(0, 0);
assert_eq!(result, 3);
}
#[test]
fn test_update_tile_upper() {
let mut ppu = Ppu::new();
ppu.vram[0x1000] = 0xff;
ppu.vram[0x1001] = 0xff;
let result = ppu.tiles()[256].get(0, 0);
assert_eq!(result, 0);
ppu.update_tile(0x9000, 0x00);
let result = ppu.tiles()[256].get(0, 0);
assert_eq!(result, 3);
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment