Skip to content

Commit

Permalink
Test case for DiskDGraph
Browse files Browse the repository at this point in the history
  • Loading branch information
pbloem committed Aug 23, 2016
1 parent 5f68c15 commit 286f334
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/test/java/nl/peterbloem/motive/Tests.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package nl.peterbloem.motive;

import static org.junit.Assert.*;

import java.io.File;
import java.io.IOException;

import org.junit.Test;
import org.nodes.DGraph;
import org.nodes.DNode;
import org.nodes.DiskDGraph;
import org.nodes.random.RandomGraphs;

/**
* General tests, not specific to a class.
* @author Peter
*
*/
public class Tests {
public static final File DIR = new File("./tmp/");

@Test
public void testSubgraphs()
throws IOException
{

DGraph<String> graph = RandomGraphs.randomDirectedFast(100, 200);
graph = DiskDGraph.copy(graph, DIR);

DPlainMotifExtractor<String> ex = new DPlainMotifExtractor<String>(graph, 100000, 3, 6, 5);

for(DGraph<String> sub : ex.subgraphs())
for(DNode<String> node : sub.nodes())
{
assertTrue(node.neighbors().size() == node.degree());

assertTrue(node.degree() > 0);
}
}

}

0 comments on commit 286f334

Please sign in to comment.