Skip to content

Commit

Permalink
fix tests, format
Browse files Browse the repository at this point in the history
  • Loading branch information
mpollmeier committed Apr 30, 2024
1 parent 5f37d8c commit 91e4513
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 26 deletions.
39 changes: 17 additions & 22 deletions tests/src/test/scala/flatgraph/TestGraphs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,12 @@ import java.nio.file.Path
object TestGraphs {

/** graph from genericDomain with two nodes, one edge and lots of properties:
*
* #Node numbers (kindId, nnodes) (0: 2), (1: 0), total 2
* Node kind 0. (eid, nEdgesOut, nEdgesIn): (0, 1 [dense], 1 [dense]),
* node_a_0 : int_mandatory: [42], string_list: [node 1 c1, node 1 c2], string_mandatory: [node 1 a], string_optional: [node 1 b]
* node_a_0 [connected_to] -> (edge property) node_a_1
* node_a_1 : int_list: [10, 11, 12], int_mandatory: [1], int_optional: [2], string_mandatory: [<empty>]
* node_a_1 [connected_to] <- (edge property) node_a_0
* Node kind 1. (eid, nEdgesOut, nEdgesIn): (0, 0 [NA], 0 [NA]),
*
* */
*
* #Node numbers (kindId, nnodes) (0: 2), (1: 0), total 2 Node kind 0. (eid, nEdgesOut, nEdgesIn): (0, 1 [dense], 1 [dense]), node_a_0 :
* int_mandatory: [42], string_list: [node 1 c1, node 1 c2], string_mandatory: [node 1 a], string_optional: [node 1 b] node_a_0
* [connected_to] -> (edge property) node_a_1 node_a_1 : int_list: [10, 11, 12], int_mandatory: [1], int_optional: [2], string_mandatory:
* [<empty>] node_a_1 [connected_to] <- (edge property) node_a_0 Node kind 1. (eid, nEdgesOut, nEdgesIn): (0, 0 [NA], 0 [NA]),
*/
def createSimpleGraph(storageMaybe: Option[Path] = None): GenericDomain = {
val genericDomain = storageMaybe match {
case None => GenericDomain.empty
Expand All @@ -36,22 +32,21 @@ object TestGraphs {
genericDomain
}

/**
* L3 <- L2 <- L1 <- Center -> R1 -> R2 -> R3 -> R4 -> R5
*/
/** L3 <- L2 <- L1 <- Center -> R1 -> R2 -> R3 -> R4 -> R5
*/
def createFlatlineGraph(): GenericDomain = {
val genericDomain = GenericDomain.empty
val diffGraph = GenericDomain.newDiffGraphBuilder
val diffGraph = GenericDomain.newDiffGraphBuilder

val center = NewNodeA().stringMandatory("Center")
val l1 = NewNodeA().stringMandatory("L1")
val l2 = NewNodeA().stringMandatory("L2")
val l3 = NewNodeA().stringMandatory("L3")
val r1 = NewNodeA().stringMandatory("R1")
val r2 = NewNodeA().stringMandatory("R2")
val r3 = NewNodeA().stringMandatory("R3")
val r4 = NewNodeA().stringMandatory("R4")
val r5 = NewNodeA().stringMandatory("R5")
val l1 = NewNodeA().stringMandatory("L1")
val l2 = NewNodeA().stringMandatory("L2")
val l3 = NewNodeA().stringMandatory("L3")
val r1 = NewNodeA().stringMandatory("R1")
val r2 = NewNodeA().stringMandatory("R2")
val r3 = NewNodeA().stringMandatory("R3")
val r4 = NewNodeA().stringMandatory("R4")
val r5 = NewNodeA().stringMandatory("R5")

// TODO reimplement arrow synax from odb
// center --- Connection.Label --> l1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class PathFinderTests extends AnyWordSpec {
/* sample graph:
* L3 <- L2 <- L1 <- Center -> R1 -> R2 -> R3 -> R4 -> R5
*/
val flatlineGraph = TestGraphs.createFlatlineGraph()
val flatlineGraph = TestGraphs.createFlatlineGraph()
val Seq(center, l1, l2, l3, r1, r2, r3, r4, r5) = flatlineGraph.nodeA.sortBy(_.stringMandatory).l

"verify graph setup" in {
Expand All @@ -27,7 +27,7 @@ class PathFinderTests extends AnyWordSpec {
r4.stringMandatory shouldBe "R4"
r5.stringMandatory shouldBe "R5"
}

"identity" in {
val path = PathFinder(center, center)
path shouldBe Seq(Path(Seq(center)))
Expand Down Expand Up @@ -90,4 +90,4 @@ class PathFinderTests extends AnyWordSpec {
PathFinder(center, r3, maxDepth = 2) shouldBe Nil
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import java.nio.file.Paths
import scala.jdk.CollectionConverters.CollectionHasAsScala

class Neo4jCsvTests extends AnyWordSpec {
val subprojectRoot = testutils.ProjectRoot.relativise("formats-tests")
val subprojectRoot = testutils.ProjectRoot.relativise("tests")
val neo4jcsvRoot = Paths.get(subprojectRoot, "src/test/resources/neo4jcsv")

"Exporter should export valid csv" in {
Expand Down

0 comments on commit 91e4513

Please sign in to comment.