mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-15 21:43:53 +00:00
Added for loops to the expression parser, java style.
Also: - Added a test case for for - Fixed Identifiable.id() for the runtime Nodes and added missing elements to the list in Identifiable.java. - Factored keyword and character consumption into a common function.
This commit is contained in:
@ -92,6 +92,11 @@ public class ExpressionTest {
|
||||
assertEquals(5, simpleEval("c=5; a=0; do { ++a; --c; } while (c > 0) a"), 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFor() throws ExpressionException {
|
||||
assertEquals(5, simpleEval("a=0; for (i=0; i<5; ++i) { ++a; } a"), 0);
|
||||
}
|
||||
|
||||
private double simpleEval(String expression) throws ExpressionException {
|
||||
return Expression.compile(expression).evaluate();
|
||||
}
|
||||
|
Reference in New Issue
Block a user