dedupe test images
This commit is contained in:
parent
7f6fa9df82
commit
2d2abcdd56
60
src/main.rs
60
src/main.rs
|
@ -4,6 +4,30 @@ use std::collections::HashMap;
|
||||||
const IMAGE_DIMENSION_SD: usize = 8;
|
const IMAGE_DIMENSION_SD: usize = 8;
|
||||||
const IMAGE_DIMENSION_HD: usize = 16;
|
const IMAGE_DIMENSION_HD: usize = 16;
|
||||||
|
|
||||||
|
const TEST_IMAGE_CHEQUERS_1: Image = Image {
|
||||||
|
pixels: vec![
|
||||||
|
1,0,1,0,1,0,1,0,
|
||||||
|
0,1,0,1,0,1,0,1,
|
||||||
|
1,0,1,0,1,0,1,0,
|
||||||
|
0,1,0,1,0,1,0,1,
|
||||||
|
1,0,1,0,1,0,1,0,
|
||||||
|
0,1,0,1,0,1,0,1,
|
||||||
|
1,0,1,0,1,0,1,0,
|
||||||
|
0,1,0,1,0,1,0,1,
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
const TEST_IMAGE_CHEQUERS_2: Image = Image { pixels: vec![
|
||||||
|
0,1,0,1,0,1,0,1,
|
||||||
|
1,0,1,0,1,0,1,0,
|
||||||
|
0,1,0,1,0,1,0,1,
|
||||||
|
1,0,1,0,1,0,1,0,
|
||||||
|
0,1,0,1,0,1,0,1,
|
||||||
|
1,0,1,0,1,0,1,0,
|
||||||
|
0,1,0,1,0,1,0,1,
|
||||||
|
1,0,1,0,1,0,1,0,
|
||||||
|
]};
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialEq)]
|
#[derive(Debug, Eq, PartialEq)]
|
||||||
struct Colour {
|
struct Colour {
|
||||||
red: u8,
|
red: u8,
|
||||||
|
@ -154,19 +178,7 @@ fn image_to_string_opts(image: Image, hd: bool) -> String {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_image_to_string() {
|
fn test_image_to_string() {
|
||||||
let output = image_to_string(Image {
|
let output = image_to_string(TEST_IMAGE_CHEQUERS_1);
|
||||||
pixels: vec![
|
|
||||||
1,0,1,0,1,0,1,0,
|
|
||||||
0,1,0,1,0,1,0,1,
|
|
||||||
1,0,1,0,1,0,1,0,
|
|
||||||
0,1,0,1,0,1,0,1,
|
|
||||||
1,0,1,0,1,0,1,0,
|
|
||||||
0,1,0,1,0,1,0,1,
|
|
||||||
1,0,1,0,1,0,1,0,
|
|
||||||
0,1,0,1,0,1,0,1,
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
let expected = "10101010\n01010101\n10101010\n01010101\n10101010\n01010101\n10101010\n01010101".to_string();
|
let expected = "10101010\n01010101\n10101010\n01010101\n10101010\n01010101\n10101010\n01010101".to_string();
|
||||||
|
|
||||||
assert_eq!(output, expected);
|
assert_eq!(output, expected);
|
||||||
|
@ -254,26 +266,8 @@ fn test_tile_to_string() {
|
||||||
name: Some("chequers".to_string()),
|
name: Some("chequers".to_string()),
|
||||||
wall: false,
|
wall: false,
|
||||||
animation_frames: vec![
|
animation_frames: vec![
|
||||||
Image { pixels: vec![
|
TEST_IMAGE_CHEQUERS_1,
|
||||||
1,0,1,0,1,0,1,0,
|
TEST_IMAGE_CHEQUERS_2,
|
||||||
0,1,0,1,0,1,0,1,
|
|
||||||
1,0,1,0,1,0,1,0,
|
|
||||||
0,1,0,1,0,1,0,1,
|
|
||||||
1,0,1,0,1,0,1,0,
|
|
||||||
0,1,0,1,0,1,0,1,
|
|
||||||
1,0,1,0,1,0,1,0,
|
|
||||||
0,1,0,1,0,1,0,1,
|
|
||||||
]},
|
|
||||||
Image { pixels: vec![
|
|
||||||
0,1,0,1,0,1,0,1,
|
|
||||||
1,0,1,0,1,0,1,0,
|
|
||||||
0,1,0,1,0,1,0,1,
|
|
||||||
1,0,1,0,1,0,1,0,
|
|
||||||
0,1,0,1,0,1,0,1,
|
|
||||||
1,0,1,0,1,0,1,0,
|
|
||||||
0,1,0,1,0,1,0,1,
|
|
||||||
1,0,1,0,1,0,1,0,
|
|
||||||
]},
|
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue