@Test public void testAlreadySolved() { CobwebSolver solver = new CobwebSolver(new CobwebGraph(3).map); solver.setEdge(1, 2, Edge.EdgeOperation.DIVISION, 2); solver.setEdge(3, 2, Edge.EdgeOperation.ADDITION, 1); solver.setEdge(1, 3, Edge.EdgeOperation.DIVISION, 3); solver.setNode(1, 6); solver.setNode(2, 3); solver.setNode(3, 2); assertEquals(CobwebSolver.SolverState.SOLVED_ALREADY, solver.numberOfSolutions()); }
@Test public void testSolverInit() { CobwebGraph cw = new CobwebGraph(3); CobwebSolver solver = new CobwebSolver(cw.map); assertTrue(solver.hasUnreachableNodes()); solver.setEdge(1, 2, Edge.EdgeOperation.ADDITION, 1); solver.setEdge(1, 3, Edge.EdgeOperation.ADDITION, 1); assertFalse(solver.hasUnreachableNodes()); assertEquals(null, solver.getNodeValue(1)); solver.setNode(1, 5); assertTrue(solver.getNodeValue(1).equals(5)); }