public void CopyStructure_For_Nodes_With_0_Cols(int testId, int numNodes, int numEdges, bool isDirected, bool selfLoops, bool multiEdges) { //Arrange var copier = new DataAttributeTableCopier(); #region Create src and target networks IBasicAdjList src = BasicAdjListGenerator.GenerateAdjListWithDataAttribs(numNodes, numEdges, isDirected, true, false); IBasicAdjList targ = BasicAdjListGenerator.GenerateAdjListWithDataAttribs(numNodes, numEdges, isDirected, true, false); #endregion //Act copier.CopyStructure(src.NodeData, targ.NodeData); //Assert Assert.NotNull(targ.NodeData); Assert.Equal(src.NodeData.ColumnCount, targ.NodeData.ColumnCount); Assert.Equal(numNodes, targ.NodeData.RowCount); for (int i = 0; i < targ.NodeDataAttributeCount; i++) { Assert.Equal(src.NodeData.DataTypes[i], targ.NodeData.DataTypes[i]); Assert.Equal(src.NodeData.ColumnNames[i], targ.NodeData.ColumnNames[i]); Assert.Equal(src.NodeData.ColumnDefaultValues[i], targ.NodeData.ColumnDefaultValues[i]); } }
public void CopyStructure_For_Nodes(int testId, int numNodes, int numEdges, bool isDirected, bool selfLoops, bool multiEdges, int[] intVals, double[] doubleVals, bool[] boolVals, string[] stringVals) { //Arrange var copier = new DataAttributeTableCopier(); #region Create src and target networks IBasicAdjList src = BasicAdjListGenerator.GenerateAdjListWithDataAttribs(numNodes, numEdges, isDirected, true, false); var builder = new DataAttributesBuilder(); var colIndex = builder.AddColumn((INodeAttributes)src, typeof(int)); builder.PopulateCol<int, INode>(src.NodeData, colIndex, intVals); colIndex = builder.AddColumn((INodeAttributes)src, typeof(double)); builder.PopulateCol<double, INode>(src.NodeData, colIndex, doubleVals); colIndex = builder.AddColumn((INodeAttributes)src, typeof(bool)); builder.PopulateCol<bool, INode>(src.NodeData, colIndex, boolVals); colIndex = builder.AddColumn((INodeAttributes)src, typeof(string)); builder.PopulateCol<string, INode>(src.NodeData, colIndex, stringVals); IBasicAdjList targ = BasicAdjListGenerator.GenerateAdjListWithDataAttribs(numNodes, numEdges, isDirected, true, false); //builder.AddColumn((INodeAttributes)src, typeof(int)); //builder.AddColumn((INodeAttributes)src, typeof(double)); //builder.AddColumn((INodeAttributes)src, typeof(bool)); //builder.AddColumn((INodeAttributes)src, typeof(string)); #endregion //Act copier.CopyStructure(src.NodeData, targ.NodeData); //Assert Assert.NotNull(targ.NodeData); Assert.Equal(src.NodeData.ColumnCount, targ.NodeData.ColumnCount); Assert.Equal(numNodes, targ.NodeData.RowCount); for (int i = 0; i < targ.NodeDataAttributeCount; i++ ) { Assert.Equal(src.NodeData.DataTypes[i], targ.NodeData.DataTypes[i]); Assert.Equal(src.NodeData.ColumnNames[i], targ.NodeData.ColumnNames[i]); Assert.Equal(src.NodeData.ColumnDefaultValues[i], targ.NodeData.ColumnDefaultValues[i]); } }