neser 0.1.1

NESER - NES Emulator in Rust - is a NES emulator written in Rust. It aims to be a high-quality, hardware-accurate emulator that is also easy to use and extend. It supports a wide range of NES games and features, including various mappers, audio processing, and input handling. NESER is designed to be modular and extensible, allowing developers to easily add new features or support for additional hardware. It can be run using one of two frontends: a native desktop application using SDL2, or a web application using WebAssembly. The desktop application provides a high-performance, feature-rich experience with support for various input devices and display options, while the web application allows users to play NES games directly in their browsers without needing to install any software in a BYOR manner (Bring Your Own Roms).
Documentation
"""Unit tests for RomDbIndex."""

from pathlib import Path
import tempfile
import unittest

from .rom_db_index import RomDbIndex


class RomDbIndexTests(unittest.TestCase):
    """Behavior tests for ROM DB CRC lookup parsing."""

    def test_lookup_by_crc(self) -> None:
        """ROM DB loader builds lookup keys from CSV rows."""

        with tempfile.TemporaryDirectory() as temp_dir_str:
            csv_path = Path(temp_dir_str) / "rom_db.csv"
            csv_path.write_text(
                "# comment\n"
                "1,Test Game,,836C4FA7,0,Licensed Japan,4,2,H,0,0,0,0,0,0,0,0,0,,,1\n",
                encoding="utf-8",
            )

            index = RomDbIndex.from_csv(csv_path)
            entry = index.lookup("836c4fa7")

            self.assertIsNotNone(entry)
            assert entry is not None
            self.assertEqual(entry.name, "Test Game")
            self.assertEqual(entry.mapper, "4")
            self.assertEqual(entry.submapper, "2")

    def test_parses_unquoted_name_with_comma(self) -> None:
        """Parser keeps CRC/mapper columns correct when names contain commas."""

        with tempfile.TemporaryDirectory() as temp_dir_str:
            csv_path = Path(temp_dir_str) / "rom_db.csv"
            csv_path.write_text(
                "1,Name, With Comma,,1234ABCD,0,Licensed Japan,7,1,H,0,0,0,0,0,0,0,0,0,,,1\n",
                encoding="utf-8",
            )

            index = RomDbIndex.from_csv(csv_path)
            entry = index.lookup("1234ABCD")

            self.assertIsNotNone(entry)
            assert entry is not None
            self.assertEqual(entry.mapper, "7")
            self.assertEqual(entry.submapper, "1")