<commit_before>package core

import "testing"

func TestNop(t *testing.T) {
	system := New()
	system.cpu.ProgramCounter = 1
	instruction := (*system.cpu.instructionSet)[0x0]
	instruction.execute()
	if system.cpu.ProgramCounter != 1 {
		t.Logf("system.cpu.ProgramCounter = %d, expected = 2", system.cpu.ProgramCounter)
		t.Fail()
	}
}

// func TestLdBcNn(t *testing.T) {
// 	system := New()
// 	system.cpu.registers.B = 0
// 	system.cpu.registers.C = 0
// 	system.cpu.ProgramCounter = 1

// 	instruction := (*system.cpu.instructionSet)[0x1]
// 	instruction.execute()
// 	fmt.Println("initialize instruciton set")

// 	if system.cpu.ProgramCounter != uint16(instruction.length) {
// 		t.Logf("system.cpu.ProgramCounter = %d, expected = %d", system.cpu.ProgramCounter, 3)
// 		t.Fail()
// 	}
// }<commit_msg>ld bc nn unit test<commit_after>package core

import (
	"fmt"
	"testing"
)

func TestNop(t *testing.T) {
	system := New()
	system.cpu.ProgramCounter = 1
	instruction := (*system.cpu.instructionSet)[0x0]
	instruction.execute()
	if system.cpu.ProgramCounter != 1 {
		t.Logf("system.cpu.ProgramCounter = %d, expected = 1", system.cpu.ProgramCounter)
		t.Fail()
	}
}

func TestLdBcNn(t *testing.T) {
	system := New()
	system.cpu.registers.B = 0
	system.cpu.registers.C = 0
	system.cpu.ProgramCounter = 0
	system.cpu.mmu.writeWord(0x0, 0xFF0F)

	instruction := (*system.cpu.instructionSet)[0x1]
	instruction.execute()
	fmt.Println("initialize instruciton set")

	if system.cpu.ProgramCounter != uint16(instruction.length-1) {
		t.Logf("system.cpu.ProgramCounter = %d, expected = %d", system.cpu.ProgramCounter, 2)
		t.Fail()
	}

	if system.cpu.registers.B != 0xFF {
		t.Logf("system.cpu.registers.B = %d, expected = %d", system.cpu.registers.B, 0xFF)
		t.Fail()
	}

	if system.cpu.registers.C != 0x0F {
		t.Logf("system.cpu.registers.C = %d, expected = %d", system.cpu.registers.C, 0x0F)
		t.Fail()
	}
}
{'fraction_non_alphanumeric': 0.17393589069889648, 'fraction_numerical': 0.019442984760903836, 'mean_word_length': 3.857142857142857, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7438827', 'n_tokens_mistral': 785, 'n_tokens_neox': 731, 'n_words': 127}