Refactor RomTest to include LoadFromFile tests

This commit is contained in:
scawful
2024-08-14 00:32:02 -04:00
parent a267138d70
commit 5d9c5354b0

View File

@@ -3,8 +3,12 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
namespace yaze_test {
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "test/core/testing.h"
namespace yaze {
namespace test {
using yaze::app::Rom;
class RomTest : public ::testing::Test {
@@ -17,4 +21,18 @@ TEST_F(RomTest, RomTest) {
EXPECT_EQ(rom_.data(), nullptr);
}
} // namespace yaze_test
TEST_F(RomTest, LoadFromFile) {
EXPECT_OK(rom_.LoadFromFile("test.sfc"));
EXPECT_EQ(rom_.size(), 0x200000);
EXPECT_NE(rom_.data(), nullptr);
}
TEST_F(RomTest, LoadFromFileInvalid) {
EXPECT_THAT(rom_.LoadFromFile("invalid.sfc"),
StatusIs(absl::StatusCode::kNotFound));
EXPECT_EQ(rom_.size(), 0);
EXPECT_EQ(rom_.data(), nullptr);
}
} // namespace test
} // namespace yaze