def __init__(self): self.program1 = Program(range(0, 10), "Word") self.program2 = Program(range(0, 50), "Excel") self.program3 = Program(range(0, 20), "Powerpoint") self.hdd = HDD(50) self.file_system = self.hdd.generate_file_system() self.file_system.add_file("Word", self.program1) self.file_system.add_file("Excel", self.program1) self.file_system.add_file("Powerpoint", self.program1) self.hdd.serialize_file_system(self.file_system) self.memory_manager = MemoryManager(self.hdd)
class TestProgram(unittest.TestCase): #Arrange def setUp(self): self.program = Program([], "Word") def test_whenIHaveAProgramWithoutInstructionsAndIAddOne_thenIHaveAProgramWithOneInstruction(self): inst1 = Instruction("Ejecutando Instruccion 1...") self.program.add_instruction(inst1) self.assertEqual(len(self.program.get_instructions()), 1) def test_whenIHaveAProgramWithInstructionsAndIAddOne_thenIHaveAProgramWithOneMoreInstruction(self): inst1 = Instruction("Ejecutando Instruccion 1...") self.program.add_instruction(inst1) self.previous_size = len(self.program.get_instructions()) inst2 = Instruction("Ejecutando Instruccion 2...") self.program.add_instruction(inst2) self.assertEqual(self.previous_size + 1, len(self.program.get_instructions()))
def setUp(self): self.hdd = HDD(10) self.fs = self.hdd.generate_file_system() self.instruction1 = InstructionIO() self.instruction2 = InstructionCPU() self.instructionList1 = [self.instruction1, self.instruction2] self.program1 = Program(self.instructionList1, "AProgram") self.fs.add_file("AProgram", self.program1) self.file1 = self.fs.get_program("AProgram") self.pcb = PCB(0, 2, BlockHolder(self.file1)) self.mm = MemoryManager() self.mm.set_as_ca(FirstFit()) self.mm.write(self.pcb)
class TestProgram(unittest.TestCase): #Arrange def setUp(self): self.program = Program([], "Word") def test_whenIHaveAProgramWithoutInstructionsAndIAddOne_thenIHaveAProgramWithOneInstruction( self): inst1 = Instruction("Ejecutando Instruccion 1...") self.program.add_instruction(inst1) self.assertEqual(len(self.program.get_instructions()), 1) def test_whenIHaveAProgramWithInstructionsAndIAddOne_thenIHaveAProgramWithOneMoreInstruction( self): inst1 = Instruction("Ejecutando Instruccion 1...") self.program.add_instruction(inst1) self.previous_size = len(self.program.get_instructions()) inst2 = Instruction("Ejecutando Instruccion 2...") self.program.add_instruction(inst2) self.assertEqual(self.previous_size + 1, len(self.program.get_instructions()))
def setUp(self): self.program = Program([], "Word")