
#[test]
fn test_instruction_table_completeness() {
    use core::instruction_table::INSTRUCTION_TABLE; // Adjust to your actual path

    let mut defined_count = 0;
    let mut defined_opcodes = vec![];

    for (i, entry) in INSTRUCTION_TABLE.iter().enumerate() {
        if let Some(info) = entry {
            defined_count += 1;
            defined_opcodes.push(i);
            // Optional: sanity check
            assert!(
                info.length > 0 && info.cycles > 0,
                "Invalid OpInfo at opcode {:#04x?}",
                i
            );
        }
    }

    println!("Defined opcodes: {}", defined_count);
    for i in 0..256 {
        if defined_opcodes.contains(&i) {
            print!("{:02x} ", i);
        }
    }
    println!("\nMissing opcodes:");
    for i in 0..256 {
        if !defined_opcodes.contains(&i) {
            print!("{:02x} ", i);
        }
    }
    println!();

    // The standard 6502 has 151 documented opcodes
    assert_eq!(
        defined_count, 151,
        "Expected 151 opcodes, found {}",
        defined_count
    );
}