@Test( dataProvider = "badOnlines", expectedExceptions = {ScriptBuilderException.class}) public void testBadSignatures(String str) throws ScriptBuilderException { ScriptBuilder b = new ScriptBuilder(new DefaultModel()); try { b.build("namespace test; VM[1..10] : tiny;\n@N[1..20] : defaultNode;\n" + str); } catch (ScriptBuilderException ex) { System.out.println(str + " " + ex.getMessage()); throw ex; } }
@Test(dataProvider = "goodOnlines") public void testGoodSignatures(String str, int nbNodes) throws Exception { ScriptBuilder b = new ScriptBuilder(new DefaultModel()); Set<SatConstraint> cstrs = b.build("namespace test; VM[1..10] : tiny;\n@N[1..20] : defaultNode;\n" + str) .getConstraints(); Assert.assertEquals(cstrs.size(), nbNodes); Set<Node> nodes = new HashSet<>(); for (SatConstraint x : cstrs) { Assert.assertTrue(nodes.addAll(x.getInvolvedNodes())); Assert.assertEquals(x.getInvolvedNodes().size(), 1); Assert.assertEquals(x.isContinuous(), false); } }