コード例 #1
0
 @Test
 public void testInvalidMove() {
   Fighter f = load("chuck-invalid-move.saf");
   List<Message> errs = Check.check(f);
   assertEquals(1, errs.size());
   Message error = errs.get(0);
   assertTrue(error instanceof jsaf.check.Error);
   assertNotNull(error.getMessage().matches("invalid move"));
   assertEquals(f.getBehaviors().get(0).getMove(), error.getNode());
 }
コード例 #2
0
 @Test
 public void testInvalidCond() {
   Fighter f = load("chicken-invalid-cond.saf");
   List<Message> errs = Check.check(f);
   assertEquals(1, errs.size());
   Message error = errs.get(0);
   assertTrue(error instanceof jsaf.check.Error);
   assertNotNull(error.getMessage().matches("invalid condition"));
   assertEquals(f.getBehaviors().get(1).getGuard(), error.getNode());
 }
コード例 #3
0
 @Test
 public void testOutOfBounds() {
   Fighter f = load("challenging-outofbounds.saf");
   List<Message> errs = Check.check(f);
   assertEquals(1, errs.size());
   Message error = errs.get(0);
   assertTrue(error instanceof jsaf.check.Error);
   assertNotNull(error.getMessage().matches("out of bounds"));
   assertEquals(f.getStrengths().get(0), error.getNode());
 }
コード例 #4
0
 @Test
 public void testNoAlways() {
   Fighter f = load("kicking-no-always.saf");
   List<Message> errs = Check.check(f);
   assertEquals(1, errs.size());
   Message error = errs.get(0);
   assertTrue(error instanceof jsaf.check.Error);
   assertNotNull(error.getMessage().matches("missing 'always'"));
   assertEquals(f, error.getNode());
 }
コード例 #5
0
 @Test
 public void testDuplicateInChoose() {
   Fighter f = load("unbeatable-warning.saf");
   List<Message> errs = Check.check(f);
   assertEquals(1, errs.size());
   Message error = errs.get(0);
   assertTrue(error instanceof jsaf.check.Warning);
   assertNotNull(error.getMessage().matches("duplicate action"));
   Ident a = ((Choose) f.getBehaviors().get(0).getMove()).getActions().get(1);
   assertEquals(a, error.getNode());
 }
コード例 #6
0
 @Test
 public void testInvalidFight() {
   Fighter f = load("jackie-invalid-fight.saf");
   List<Message> errs = Check.check(f);
   assertEquals(1, errs.size());
   Message error = errs.get(0);
   assertTrue(error instanceof jsaf.check.Error);
   assertNotNull(error.getMessage().matches("invalid fight"));
   Ident a = ((Choose) f.getBehaviors().get(3).getFight()).getActions().get(1);
   assertEquals(a, error.getNode());
 }