Merge pull request #24 from scawful/rom-test-hex-nums
change rom test inputs to hex for consistency
This commit is contained in:
@@ -39,51 +39,51 @@ void OverworldMap::LoadAreaInfo() {
|
||||
|
||||
sprite_graphics_[0] = rom_[core::overworldSpriteset + parent_];
|
||||
sprite_graphics_[1] = rom_[core::overworldSpriteset + parent_ + 64];
|
||||
sprite_graphics_[2] = rom_[core::overworldSpriteset + parent_ + 128];
|
||||
sprite_graphics_[2] = rom_[core::overworldSpriteset + parent_ + 0x80];
|
||||
|
||||
sprite_palette_[0] = rom_[core::overworldSpritePalette + parent_];
|
||||
sprite_palette_[1] = rom_[core::overworldSpritePalette + parent_ + 64];
|
||||
sprite_palette_[2] = rom_[core::overworldSpritePalette + parent_ + 128];
|
||||
} else if (index_ < 128) {
|
||||
sprite_palette_[2] = rom_[core::overworldSpritePalette + parent_ + 0x80];
|
||||
} else if (index_ < 0x80) {
|
||||
area_graphics_ = rom_[core::mapGfx + parent_];
|
||||
area_palette_ = rom_[core::overworldMapPalette + parent_];
|
||||
area_music_[0] = rom_[core::overworldMusicDW + (parent_ - 64)];
|
||||
|
||||
sprite_graphics_[0] = rom_[core::overworldSpriteset + parent_ + 128];
|
||||
sprite_graphics_[1] = rom_[core::overworldSpriteset + parent_ + 128];
|
||||
sprite_graphics_[2] = rom_[core::overworldSpriteset + parent_ + 128];
|
||||
sprite_graphics_[0] = rom_[core::overworldSpriteset + parent_ + 0x80];
|
||||
sprite_graphics_[1] = rom_[core::overworldSpriteset + parent_ + 0x80];
|
||||
sprite_graphics_[2] = rom_[core::overworldSpriteset + parent_ + 0x80];
|
||||
|
||||
sprite_palette_[0] = rom_[core::overworldSpritePalette + parent_ + 128];
|
||||
sprite_palette_[1] = rom_[core::overworldSpritePalette + parent_ + 128];
|
||||
sprite_palette_[2] = rom_[core::overworldSpritePalette + parent_ + 128];
|
||||
sprite_palette_[0] = rom_[core::overworldSpritePalette + parent_ + 0x80];
|
||||
sprite_palette_[1] = rom_[core::overworldSpritePalette + parent_ + 0x80];
|
||||
sprite_palette_[2] = rom_[core::overworldSpritePalette + parent_ + 0x80];
|
||||
} else {
|
||||
if (index_ == 0x94) {
|
||||
parent_ = 128;
|
||||
parent_ = 0x80;
|
||||
} else if (index_ == 0x95) {
|
||||
parent_ = 03;
|
||||
parent_ = 0x03;
|
||||
} else if (index_ == 0x96) {
|
||||
parent_ = 0x5B; // pyramid bg use 0x5B map
|
||||
} else if (index_ == 0x97) {
|
||||
parent_ = 0x00; // pyramid bg use 0x5B map
|
||||
} else if (index_ == 156) {
|
||||
parent_ = 67;
|
||||
} else if (index_ == 157) {
|
||||
parent_ = 0;
|
||||
} else if (index_ == 158) {
|
||||
parent_ = 0;
|
||||
} else if (index_ == 159) {
|
||||
parent_ = 44;
|
||||
} else if (index_ == 136) {
|
||||
parent_ = 136;
|
||||
} else if (index_ == 0x9C) {
|
||||
parent_ = 0x43;
|
||||
} else if (index_ == 0x9D) {
|
||||
parent_ = 0x00;
|
||||
} else if (index_ == 0x9E) {
|
||||
parent_ = 0x00;
|
||||
} else if (index_ == 0x9F) {
|
||||
parent_ = 0x2C;
|
||||
} else if (index_ == 0x88) {
|
||||
parent_ = 0x88;
|
||||
}
|
||||
|
||||
area_palette_ = rom_[core::overworldSpecialPALGroup + parent_ - 128];
|
||||
area_palette_ = rom_[core::overworldSpecialPALGroup + parent_ - 0x80];
|
||||
if (index_ >= 0x80 && index_ <= 0x8A && index_ != 0x88) {
|
||||
area_graphics_ = rom_[core::overworldSpecialGFXGroup + (parent_ - 128)];
|
||||
area_graphics_ = rom_[core::overworldSpecialGFXGroup + (parent_ - 0x80)];
|
||||
area_palette_ = rom_[core::overworldSpecialPALGroup + 1];
|
||||
} else if (index_ == 0x88) {
|
||||
area_graphics_ = 81;
|
||||
area_palette_ = 0;
|
||||
area_graphics_ = 0x51;
|
||||
area_palette_ = 0x00;
|
||||
} else {
|
||||
// pyramid bg use 0x5B map
|
||||
area_graphics_ = rom_[core::mapGfx + parent_];
|
||||
@@ -92,13 +92,13 @@ void OverworldMap::LoadAreaInfo() {
|
||||
|
||||
message_id_ = rom_[core::overworldMessages + parent_];
|
||||
|
||||
sprite_graphics_[0] = rom_[core::overworldSpriteset + parent_ + 128];
|
||||
sprite_graphics_[1] = rom_[core::overworldSpriteset + parent_ + 128];
|
||||
sprite_graphics_[2] = rom_[core::overworldSpriteset + parent_ + 128];
|
||||
sprite_graphics_[0] = rom_[core::overworldSpriteset + parent_ + 0x80];
|
||||
sprite_graphics_[1] = rom_[core::overworldSpriteset + parent_ + 0x80];
|
||||
sprite_graphics_[2] = rom_[core::overworldSpriteset + parent_ + 0x80];
|
||||
|
||||
sprite_palette_[0] = rom_[core::overworldSpritePalette + parent_ + 128];
|
||||
sprite_palette_[1] = rom_[core::overworldSpritePalette + parent_ + 128];
|
||||
sprite_palette_[2] = rom_[core::overworldSpritePalette + parent_ + 128];
|
||||
sprite_palette_[0] = rom_[core::overworldSpritePalette + parent_ + 0x80];
|
||||
sprite_palette_[1] = rom_[core::overworldSpritePalette + parent_ + 0x80];
|
||||
sprite_palette_[2] = rom_[core::overworldSpritePalette + parent_ + 0x80];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,8 @@ absl::Status OverworldMap::BuildMap(int count, int game_state,
|
||||
parent_ = map_parent[index_];
|
||||
if (parent_ != index_ && !initialized_) {
|
||||
if (index_ >= 0x80 && index_ <= 0x8A && index_ != 0x88) {
|
||||
area_graphics_ = rom_[core::overworldSpecialGFXGroup + (parent_ - 128)];
|
||||
area_graphics_ =
|
||||
rom_[core::overworldSpecialGFXGroup + (parent_ - 0x80)];
|
||||
area_palette_ = rom_[core::overworldSpecialPALGroup + 1];
|
||||
} else if (index_ == 0x88) {
|
||||
area_graphics_ = 81;
|
||||
@@ -130,7 +131,7 @@ absl::Status OverworldMap::BuildMap(int count, int game_state,
|
||||
// int world = 0;
|
||||
// if (index_ < 64) {
|
||||
// map_tiles_ = map_tiles.light_world;
|
||||
// } else if (index_ < 128 && index_ >= 64) {
|
||||
// } else if (index_ < 0x80 && index_ >= 0x40) {
|
||||
// map_tiles_ = map_tiles.dark_world;
|
||||
// world = 1;
|
||||
// } else {
|
||||
@@ -237,7 +238,7 @@ absl::Status OverworldMap::BuildTiles16Gfx(int count) {
|
||||
}
|
||||
|
||||
xx += 16;
|
||||
if (xx >= 128) {
|
||||
if (xx >= 0x80) {
|
||||
yy += 2048;
|
||||
xx = 0;
|
||||
}
|
||||
@@ -264,7 +265,7 @@ void OverworldMap::CopyTile(int x, int y, int xx, int yy, int offset,
|
||||
}
|
||||
|
||||
int tx = ((tile.id_ / 16) * 512) + ((tile.id_ - ((tile.id_ / 16) * 16)) * 4);
|
||||
auto index = xx + yy + offset + (mx * 2) + (my * 128);
|
||||
auto index = xx + yy + offset + (mx * 2) + (my * 0x80);
|
||||
auto pixel = gfx8Pointer[tx + (y * 64) + x];
|
||||
|
||||
gfx16Pointer[index + r ^ 1] = (uchar)((pixel & 0x0F) + tile.palette_ * 16);
|
||||
@@ -272,7 +273,7 @@ void OverworldMap::CopyTile(int x, int y, int xx, int yy, int offset,
|
||||
}
|
||||
|
||||
void OverworldMap::CopyTile8bpp16(int x, int y, int tile, uchar* ow_blockset) {
|
||||
// (sourceX * 16) + (sourceY * 128)
|
||||
// (sourceX * 16) + (sourceY * 0x80)
|
||||
int source_ptr_pos = ((tile - ((tile / 8) * 8)) * 16) + ((tile / 8) * 2048);
|
||||
auto source_ptr = ow_blockset;
|
||||
|
||||
@@ -282,7 +283,7 @@ void OverworldMap::CopyTile8bpp16(int x, int y, int tile, uchar* ow_blockset) {
|
||||
for (int ystrip = 0; ystrip < 16; ystrip++) {
|
||||
for (int xstrip = 0; xstrip < 16; xstrip++) {
|
||||
dest_ptr[dest_ptr_pos + xstrip + (ystrip * 512)] =
|
||||
source_ptr[source_ptr_pos + xstrip + (ystrip * 128)];
|
||||
source_ptr[source_ptr_pos + xstrip + (ystrip * 0x80)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
236
test/rom_test.cc
236
test/rom_test.cc
@@ -52,7 +52,7 @@ TEST(ROMTest, NewDecompressionPieceOk) {
|
||||
char command = 1;
|
||||
int length = 1;
|
||||
char args[] = "aaa";
|
||||
int argument_length = 2;
|
||||
int argument_length = 0x02;
|
||||
CompressionPiece old_piece;
|
||||
old_piece.command = command;
|
||||
old_piece.length = length;
|
||||
@@ -60,7 +60,7 @@ TEST(ROMTest, NewDecompressionPieceOk) {
|
||||
old_piece.argument_length = argument_length;
|
||||
old_piece.next = nullptr;
|
||||
|
||||
auto new_piece = ExpectNewCompressionPieceOk(1, 1, "aaa", 2);
|
||||
auto new_piece = ExpectNewCompressionPieceOk(0x01, 0x01, "aaa", 0x02);
|
||||
|
||||
EXPECT_EQ(old_piece.command, new_piece->command);
|
||||
EXPECT_EQ(old_piece.length, new_piece->length);
|
||||
@@ -72,24 +72,25 @@ TEST(ROMTest, NewDecompressionPieceOk) {
|
||||
|
||||
TEST(ROMTest, DecompressionValidCommand) {
|
||||
ROM rom;
|
||||
std::array<uchar, 4> simple_copy_input = {BUILD_HEADER(0, 2), 42, 69, 0xFF};
|
||||
uchar simple_copy_output[2] = {42, 69};
|
||||
std::array<uchar, 4> simple_copy_input = {BUILD_HEADER(0x00, 0x02), 0x2A,
|
||||
0x45, 0xFF};
|
||||
uchar simple_copy_output[2] = {0x2A, 0x45};
|
||||
auto decomp_result = ExpectDecompressOk(rom, simple_copy_input.data(), 4);
|
||||
EXPECT_THAT(simple_copy_output, ElementsAreArray(decomp_result.data(), 2));
|
||||
}
|
||||
|
||||
TEST(ROMTest, DecompressionMixingCommand) {
|
||||
ROM rom;
|
||||
uchar random1_i[11] = {BUILD_HEADER(1, 3),
|
||||
42,
|
||||
BUILD_HEADER(0, 4),
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
BUILD_HEADER(2, 2),
|
||||
11,
|
||||
22,
|
||||
uchar random1_i[11] = {BUILD_HEADER(0x01, 0x03),
|
||||
0x2A,
|
||||
BUILD_HEADER(0x00, 0x04),
|
||||
0x01,
|
||||
0x02,
|
||||
0x03,
|
||||
0x04,
|
||||
BUILD_HEADER(0x02, 0x02),
|
||||
0x0B,
|
||||
0x16,
|
||||
0xFF};
|
||||
uchar random1_o[9] = {42, 42, 42, 1, 2, 3, 4, 11, 22};
|
||||
auto decomp_result = ExpectDecompressOk(rom, random1_i, 11);
|
||||
@@ -99,10 +100,10 @@ TEST(ROMTest, DecompressionMixingCommand) {
|
||||
/* Extended Header Command is currently unimplemented
|
||||
TEST(ROMTest, ExtendedHeaderDecompress) {
|
||||
ROM rom;
|
||||
uchar extendedcmd_i[4] = {0b11100100, 0x8F, 42, 0xFF};
|
||||
uchar extendedcmd_i[4] = {0b11100100, 0x8F, 0x2A, 0xFF};
|
||||
uchar extendedcmd_o[50];
|
||||
for (int i = 0; i < 50; ++i) {
|
||||
extendedcmd_o[i] = 42;
|
||||
extendedcmd_o[i] = 0x2A;
|
||||
}
|
||||
|
||||
auto decomp_result = ExpectDecompressOk(rom, extendedcmd_i, 4);
|
||||
@@ -111,10 +112,10 @@ TEST(ROMTest, ExtendedHeaderDecompress) {
|
||||
|
||||
TEST(ROMTest, ExtendedHeaderDecompress2) {
|
||||
ROM rom;
|
||||
uchar extendedcmd_i[4] = {0b11100101, 0x8F, 42, 0xFF};
|
||||
uchar extendedcmd_i[4] = {0b11100101, 0x8F, 0x2A, 0xFF};
|
||||
uchar extendedcmd_o[50];
|
||||
for (int i = 0; i < 50; i++) {
|
||||
extendedcmd_o[i] = 42;
|
||||
extendedcmd_o[i] = 0x2A;
|
||||
}
|
||||
|
||||
auto data = ExpectDecompressOk(rom, extendedcmd_i, 4);
|
||||
@@ -126,8 +127,8 @@ TEST(ROMTest, ExtendedHeaderDecompress2) {
|
||||
|
||||
TEST(ROMTest, CompressionSingleSet) {
|
||||
ROM rom;
|
||||
uchar single_set[5] = {42, 42, 42, 42, 42};
|
||||
uchar single_set_expected[3] = {BUILD_HEADER(1, 5), 42, 0xFF};
|
||||
uchar single_set[5] = {0x2A, 0x2A, 0x2A, 0x2A, 0x2A};
|
||||
uchar single_set_expected[3] = {BUILD_HEADER(1, 5), 0x2A, 0xFF};
|
||||
|
||||
auto comp_result = ExpectCompressOk(rom, single_set, 5);
|
||||
EXPECT_THAT(single_set_expected, ElementsAreArray(comp_result.data(), 3));
|
||||
@@ -135,8 +136,8 @@ TEST(ROMTest, CompressionSingleSet) {
|
||||
|
||||
TEST(ROMTest, CompressionSingleWord) {
|
||||
ROM rom;
|
||||
uchar single_word[6] = {42, 1, 42, 1, 42, 1};
|
||||
uchar single_word_expected[4] = {BUILD_HEADER(2, 6), 42, 1, 0xFF};
|
||||
uchar single_word[6] = {0x2A, 0x01, 0x2A, 0x01, 0x2A, 0x01};
|
||||
uchar single_word_expected[4] = {BUILD_HEADER(0x02, 0x06), 0x2A, 0x01, 0xFF};
|
||||
|
||||
auto comp_result = ExpectCompressOk(rom, single_word, 6);
|
||||
EXPECT_THAT(single_word_expected, ElementsAreArray(comp_result.data(), 4));
|
||||
@@ -144,71 +145,73 @@ TEST(ROMTest, CompressionSingleWord) {
|
||||
|
||||
TEST(ROMTest, CompressionSingleIncrement) {
|
||||
ROM rom;
|
||||
uchar single_inc[3] = {1, 2, 3};
|
||||
uchar single_inc_expected[3] = {BUILD_HEADER(3, 3), 1, 0xFF};
|
||||
uchar single_inc[3] = {0x01, 0x02, 0x03};
|
||||
uchar single_inc_expected[3] = {BUILD_HEADER(0x03, 0x03), 0x01, 0xFF};
|
||||
auto comp_result = ExpectCompressOk(rom, single_inc, 3);
|
||||
EXPECT_THAT(single_inc_expected, ElementsAreArray(comp_result.data(), 3));
|
||||
}
|
||||
|
||||
TEST(ROMTest, CompressionSingleCopy) {
|
||||
ROM rom;
|
||||
uchar single_copy[4] = {3, 10, 7, 20};
|
||||
uchar single_copy_expected[6] = {BUILD_HEADER(0, 4), 3, 10, 7, 20, 0xFF};
|
||||
uchar single_copy[4] = {0x03, 0x0A, 0x07, 0x14};
|
||||
uchar single_copy_expected[6] = {
|
||||
BUILD_HEADER(0x00, 0x04), 0x03, 0x0A, 0x07, 0x14, 0xFF};
|
||||
auto comp_result = ExpectCompressOk(rom, single_copy, 4);
|
||||
EXPECT_THAT(single_copy_expected, ElementsAreArray(comp_result.data(), 6));
|
||||
}
|
||||
|
||||
/*
|
||||
Hiding tests until I figure out a better PR to address the bug.
|
||||
/* Hiding tests until I figure out a better PR to address the bug
|
||||
TEST(ROMTest, CompressionSingleCopyRepeat) {
|
||||
ROM rom;
|
||||
uchar single_copy_repeat[8] = {3, 10, 7, 20, 3, 10, 7, 20};
|
||||
uchar single_copy_repeat_expected[9] = {BUILD_HEADER(0, 4), 3, 10, 7, 20,
|
||||
BUILD_HEADER(4, 4), 0, 0, 0xFF};
|
||||
uchar single_copy_repeat[8] = {0x03, 0x0A, 0x07, 0x14, 0x03, 10, 0x07, 0x14};
|
||||
uchar single_copy_repeat_expected[9] = {
|
||||
BUILD_HEADER(0x00, 0x04), 0x03, 0x0A, 0x07, 0x14,
|
||||
BUILD_HEADER(0x04, 0x04), 0x00, 0x00, 0xFF};
|
||||
auto comp_result = ExpectCompressOk(rom, single_copy_repeat, 8);
|
||||
EXPECT_THAT(single_copy_repeat_expected,
|
||||
ElementsAreArray(comp_result.data(), 8));
|
||||
}
|
||||
|
||||
|
||||
TEST(ROMTest, CompressionSingleOverflowIncrement) {
|
||||
ROM rom;
|
||||
uchar overflow_inc[4] = {0xFE, 0xFF, 0, 1};
|
||||
uchar overflow_inc_expected[3] = {BUILD_HEADER(3, 4), 0xFE, 0xFF};
|
||||
uchar overflow_inc[4] = {0xFE, 0xFF, 0x00, 0x01};
|
||||
uchar overflow_inc_expected[3] = {BUILD_HEADER(0x03, 0x04), 0xFE, 0xFF};
|
||||
|
||||
auto comp_result = ExpectCompressOk(rom, overflow_inc, 4);
|
||||
EXPECT_THAT(overflow_inc_expected, ElementsAreArray(comp_result.data(), 3));
|
||||
}
|
||||
|
||||
|
||||
TEST(ROMTest, CompressionMixedRepeatIncrement) {
|
||||
ROM rom;
|
||||
uchar to_compress_string[28] = {5, 5, 5, 5, 6, 7, 8, 9, 10, 11, 5, 2, 5, 2,
|
||||
5, 2, 10, 11, 5, 2, 5, 2, 5, 2, 8, 10, 0, 5};
|
||||
uchar repeat_and_inc_copy_expected[7] = {BUILD_HEADER(1, 4),
|
||||
5,
|
||||
BUILD_HEADER(3, 6),
|
||||
6,
|
||||
BUILD_HEADER(0, 1),
|
||||
5,
|
||||
0xFF};
|
||||
uchar to_compress_string[28] = {0x05, 0x05, 0x05, 0x05, 0x06, 0x07, 0x08,
|
||||
0x09, 0x0A, 0x0B, 0x05, 0x02, 0x05, 0x02,
|
||||
0x05, 0x02, 0x0A, 0x0B, 0x05, 0x02, 0x05,
|
||||
0x02, 0x05, 0x02, 0x08, 0x0A, 0x00, 0x05};
|
||||
uchar repeat_and_inc_copy_expected[7] = {BUILD_HEADER(0x01, 0x04),
|
||||
0x05,
|
||||
BUILD_HEADER(0x03, 0x06),
|
||||
0x06,
|
||||
BUILD_HEADER(0x00, 0x01),
|
||||
0x05,
|
||||
0xFF};
|
||||
// Mixing, repeat, inc, trailing copy
|
||||
auto comp_result = ExpectCompressOk(rom, to_compress_string, 28);
|
||||
EXPECT_THAT(repeat_and_inc_copy_expected,
|
||||
ElementsAreArray(comp_result.data(), 7));
|
||||
}
|
||||
|
||||
|
||||
TEST(ROMTest, SimpleMixCompression) {
|
||||
ROM rom;
|
||||
uchar to_compress_string[] = {5, 5, 5, 5, 6, 7, 8, 9, 10, 11, 5, 2, 5, 2,
|
||||
5, 2, 10, 11, 5, 2, 5, 2, 5, 2, 8, 10, 0, 5};
|
||||
uchar repeat_and_inc_copy_expected[] = {BUILD_HEADER(1, 4),
|
||||
5,
|
||||
BUILD_HEADER(3, 6),
|
||||
6,
|
||||
BUILD_HEADER(0, 1),
|
||||
5,
|
||||
uchar to_compress_string[] = {0x05, 0x05, 0x05, 0x05, 0x06, 0x07, 0x08,
|
||||
0x09, 0x0A, 0x0B, 0x05, 0x02, 0x05, 0x02,
|
||||
0x05, 0x02, 0x0A, 0x0B, 0x05, 0x02, 0x05,
|
||||
0x02, 0x05, 0x02, 0x08, 0x0A, 0x00, 0x05};
|
||||
uchar repeat_and_inc_copy_expected[] = {BUILD_HEADER(0x01, 0x04),
|
||||
0x05,
|
||||
BUILD_HEADER(0x03, 0x06),
|
||||
0x06,
|
||||
BUILD_HEADER(0x00, 0x01),
|
||||
0x05,
|
||||
0xFF};
|
||||
// Mixing, repeat, inc, trailing copy
|
||||
auto data = ExpectCompressOk(rom, to_compress_string, 7);
|
||||
@@ -216,93 +219,78 @@ TEST(ROMTest, SimpleMixCompression) {
|
||||
EXPECT_EQ(repeat_and_inc_copy_expected[i], data[i]);
|
||||
}
|
||||
|
||||
// char inc_word_intra_copy_expected[] = {BUILD_HEADER(3, 7),
|
||||
// 5,
|
||||
// BUILD_HEADER(2, 6),
|
||||
// 5,
|
||||
// 2,
|
||||
// BUILD_HEADER(4, 8),
|
||||
// 5,
|
||||
// 0,
|
||||
// 0xFF};
|
||||
uchar inc_word_intra_copy_expected[] = {BUILD_HEADER(0x03, 0x07),
|
||||
0x05,
|
||||
BUILD_HEADER(0x02, 0x06),
|
||||
0x05,
|
||||
0x02,
|
||||
BUILD_HEADER(0x04, 0x08),
|
||||
0x05,
|
||||
0x00,
|
||||
0xFF};
|
||||
// CuAssertDataEquals_Msg(
|
||||
// tc, "Mixing, inc, alternate, intra copy", inc_word_intra_copy_expected,
|
||||
// 9, alttp_compress_gfx(to_compress_string, 3, 21, &compress_size));
|
||||
// char all_expected[] = {BUILD_HEADER(1, 4),
|
||||
// 5,
|
||||
// BUILD_HEADER(3, 6),
|
||||
// 6,
|
||||
// BUILD_HEADER(2, 6),
|
||||
// 5,
|
||||
// 2,
|
||||
// BUILD_HEADER(4, 8),
|
||||
// 8,
|
||||
// 0,
|
||||
// BUILD_HEADER(0, 4),
|
||||
// 8,
|
||||
// 10,
|
||||
// 0,
|
||||
// 5,
|
||||
// 0xFF};
|
||||
|
||||
uchar all_expected[] = {BUILD_HEADER(0x01, 0x04),
|
||||
0x05,
|
||||
BUILD_HEADER(0x03, 0x06),
|
||||
0x06,
|
||||
BUILD_HEADER(0x02, 0x06),
|
||||
0x05,
|
||||
0x02,
|
||||
BUILD_HEADER(0x04, 0x08),
|
||||
0x08,
|
||||
0x00,
|
||||
BUILD_HEADER(0x00, 0x04),
|
||||
0x08,
|
||||
0x0A,
|
||||
0x00,
|
||||
0x05,
|
||||
0xFF};
|
||||
// CuAssertDataEquals_Msg(
|
||||
// tc, "Mixing, inc, alternate, intra copy", all_expected, 16,
|
||||
// alttp_compress_gfx(to_compress_string, 0, 28, &compress_size));
|
||||
}
|
||||
*/
|
||||
|
||||
TEST(ROMTest, LengthBorderCompression) {
|
||||
char buffer[3000];
|
||||
unsigned int compress_size;
|
||||
|
||||
for (unsigned int i = 0; i < 3000; i++) buffer[i] = 5;
|
||||
char extended_lenght_expected_42[] = {0b11100100, 41, 5, 0xFF};
|
||||
char extended_lenght_expected_400[] = {0b11100101, 0x8F, 5, 0xFF};
|
||||
char extended_lenght_expected_1050[] = {0b11100111, 0xFF, 5,
|
||||
BUILD_HEADER(1, 26), 5, 0xFF};
|
||||
char extended_lenght_expected_2050[] = {
|
||||
0b11100111, 0xFF, 5, 0b11100111, 0xFF, 5, BUILD_HEADER(1, 2), 5, 0xFF};
|
||||
CuAssertDataEquals_Msg(tc, "Extended lenght, 42 repeat of 5",
|
||||
extended_lenght_expected_42, 4,
|
||||
alttp_compress_gfx(buffer, 0, 42, &compress_size));
|
||||
CuAssertDataEquals_Msg(tc, "Extended lenght, 400 repeat of 5",
|
||||
extended_lenght_expected_400, 4,
|
||||
alttp_compress_gfx(buffer, 0, 400, &compress_size));
|
||||
CuAssertDataEquals_Msg(tc, "Extended lenght, 1050 repeat of 5",
|
||||
extended_lenght_expected_1050, 6,
|
||||
alttp_compress_gfx(buffer, 0, 1050,
|
||||
&compress_size));
|
||||
CuAssertDataEquals_Msg(tc, "Extended lenght, 2050 repeat of 5",
|
||||
extended_lenght_expected_2050, 9,
|
||||
alttp_compress_gfx(buffer, 0, 2050,
|
||||
&compress_size));
|
||||
for (unsigned int i = 0; i < 3000; i++) buffer[i] = 0x05;
|
||||
uchar extended_lenght_expected_42[] = {0b11100100, 0x29, 0x05, 0xFF};
|
||||
uchar extended_lenght_expected_400[] = {0b11100101, 0x8F, 0x05, 0xFF};
|
||||
uchar extended_lenght_expected_1050[] = {
|
||||
0b11100111, 0xFF, 0x05, BUILD_HEADER(0x01, 0x1A), 0x05, 0xFF};
|
||||
uchar extended_lenght_expected_2050[] = {
|
||||
0b11100111, 0xFF, 0x05, 0b11100111, 0xFF, 0x05, BUILD_HEADER(0x01, 0x02),
|
||||
0x05, 0xFF};
|
||||
// CuAssertDataEquals_Msg(tc, "Extended lenght, 42 repeat of 5",
|
||||
// extended_lenght_expected_42, 4,
|
||||
// alttp_compress_gfx(buffer, 0, 42, &compress_size));
|
||||
// CuAssertDataEquals_Msg(tc, "Extended lenght, 400 repeat of 5",
|
||||
// extended_lenght_expected_400, 4,
|
||||
// alttp_compress_gfx(buffer, 0, 400, &compress_size));
|
||||
// CuAssertDataEquals_Msg(tc, "Extended lenght, 1050 repeat of 5",
|
||||
// extended_lenght_expected_1050, 6,
|
||||
// alttp_compress_gfx(buffer, 0, 1050,
|
||||
// &compress_size));
|
||||
// CuAssertDataEquals_Msg(tc, "Extended lenght, 2050 repeat of 5",
|
||||
// extended_lenght_expected_2050, 9,
|
||||
// alttp_compress_gfx(buffer, 0, 2050,
|
||||
// &compress_size));
|
||||
|
||||
for (unsigned int i = 0; i < 3000; i += 2) {
|
||||
buffer[i] = 5;
|
||||
buffer[i + 1] = 6;
|
||||
buffer[i] = 0x05;
|
||||
buffer[i + 1] = 0x06;
|
||||
}
|
||||
char hightlenght_word_1050[] = {0b11101011, 0xFF, 5, 6,
|
||||
BUILD_HEADER(2, 26), 5, 6, 0xFF};
|
||||
CuAssertDataEquals_Msg(tc, "Extended word copy", hightlenght_word_1050, 8,
|
||||
alttp_compress_gfx(buffer, 0, 1050,
|
||||
&compress_size));
|
||||
uchar hightlenght_word_1050[] = {
|
||||
0b11101011, 0xFF, 0x05, 0x06, BUILD_HEADER(0x02, 0x1A), 0x05, 0x06, 0xFF};
|
||||
// CuAssertDataEquals_Msg(tc, "Extended word copy", hightlenght_word_1050, 8,
|
||||
// alttp_compress_gfx(buffer, 0, 1050,
|
||||
// &compress_size));
|
||||
}
|
||||
|
||||
TEST(ROMTest, CompressDecompress) {
|
||||
char buffer[32];
|
||||
unsigned int compress_size;
|
||||
int fd = open("testsnestilebpp4.tl", O_RDONLY);
|
||||
|
||||
if (fd == -1) {
|
||||
fprintf(stderr, "Can't open testsnestilebpp4.tl : %s\n",
|
||||
strerror(errno)); return;
|
||||
}
|
||||
read(fd, buffer, 32);
|
||||
char* comdata = alttp_compress_gfx(buffer, 0, 32, &compress_size);
|
||||
CuAssertDataEquals_Msg(
|
||||
tc, "Compressing/Uncompress testtilebpp4.tl", buffer, 32,
|
||||
alttp_decompress_gfx(comdata, 0, 0, &compress_size, &c_size));
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
} // namespace rom_test
|
||||
} // namespace yaze_test
|
||||
Reference in New Issue
Block a user