Changeset 41

Show
Ignore:
Timestamp:
01/01/07 14:44:14 (2 years ago)
Author:
chris
Message:

- added another crash demo, when calling EMdFValue.getString() on an enumeration column

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lex/trunk/test/com/qwirx/lex/CrashEmdros.java

    r26 r41  
    88 
    99import jemdros.EmdrosEnv; 
    10 import jemdros.Table; 
     10import jemdros.MatchedObject; 
     11import jemdros.Sheaf; 
     12import jemdros.SheafConstIterator; 
     13import jemdros.Straw; 
    1114import jemdros.TableRow; 
    1215import jemdros.eCharsets; 
    1316import jemdros.eOutputKind; 
     17import junit.framework.TestCase; 
    1418 
    1519/** 
     
    1923 * Window - Preferences - Java - Code Style - Code Templates 
    2024 */ 
    21 public class CrashEmdros /* extends TestCase */ { 
    22  
    23         public void testCrash() { 
     25public class CrashEmdros extends TestCase  
     26
     27    /* 
     28        public void testCrashWithZeroColumn()  
     29    { 
    2430                System.load("/usr/local/lib/emdros/libjemdros.so"); 
    2531                 
     
    3844                tr.getColumn(0); 
    3945        } 
    40          
    41         public static void main(String[] args) { 
     46 
     47    public void testCrashWithColumnTooLarge()  
     48    { 
     49        System.load("/usr/local/lib/emdros/libjemdros.so"); 
     50         
     51        EmdrosEnv env = new EmdrosEnv(eOutputKind.kOKConsole,  
     52                eCharsets.kCSISO_8859_1, "localhost", "emdf",  
     53                "changeme", "wihebrew1202"); 
     54 
     55        String query = "GET FEATURES argument_name " + 
     56                "FROM OBJECT WITH ID_D = 69977 [phrase]"; 
     57 
     58        boolean[] bCompilerResult = new boolean[1]; 
     59        env.executeString(query, bCompilerResult, false, false); 
     60         
     61        Table t = env.takeOverTable(); 
     62        TableRow tr = t.iterator().next(); 
     63        tr.getColumn(3); 
     64    } 
     65    */ 
     66 
     67    public void testCrashWithGetStringOnFeature()  
     68    { 
     69        System.load("/usr/local/lib/emdros/libjemdros.so"); 
     70         
     71        EmdrosEnv env = new EmdrosEnv(eOutputKind.kOKConsole,  
     72                eCharsets.kCSISO_8859_1, "localhost", "emdf",  
     73                "changeme", "wihebrew1202"); 
     74 
     75        String query = "SELECT ALL OBJECTS IN {1-28735} " + 
     76                "WHERE [phrase self = 69977 GET phrase_type]"; 
     77 
     78        boolean[] bCompilerResult = new boolean[1]; 
     79        env.executeString(query, bCompilerResult, false, false); 
     80         
     81        Sheaf sheaf = env.takeOverSheaf(); 
     82        SheafConstIterator sci = sheaf.const_iterator(); 
     83        Straw straw = sci.next(); 
     84        MatchedObject mo = straw.const_iterator().next(); 
     85        String str = mo.getEMdFValue("phrase_type").getString(); 
     86    } 
     87 
     88        public static void main(String[] args)  
     89    { 
    4290                // junit.textui.TestRunner.run(CrashEmdros.class); 
    43                 new CrashEmdros().testCrash(); 
     91                new CrashEmdros().testCrashWithGetStringOnFeature(); 
    4492        } 
    4593