Revision 46011

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/test/java/org/gvsig/expresionevaluator/impl/TestGrammarCompiler.java
264 264

  
265 265
        Code code = compiler.compileExpression(source);
266 266
        link(code);
267
        assertEquals("CASE((\"software\" LIKE '%gvSIG%'), 'gvSIG', 'Other')", code.toString());
267
        assertEquals("CASE WHEN (\"software\" LIKE '%gvSIG%') THEN 'gvSIG' ELSE 'Other' END", code.toString());
268 268
    }
269 269

  
270 270
    public void testCase1() {
......
274 274

  
275 275
        Code code = compiler.compileExpression(source);
276 276
        link(code);
277
        assertEquals("CASE((\"software\" LIKE '%gvSIG%'), 'gvSIG', 'Other')", code.toString());
277
        assertEquals("CASE WHEN (\"software\" LIKE '%gvSIG%') THEN 'gvSIG' ELSE 'Other' END", code.toString());
278 278
    }
279 279

  
280 280
    public void testCase2() {
......
284 284

  
285 285
        Code code = compiler.compileExpression(source);
286 286
        link(code);
287
        assertEquals("CASE(((\"Field_1\" >= 75) AND (\"Field_1\" <= 79)), ((\"Field_1\" >= 80) AND (\"Field_1\" <= 84)), 100, 110)", code.toString());
287
        assertEquals("CASE WHEN ((\"Field_1\" >= 75) AND (\"Field_1\" <= 79)) THEN 100 WHEN ((\"Field_1\" >= 80) AND (\"Field_1\" <= 84)) THEN 110 END", code.toString());
288 288
    }
289 289
    
290 290
    public void testCase3() {
......
294 294

  
295 295
        Code code = compiler.compileExpression(source);
296 296
        link(code);
297
        assertEquals("CASE(((\"Field_1\" >= 75) AND (\"Field_1\" <= 79)), ((\"Field_1\" >= 80) AND (\"Field_1\" <= 84)), 100, 110, 120)", code.toString());
297
        assertEquals("CASE WHEN ((\"Field_1\" >= 75) AND (\"Field_1\" <= 79)) THEN 100 WHEN ((\"Field_1\" >= 80) AND (\"Field_1\" <= 84)) THEN 110 ELSE 120 END", code.toString());
298 298
    }
299 299
    
300
    public void testCase3b() {
301
        String source = "CASE WHEN Field_1 >= 75 AND Field_1 <=79 THEN 100; WHEN Field_1 >=80 AND Field_1 <=84 THEN 110; ELSE 120; END CASE"; // ;)
302

  
303
        Compiler compiler = createCompiler();
304
        Code code = compiler.compileExpression(source);
305
        link(code);
306
        assertEquals("CASE WHEN ((\"Field_1\" >= 75) AND (\"Field_1\" <= 79)) THEN 100 WHEN ((\"Field_1\" >= 80) AND (\"Field_1\" <= 84)) THEN 110 ELSE 120 END", code.toString());
307
        code = compiler.compileExpression(code.toString());
308
        link(code);
309
        assertEquals("CASE WHEN ((\"Field_1\" >= 75) AND (\"Field_1\" <= 79)) THEN 100 WHEN ((\"Field_1\" >= 80) AND (\"Field_1\" <= 84)) THEN 110 ELSE 120 END", code.toString());
310
    }
311
    
300 312
    public void testDef1() {
301 313
        String source = "CREATE PROCEDURE test1 AS BEGIN print('Hola'); END PROCEDURE"; 
302 314

  

Also available in: Unified diff