use of org.mvel2.tests.core.res.Bar in project mvel by mikebrock.
the class InlineCollectionsPerformance method testMVELList.
// public static void testMVELList() {
//
// ExecutableAccessor s = (ExecutableAccessor) MVEL.compileExpression("['Foo244':'Bar','Foo244':'Bar','Foo244':'Bar','Foo244':'Bar','Foo244':'Bar']");
// Map list;
// s.getNode().getReducedValueAccelerated(null, null, null);
// for (int i = 0; i < COUNT; i++) {
// list = (Map) s.getNode().getAccessor().getValue(null, null, null);
//
// }
// }
// public static void testMVELList() {
//
// ExecutableAccessor s = (ExecutableAccessor) MVEL.compileExpression("{'Foo244','Bar','Foo244','Bar','Foo244','Bar','Foo244','Bar','Foo244','Bar'}");
// Object[] list;
// s.getNode().getReducedValueAccelerated(null, null, null);
// for (int i = 0; i < COUNT; i++) {
// list = (Object[]) s.getNode().getAccessor().getValue(null, null, null);
//
// // assert "Foo244".equals(list.get(0)) && "Foo244".equals(list.get(2)) && list.size() == 10;
// }
// }
public static void testMVELList() {
ExecutableAccessor s = (ExecutableAccessor) MVEL.compileExpression("['Foo244','Bar','Foo244','Bar','Foo244','Bar','Foo244','Bar','Foo244','Bar']");
List list;
s.getNode().getReducedValueAccelerated(null, null, null);
for (int i = 0; i < COUNT; i++) {
list = (List) s.getNode().getAccessor().getValue(null, null, null);
assert "Foo244".equals(list.get(0)) && "Foo244".equals(list.get(2)) && list.size() == 10;
}
}
use of org.mvel2.tests.core.res.Bar in project mvel by mikebrock.
the class InlineCollectionsPerformance method testJavaList.
public static void testJavaList() {
FastList list;
for (int i = 0; i < COUNT; i++) {
list = new FastList(10);
list.add("Foo244");
list.add("Bar");
list.add("Foo244");
list.add("Bar");
list.add("Foo244");
list.add("Bar");
list.add("Foo244");
list.add("Bar");
list.add("Foo244");
list.add("Bar");
assert "Foo244".equals(list.get(0)) && "Bar".equals(list.get(1)) && list.size() == 10;
}
}
use of org.mvel2.tests.core.res.Bar in project mvel by mikebrock.
the class ProjectionsTests method testProjectionSupport3.
public void testProjectionSupport3() {
String ex = "(toUpperCase() in ['bar', 'foo'])[1]";
Map vars = createTestMap();
assertEquals("FOO", MVEL.eval(ex, new Base(), vars));
assertEquals("FOO", test("(toUpperCase() in ['bar', 'foo'])[1]"));
}
use of org.mvel2.tests.core.res.Bar in project mvel by mikebrock.
the class TemplateTests method setupVarsMVEL219.
private Map<String, Object> setupVarsMVEL219() {
Map<String, Object> vars = new LinkedHashMap<String, Object>();
vars.put("bal", new BigDecimal("999.99"));
vars.put("word", "ball");
vars.put("object", new CoreConfidenceTests.Dog());
Map<String, Object> map = new HashMap<String, Object>();
map.put("foo", "bar");
map.put("fu", new CoreConfidenceTests.Dog());
map.put("trueValue", true);
map.put("falseValue", false);
map.put("one", 1);
map.put("zero", 0);
vars.put("map", map);
return vars;
}
use of org.mvel2.tests.core.res.Bar in project mvel by mikebrock.
the class TypesAndInferenceTests method testAnalysisCompile.
public void testAnalysisCompile() {
ParserContext pCtx = new ParserContext();
ExpressionCompiler e = new ExpressionCompiler("foo.aValue = 'bar'");
e.setVerifyOnly(true);
e.compile(pCtx);
assertTrue(pCtx.getInputs().keySet().contains("foo"));
assertEquals(1, pCtx.getInputs().size());
assertEquals(0, pCtx.getVariables().size());
}
Aggregations