Beispiel #1
0
 def test_in_port_capnp_wiring_direct(self):
     """In port has limit on port size."""
     n = RealNode(DeltaGraph(), [], name='node_name')
     in_port = InPort("index", as_delta_type(int), n, 1)
     wire = dotdf_capnp.Wire.new_message()
     nodes = [dotdf_capnp.Node.new_message()]
     nodes[0].name = n.full_name
     nodes[0].init("inPorts", 1)
     nodes[0].inPorts[0].name = "index"
     in_port.capnp_wiring(nodes, wire)
     self.assertEqual(wire.destNode, 0)
     self.assertEqual(wire.destInPort, 0)
     self.assertEqual(wire.direct, True)
Beispiel #2
0
 def test_in_port_capnp_wiring_direct(self):
     """In port has limit on port size."""
     in_port = InPort(NamespacedName("node_name", "index"),
                      as_delta_type(int), None, 1)
     wire = dotdf_capnp.Wire.new_message()
     nodes = [dotdf_capnp.Node.new_message()]
     nodes[0].name = "node_name"
     nodes[0].init("inPorts", 1)
     nodes[0].inPorts[0].name = "index"
     in_port.capnp_wiring(nodes, wire)
     self.assertEqual(wire.destNode, 0)
     self.assertEqual(wire.destInPort, 0)
     self.assertEqual(wire.direct, True)
Beispiel #3
0
 def test_in_port_capnp_wiring(self):
     """Generate wiring."""
     n = RealNode(DeltaGraph(), [], name='node_name')
     in_port = InPort("index", as_delta_type(int), n, 0)
     wire = dotdf_capnp.Wire.new_message()
     nodes = [dotdf_capnp.Node.new_message() for _ in range(3)]
     nodes[0].name = "fake_name"
     nodes[1].name = "fake_name"
     nodes[2].name = n.full_name
     nodes[2].init("inPorts", 3)
     nodes[2].inPorts[0].name = "fake_name"
     nodes[2].inPorts[1].name = "index"
     nodes[2].inPorts[2].name = "fake_name"
     in_port.capnp_wiring(nodes, wire)
     self.assertEqual(wire.destNode, 2)
     self.assertEqual(wire.destInPort, 1)
     self.assertEqual(wire.direct, False)
Beispiel #4
0
 def test_in_port_capnp_wiring(self):
     """Generate wiring."""
     in_port = InPort(NamespacedName("node_name", "index"),
                      as_delta_type(int), None, 0)
     wire = dotdf_capnp.Wire.new_message()
     nodes = [dotdf_capnp.Node.new_message() for _ in range(3)]
     nodes[0].name = "fake_name"
     nodes[1].name = "fake_name"
     nodes[2].name = "node_name"
     nodes[2].init("inPorts", 3)
     nodes[2].inPorts[0].name = "fake_name"
     nodes[2].inPorts[1].name = "index"
     nodes[2].inPorts[2].name = "fake_name"
     in_port.capnp_wiring(nodes, wire)
     self.assertEqual(wire.destNode, 2)
     self.assertEqual(wire.destInPort, 1)
     self.assertEqual(wire.direct, False)