public void Should_parse_data_to_program() { var cpu = new CPU(); var loader = new ProgramLoader(); var data = new[] { "nop +5", "acc -4", "jmp 0" }; loader.Load(data, cpu); Assert.Equal(3, cpu.Program.Count); Assert.IsType <NoOperation>(cpu.Program[0]); Assert.Equal(5, cpu.Program[0].Arguments[0]); Assert.IsType <Accumulate>(cpu.Program[1]); Assert.Equal(-4, cpu.Program[1].Arguments[0]); Assert.IsType <Jump>(cpu.Program[2]); Assert.Equal(0, cpu.Program[2].Arguments[0]); }
static bool LoadProgram(IChip8Device device, string programPath) { using (var stream = new FileStream(programPath, FileMode.Open)) using (var loader = new ProgramLoader(device)) loader.Load(stream); return(true); }
public void TestLoadProgram() { var program = ProgramLoader.Load("CompilerTest.mvm"); Assert.IsNotNull(program); }
public void LoadProgram(string path) { var programLoader = new ProgramLoader(Cpu); programLoader.Load(path); }
static void LoadProgram(IChip8Device device, string programPath) { using (var stream = new FileStream("program", FileMode.Open)) using (var loader = new ProgramLoader(device)) loader.Load(stream); }