backend-infra-engineer: Pre-0.2.2 snapshot (2022)
This commit is contained in:
49
test/CMakeLists.txt
Normal file
49
test/CMakeLists.txt
Normal file
@@ -0,0 +1,49 @@
|
||||
# GoogleTest ------------------------------------------------------------------------------------
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
googletest
|
||||
URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip
|
||||
)
|
||||
|
||||
# For Windows: Prevent overriding the parent project's compiler/linker settings
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
FetchContent_MakeAvailable(googletest)
|
||||
enable_testing()
|
||||
|
||||
add_executable(
|
||||
yaze_test
|
||||
yaze_test.cc
|
||||
rom_test.cc
|
||||
../src/app/rom.cc
|
||||
../src/app/gfx/bitmap.cc
|
||||
../src/app/gfx/snes_tile.cc
|
||||
../src/app/gfx/snes_palette.cc
|
||||
../src/app/core/common.cc
|
||||
${ASAR_STATIC_SRC}
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
yaze_test PUBLIC
|
||||
../src/
|
||||
../src/lib/
|
||||
../src/lib/asar/src/asar/
|
||||
${SDL_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
yaze_test
|
||||
SDL2
|
||||
${ABSL_TARGETS}
|
||||
${OPENGL_LIBRARIES}
|
||||
${CMAKE_DL_LIBS}
|
||||
asar-static
|
||||
gmock_main
|
||||
gmock
|
||||
gtest_main
|
||||
gtest
|
||||
)
|
||||
target_compile_definitions(yaze_test PRIVATE "linux")
|
||||
target_compile_definitions(yaze_test PRIVATE "stricmp=strcasecmp")
|
||||
|
||||
include(GoogleTest)
|
||||
gtest_discover_tests(yaze_test)
|
||||
67
test/asm_test.cc
Normal file
67
test/asm_test.cc
Normal file
@@ -0,0 +1,67 @@
|
||||
#include <asar/interface-lib.h>
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include "absl/status/status.h"
|
||||
#include "absl/status/statusor.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "app/asm/script.h"
|
||||
#include "app/core/constants.h"
|
||||
#include "app/rom.h"
|
||||
|
||||
namespace yaze_test {
|
||||
namespace asm_test {
|
||||
|
||||
using yaze::app::ROM;
|
||||
using yaze::app::snes_asm::Script;
|
||||
|
||||
using ::testing::_;
|
||||
using ::testing::ElementsAreArray;
|
||||
using ::testing::Eq;
|
||||
using ::testing::Return;
|
||||
|
||||
class MockScript : public Script {
|
||||
public:
|
||||
MOCK_METHOD(absl::Status, ApplyPatchToROM, (ROM & rom));
|
||||
MOCK_METHOD(absl::Status, PatchOverworldMosaic,
|
||||
(ROM & rom, char mosaic_tiles[yaze::app::core::kNumOverworldMaps],
|
||||
int routine_offset, int hook_offset));
|
||||
};
|
||||
|
||||
TEST(ASMTest, ApplyMosaicChangePatchOk) {
|
||||
ROM rom;
|
||||
MockScript script;
|
||||
char mosaic_tiles[yaze::app::core::kNumOverworldMaps];
|
||||
|
||||
EXPECT_CALL(script, PatchOverworldMosaic(_, Eq(mosaic_tiles),
|
||||
Eq(0x1301D0 + 0x138000), 0))
|
||||
.WillOnce(Return(absl::OkStatus()));
|
||||
|
||||
EXPECT_CALL(script, ApplyPatchToROM(_)).WillOnce(Return(absl::OkStatus()));
|
||||
|
||||
EXPECT_THAT(
|
||||
script.PatchOverworldMosaic(rom, mosaic_tiles, 0x1301D0 + 0x138000, 0),
|
||||
absl::OkStatus());
|
||||
EXPECT_THAT(script.ApplyPatchToROM(rom), absl::OkStatus());
|
||||
}
|
||||
|
||||
TEST(ASMTest, NoPatchLoadedError) {
|
||||
ROM rom;
|
||||
MockScript script;
|
||||
EXPECT_CALL(script, ApplyPatchToROM(_))
|
||||
.WillOnce(Return(absl::InvalidArgumentError("No patch loaded!")));
|
||||
|
||||
EXPECT_THAT(script.ApplyPatchToROM(rom),
|
||||
absl::InvalidArgumentError("No patch loaded!"));
|
||||
}
|
||||
|
||||
} // namespace asm_test
|
||||
} // namespace yaze_test
|
||||
74
test/delta_test.cc
Normal file
74
test/delta_test.cc
Normal file
@@ -0,0 +1,74 @@
|
||||
#include <asar/interface-lib.h>
|
||||
#include <gmock/gmock.h>
|
||||
#include <google/protobuf/repeated_field.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include "absl/status/status.h"
|
||||
#include "absl/status/statusor.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "app/core/constants.h"
|
||||
#include "app/delta/client.h"
|
||||
#include "app/delta/service.h"
|
||||
#include "app/rom.h"
|
||||
#include "src/app/delta/delta.grpc.pb.h"
|
||||
#include "src/app/delta/delta.pb.h"
|
||||
|
||||
namespace yaze_test {
|
||||
namespace delta_test {
|
||||
|
||||
TEST(DeltaTest, InitRepoAndPushOk) {
|
||||
yaze::app::delta::DeltaService service;
|
||||
yaze::app::ROM rom;
|
||||
Bytes test_bytes;
|
||||
test_bytes.push_back(0x40);
|
||||
EXPECT_TRUE(rom.LoadFromBytes(test_bytes).ok());
|
||||
grpc::ServerContext* context;
|
||||
InitRequest init_request;
|
||||
auto repo = init_request.mutable_repo();
|
||||
repo->set_project_name("test_repo");
|
||||
Branch branch;
|
||||
branch.set_branch_name("test_branch");
|
||||
auto new_mutable_commits = branch.mutable_commits();
|
||||
new_mutable_commits->Reserve(5);
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
auto new_commit = new Commit();
|
||||
new_commit->set_commit_id(i);
|
||||
new_mutable_commits->Add();
|
||||
new_mutable_commits->at(i) = *new_commit;
|
||||
}
|
||||
auto mutable_tree = repo->mutable_tree();
|
||||
mutable_tree->Add();
|
||||
mutable_tree->at(0) = branch;
|
||||
InitResponse init_response;
|
||||
auto init_status = service.Init(context, &init_request, &init_response);
|
||||
EXPECT_TRUE(init_status.ok());
|
||||
|
||||
PushRequest request;
|
||||
request.set_branch_name("test_branch");
|
||||
request.set_repository_name("test_repo");
|
||||
auto mutable_commits = request.mutable_commits();
|
||||
mutable_commits->Reserve(5);
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
auto new_commit = new Commit();
|
||||
new_commit->set_commit_id(i * 2);
|
||||
mutable_commits->Add();
|
||||
mutable_commits->at(i) = *new_commit;
|
||||
}
|
||||
PushResponse reply;
|
||||
auto status = service.Push(context, &request, &reply);
|
||||
EXPECT_TRUE(status.ok());
|
||||
|
||||
auto repos = service.Repos();
|
||||
auto result_branch = repos.at(0).tree();
|
||||
std::cerr << result_branch.at(0).DebugString() << std::endl;
|
||||
}
|
||||
|
||||
} // namespace delta_test
|
||||
} // namespace yaze_test
|
||||
315
test/rom_test.cc
Normal file
315
test/rom_test.cc
Normal file
@@ -0,0 +1,315 @@
|
||||
#include "app/rom.h"
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "absl/status/statusor.h"
|
||||
|
||||
#define BUILD_HEADER(command, length) (command << 5) + (length - 1)
|
||||
|
||||
namespace yaze_test {
|
||||
namespace rom_test {
|
||||
|
||||
using yaze::app::CompressionPiece;
|
||||
using yaze::app::ROM;
|
||||
|
||||
using ::testing::ElementsAreArray;
|
||||
using ::testing::TypedEq;
|
||||
|
||||
namespace {
|
||||
|
||||
Bytes ExpectCompressOk(ROM& rom, uchar* in, int in_size) {
|
||||
auto load_status = rom.LoadFromPointer(in, in_size);
|
||||
EXPECT_TRUE(load_status.ok());
|
||||
auto compression_status = rom.Compress(0, in_size);
|
||||
EXPECT_TRUE(compression_status.ok());
|
||||
auto compressed_bytes = std::move(*compression_status);
|
||||
return compressed_bytes;
|
||||
}
|
||||
|
||||
Bytes ExpectDecompressBytesOk(ROM& rom, Bytes& in) {
|
||||
auto load_status = rom.LoadFromBytes(in);
|
||||
EXPECT_TRUE(load_status.ok());
|
||||
auto decompression_status = rom.Decompress(0, in.size());
|
||||
EXPECT_TRUE(decompression_status.ok());
|
||||
auto decompressed_bytes = std::move(*decompression_status);
|
||||
return decompressed_bytes;
|
||||
}
|
||||
|
||||
Bytes ExpectDecompressOk(ROM& rom, uchar* in, int in_size) {
|
||||
auto load_status = rom.LoadFromPointer(in, in_size);
|
||||
EXPECT_TRUE(load_status.ok());
|
||||
auto decompression_status = rom.Decompress(0, in_size);
|
||||
EXPECT_TRUE(decompression_status.ok());
|
||||
auto decompressed_bytes = std::move(*decompression_status);
|
||||
return decompressed_bytes;
|
||||
}
|
||||
|
||||
std::shared_ptr<CompressionPiece> ExpectNewCompressionPieceOk(
|
||||
const char command, const int length, const std::string args,
|
||||
const int argument_length) {
|
||||
auto new_piece = std::make_shared<CompressionPiece>(command, length, args,
|
||||
argument_length);
|
||||
EXPECT_TRUE(new_piece != nullptr);
|
||||
return new_piece;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST(ROMTest, NewDecompressionPieceOk) {
|
||||
char command = 1;
|
||||
int length = 1;
|
||||
char args[] = "aaa";
|
||||
int argument_length = 0x02;
|
||||
CompressionPiece old_piece;
|
||||
old_piece.command = command;
|
||||
old_piece.length = length;
|
||||
old_piece.argument = args;
|
||||
old_piece.argument_length = argument_length;
|
||||
old_piece.next = nullptr;
|
||||
|
||||
auto new_piece = ExpectNewCompressionPieceOk(0x01, 0x01, "aaa", 0x02);
|
||||
|
||||
EXPECT_EQ(old_piece.command, new_piece->command);
|
||||
EXPECT_EQ(old_piece.length, new_piece->length);
|
||||
ASSERT_EQ(old_piece.argument_length, new_piece->argument_length);
|
||||
for (int i = 0; i < old_piece.argument_length; ++i) {
|
||||
EXPECT_EQ(old_piece.argument[i], new_piece->argument[i]);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(ROMTest, DecompressionValidCommand) {
|
||||
ROM rom;
|
||||
Bytes simple_copy_input = {BUILD_HEADER(0x00, 0x02), 0x2A, 0x45, 0xFF};
|
||||
uchar simple_copy_output[2] = {0x2A, 0x45};
|
||||
auto decomp_result = ExpectDecompressBytesOk(rom, simple_copy_input);
|
||||
EXPECT_THAT(simple_copy_output, ElementsAreArray(decomp_result.data(), 2));
|
||||
}
|
||||
|
||||
TEST(ROMTest, DecompressionMixingCommand) {
|
||||
ROM rom;
|
||||
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);
|
||||
EXPECT_THAT(random1_o, ElementsAreArray(decomp_result.data(), 9));
|
||||
}
|
||||
|
||||
TEST(ROMTest, CompressionSingleSet) {
|
||||
ROM rom;
|
||||
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));
|
||||
}
|
||||
|
||||
TEST(ROMTest, CompressionSingleWord) {
|
||||
ROM rom;
|
||||
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));
|
||||
}
|
||||
|
||||
TEST(ROMTest, CompressionSingleIncrement) {
|
||||
ROM rom;
|
||||
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] = {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
|
||||
TEST(ROMTest, CompressionSingleCopyRepeat) {
|
||||
ROM rom;
|
||||
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(), 9));
|
||||
}
|
||||
|
||||
TEST(ROMTest, CompressionSingleOverflowIncrement) {
|
||||
ROM rom;
|
||||
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] = {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, CompressionMixedIncrementIntraCopyOffset) {
|
||||
ROM rom;
|
||||
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 inc_word_intra_copy_expected[] = {BUILD_HEADER(0x03, 0x07),
|
||||
0x05,
|
||||
BUILD_HEADER(0x02, 0x06),
|
||||
0x05,
|
||||
0x02,
|
||||
BUILD_HEADER(0x04, 0x08),
|
||||
0x05,
|
||||
0x00,
|
||||
0xFF};
|
||||
|
||||
// "Mixing, inc, alternate, intra copy"
|
||||
// compress start: 3, length: 21
|
||||
// compressed length: 9
|
||||
auto comp_result = ExpectCompressOk(rom, to_compress_string + 3, 21);
|
||||
EXPECT_THAT(inc_word_intra_copy_expected,
|
||||
ElementsAreArray(comp_result.data(), 9));
|
||||
}
|
||||
|
||||
TEST(ROMTest, CompressionMixedIncrementIntraCopySource) {
|
||||
ROM rom;
|
||||
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 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};
|
||||
// "Mixing, inc, alternate, intra copy"
|
||||
// 0, 28
|
||||
// 16
|
||||
auto comp_result = ExpectCompressOk(rom, to_compress_string, 28);
|
||||
EXPECT_THAT(all_expected, ElementsAreArray(comp_result.data(), 16));
|
||||
}
|
||||
|
||||
TEST(ROMTest, LengthBorderCompression) {
|
||||
ROM rom;
|
||||
uchar buffer[3000];
|
||||
|
||||
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};
|
||||
|
||||
// "Extended lenght, 42 repeat of 5"
|
||||
auto comp_result = ExpectCompressOk(rom, buffer, 42);
|
||||
EXPECT_THAT(extended_lenght_expected_42,
|
||||
ElementsAreArray(comp_result.data(), 4));
|
||||
|
||||
// "Extended lenght, 400 repeat of 5"
|
||||
comp_result = ExpectCompressOk(rom, buffer, 400);
|
||||
EXPECT_THAT(extended_lenght_expected_400,
|
||||
ElementsAreArray(comp_result.data(), 4));
|
||||
|
||||
// "Extended lenght, 1050 repeat of 5"
|
||||
comp_result = ExpectCompressOk(rom, buffer, 1050);
|
||||
EXPECT_THAT(extended_lenght_expected_1050,
|
||||
ElementsAreArray(comp_result.data(), 6));
|
||||
|
||||
// "Extended lenght, 2050 repeat of 5"
|
||||
comp_result = ExpectCompressOk(rom, buffer, 2050);
|
||||
EXPECT_THAT(extended_lenght_expected_2050,
|
||||
ElementsAreArray(comp_result.data(), 9));
|
||||
}
|
||||
|
||||
TEST(ROMTest, CompressionExtendedWordCopy) {
|
||||
ROM rom;
|
||||
uchar buffer[3000];
|
||||
for (unsigned int i = 0; i < 3000; i += 2) {
|
||||
buffer[i] = 0x05;
|
||||
buffer[i + 1] = 0x06;
|
||||
}
|
||||
uchar hightlenght_word_1050[] = {
|
||||
0b11101011, 0xFF, 0x05, 0x06, BUILD_HEADER(0x02, 0x1A), 0x05, 0x06, 0xFF};
|
||||
|
||||
// "Extended word copy"
|
||||
auto comp_result = ExpectCompressOk(rom, buffer, 1050);
|
||||
EXPECT_THAT(hightlenght_word_1050, ElementsAreArray(comp_result.data(), 8));
|
||||
}
|
||||
|
||||
/* Extended Header Command is currently unimplemented
|
||||
TEST(ROMTest, ExtendedHeaderDecompress) {
|
||||
ROM rom;
|
||||
Bytes extendedcmd_i = {0b11100100, 0x8F, 0x2A, 0xFF};
|
||||
uchar extendedcmd_o[50];
|
||||
for (int i = 0; i < 50; ++i) {
|
||||
extendedcmd_o[i] = 0x2A;
|
||||
}
|
||||
|
||||
auto decomp_result = ExpectDecompressBytesOk(rom, extendedcmd_i);
|
||||
ASSERT_THAT(extendedcmd_o, ElementsAreArray(decomp_result.data(), 50));
|
||||
}
|
||||
|
||||
TEST(ROMTest, ExtendedHeaderDecompress2) {
|
||||
ROM rom;
|
||||
Bytes extendedcmd_i = {0b11100101, 0x8F, 0x2A, 0xFF};
|
||||
uchar extendedcmd_o[50];
|
||||
for (int i = 0; i < 50; i++) {
|
||||
extendedcmd_o[i] = 0x2A;
|
||||
}
|
||||
|
||||
auto data = ExpectDecompressBytesOk(rom, extendedcmd_i);
|
||||
for (int i = 0; i < 50; i++) {
|
||||
ASSERT_EQ(extendedcmd_o[i], data[i]);
|
||||
}
|
||||
}
|
||||
*/
|
||||
} // namespace rom_test
|
||||
} // namespace yaze_test
|
||||
14
test/yaze_test.cc
Normal file
14
test/yaze_test.cc
Normal file
@@ -0,0 +1,14 @@
|
||||
#define SDL_MAIN_HANDLED
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "absl/debugging/failure_signal_handler.h"
|
||||
#include "absl/debugging/symbolize.h"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
absl::InitializeSymbolizer(argv[0]);
|
||||
|
||||
absl::FailureSignalHandlerOptions options;
|
||||
absl::InstallFailureSignalHandler(options);
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
Reference in New Issue
Block a user