def test_generation_receive_message(): tl = Timeline() node = Node("e1", tl) m0 = FakeNode("m1", tl) qc = QuantumChannel("qc_nodem1", tl, 0, 1e3) qc.set_ends(node, m0) node.memory_array = MemoryArray("", tl) node.assign_cchannel(ClassicalChannel("", tl, 0, delay=1), "m1") eg = EntanglementGenerationA(node, "EG", middle="m1", other="e2", memory=node.memory_array[0]) eg.qc_delay = 1 # negotiate message msg = EntanglementGenerationMessage(GenerationMsgType.NEGOTIATE_ACK, "EG", emit_time=0) assert eg.received_message("e2", msg) is True assert eg.expected_time == 1 assert len(tl.events.data) == 2 # excite and next start time
def test_Node_assign_cchannel(): tl = Timeline() node = Node("node1", tl) cc = ClassicalChannel("cc", tl, 1e3) node.assign_cchannel(cc, "node2") assert "node2" in node.cchannels and node.cchannels["node2"] == cc