Fix some minor bugs, Update of the comments, 100 % test coverage, tests update and... 25/1925/2
Sylvestre Ledru [Tue, 14 Sep 2010 14:54:45 +0000 (16:54 +0200)]
Change-Id: Ie3ac560ccc139167f9ddb6858018cb8af94fbcf6

scilab/modules/types/src/java/org/scilab/modules/types/ScilabBoolean.java
scilab/modules/types/src/java/org/scilab/modules/types/ScilabDouble.java
scilab/modules/types/src/java/org/scilab/modules/types/ScilabInteger.java
scilab/modules/types/src/java/org/scilab/modules/types/ScilabString.java
scilab/modules/types/src/java/org/scilab/modules/types/ScilabType.java
scilab/modules/types/tests/java/org/scilab/tests/modules/types/testEquals.java

index 317b534..f85658a 100644 (file)
@@ -21,101 +21,101 @@ import java.util.Arrays;
 public class ScilabBoolean implements ScilabType {
 
        /* the boolean data */
-    private boolean[][] data;
+       private boolean[][] data;
 
-    /**
-     * Create an empty object
+       /**
+        * Create an empty object
         */
-    public ScilabBoolean() {
+       public ScilabBoolean() {
                data = null;
-    }
-    
-    /**
-     * Create an object from an array of array of boolean
-     *
-     * @param data the array of boolean
+       }
+       
+       /**
+        * Create an object from an array of array of boolean
+        *
+        * @param data the array of boolean
         */
-    public ScilabBoolean(boolean[][] data) {
+       public ScilabBoolean(boolean[][] data) {
                this.data = data;
-    }
-    
-    /**
-     * Create a scalar boolean from a boolean
-     *
-     * @param value the boolean
+       }
+       
+       /**
+        * Create a scalar boolean from a boolean
+        *
+        * @param value the boolean
         */
-    public ScilabBoolean(boolean value) {
+       public ScilabBoolean(boolean value) {
                this.data = new boolean[1][1];
                this.data[0][0] = value;
-    }
+       }
 
-    /**
-     * Change the value with the provided data
-     *
-     * @param data array of boolean
+       /**
+        * Change the value with the provided data
+        *
+        * @param data array of boolean
         */
-    public void setData(boolean[][] data) {
+       public void setData(boolean[][] data) {
                this.data = data;
-    }
+       }
 
-    /**
-     * Return the data
-     *
-     * @return the array of array of boolean
+       /**
+        * Return the data
+        *
+        * @return the array of array of boolean
         */
-    public boolean[][] getData() {
+       public boolean[][] getData() {
                return data;
-    }
+       }
 
-    /**
-     * Return the height (number of element) of the stored data
-     *
-     * @return the height
+       /**
+        * Return the height (number of element) of the stored data
+        *
+        * @return the height
         */
-    public int getHeight() {
+       public int getHeight() {
                if (data == null) {
                        return 0;
                }
                return data.length;
-    }
+       }
 
-    /**
-     * Return the width (number of element) of the stored data
-     *
-     * @return the width
+       /**
+        * Return the width (number of element) of the stored data
+        *
+        * @return the width
         */
-    public int getWidth() {
+       public int getWidth() {
                if (data == null) {
                        return 0;
                }
                return data[0].length;
-    }
+       }
 
-    /**
-     * If it is empty / uninitialized
-     *
-     * @return true if empty
+       /**
+        * If it is empty / uninitialized
+        *
+        * @return true if empty
         */
-    public boolean isEmpty() {
-       return (data == null);
-    }
-    
+       public boolean isEmpty() {
+               return (data == null);
+       }
+       
 
-    /**
+       /**
         * @see org.scilab.modules.types.ScilabType#equals(Object)
-     */
-    public boolean equals(Object obj) {
-        if (obj instanceof ScilabBoolean) {
-            return Arrays.deepEquals(this.getData(), ((ScilabBoolean)obj).getData());
-        } else {
-            return false;
-        }
-    }
+        */
+       public boolean equals(Object obj) {
+               if (obj instanceof ScilabBoolean) {
+                       return Arrays.deepEquals(this.getData(), ((ScilabBoolean)obj).getData());
+               } else {
+                       return false;
+               }
+       }
 
-    /**
-     * Display the matrix
-     *
-     * @return the pretty print
+       /**
+        * Display the representation in the Scilab language of the type
+        *
+        * @return the pretty print
         */
        public String toString() {
                StringBuilder result = new StringBuilder();
index 661f6ce..acf162d 100644 (file)
@@ -136,16 +136,16 @@ public class ScilabDouble implements ScilabType {
         * @return the serialized matrix with complex values
         */
        public double[] getSerializedComplexMatrix() {
-        int size = this.getHeight()*this.getWidth();
-        double [] serializedComplexMatrix = new double[size*2];
-        for (int i = 0; i < this.getHeight(); i++) {
-            for (int j = 0; j < this.getWidth(); j++) {
-                serializedComplexMatrix[j * this.getHeight() + i] = realPart[i][j];
-                serializedComplexMatrix[size+j * this.getHeight() + i] = imaginaryPart[i][j];
-            }
-        }
+               int size = this.getHeight()*this.getWidth();
+               double [] serializedComplexMatrix = new double[size*2];
+               for (int i = 0; i < this.getHeight(); i++) {
+                       for (int j = 0; j < this.getWidth(); j++) {
+                               serializedComplexMatrix[j * this.getHeight() + i] = realPart[i][j];
+                               serializedComplexMatrix[size+j * this.getHeight() + i] = imaginaryPart[i][j];
+                       }
+               }
 
-        return serializedComplexMatrix;
+               return serializedComplexMatrix;
        }
 
 
@@ -174,25 +174,26 @@ public class ScilabDouble implements ScilabType {
                return realPart[0].length;
        }
 
-    /**
+       /**
         * @see org.scilab.modules.types.ScilabType#equals(Object)
-     */
-    public boolean equals(Object obj) {
-        if (obj instanceof ScilabDouble) {
-            ScilabDouble sciDouble = ((ScilabDouble)obj);
-            if (this.isReal() && sciDouble.isReal()) {
-                return Arrays.deepEquals(this.getRealPart(), sciDouble.getRealPart());
-            } else {
-                /* Complex */
-                return Arrays.deepEquals(this.getRealPart(), sciDouble.getRealPart()) && Arrays.deepEquals(this.getImaginaryPart(), sciDouble.getImaginaryPart());
-            }
-        } else {
-            return false;
-        }
-    }
+        */
+       public boolean equals(Object obj) {
+               if (obj instanceof ScilabDouble) {
+                       ScilabDouble sciDouble = ((ScilabDouble)obj);
+                       if (this.isReal() && sciDouble.isReal()) {
+                               return Arrays.deepEquals(this.getRealPart(), sciDouble.getRealPart());
+                       } else {
+                               /* Complex */
+                               return Arrays.deepEquals(this.getRealPart(), sciDouble.getRealPart()) && Arrays.deepEquals(this.getImaginaryPart(), sciDouble.getImaginaryPart());
+                       }
+               } else {
+                       return false;
+               }
+       }
 
 
        /**
+        * Display the representation in the Scilab language of the type
         * @return a Scilab-like String representation of the data.
         * @see java.lang.Object#toString()
         */
index a32b8fb..f5ece5e 100644 (file)
@@ -323,7 +323,10 @@ public class ScilabInteger implements ScilabType {
         * @see org.scilab.modules.types.ScilabType#getHeight()
         */
        @Override
-               public int getHeight() {
+       public int getHeight() {
+               if (this.getPrec() == null) {
+                       return 0;
+               }
                switch (this.getPrec()) {
                        case sci_int8:
                        case sci_uint8:
@@ -360,6 +363,9 @@ public class ScilabInteger implements ScilabType {
         */
        @Override
        public int getWidth() {
+               if (this.getPrec() == null) {
+                       return 0;
+               }
                switch (this.getPrec()) {
                        case sci_int8:
                        case sci_uint8:
@@ -397,6 +403,9 @@ public class ScilabInteger implements ScilabType {
         * @return true, if there is no values; false otherwise.
         */
        public boolean isEmpty() {
+               if (this.getPrec() == null) {
+                       return true;
+               }
                switch (this.getPrec()) {
                        case sci_int8:
                        case sci_uint8:
@@ -427,6 +436,7 @@ public class ScilabInteger implements ScilabType {
        }
 
        /**
+        * Display the representation in the Scilab language of the type
         * @return the pretty-printed values 
         * @see java.lang.Object#toString()
         */
index 9655582..1e3212f 100644 (file)
@@ -24,25 +24,25 @@ public class ScilabString implements ScilabType {
        /**
         * Default constructor
         */
-    public ScilabString() {
+       public ScilabString() {
                data = null;
-    }
-    
-    /**
-     * Constructor with data.
-     * 
-     * @param data the associated data.
-     */
-    public ScilabString(String[][] data) {
+       }
+       
+       /**
+        * Constructor with data.
+        * 
+        * @param data the associated data.
+        */
+       public ScilabString(String[][] data) {
                this.data = data;
-    }
-    
-    /**
-     * Constructor with vector data.
-     * 
-     * @param data the column vector data 
-     */
-    public ScilabString(String[] data) {
+       }
+       
+       /**
+        * Constructor with vector data.
+        * 
+        * @param data the column vector data 
+        */
+       public ScilabString(String[] data) {
                if (data == null || data.length == 0) {
                        this.data = new String[1][1];
                        this.data[0][0] = "";
@@ -52,42 +52,42 @@ public class ScilabString implements ScilabType {
                                this.data[0][i] = data[i];
                        }
                }
-    }
-    
-    /**
-     * Constructor with a unique value
-     * 
-     * @param string the value
-     */
-    public ScilabString(String string) {
+       }
+       
+       /**
+        * Constructor with a unique value
+        * 
+        * @param string the value
+        */
+       public ScilabString(String string) {
                if (string == null) {
                        throw new IllegalArgumentException("string == null");
                }
                this.data = new String[1][1];
                this.data[0][0] = string;
-    }
+       }
 
-    /**
-     * Set the values.
-     * 
-     * @param data the values
-     */
-    public void setData(String[][] data) {
+       /**
+        * Set the values.
+        * 
+        * @param data the values
+        */
+       public void setData(String[][] data) {
                this.data = data;
-    }
+       }
 
-    /**
-     * @return the associated values
-     */
-    public String[][] getData() {
+       /**
+        * @return the associated values
+        */
+       public String[][] getData() {
                return data;
-    }
-    
+       }
+       
        /**
         * @return the height of the data matrix
         * @see org.scilab.modules.types.ScilabType#getHeight()
         */
-    public int getHeight() {
+       public int getHeight() {
                if (data == null) {
                        return 0;
                }
@@ -104,27 +104,28 @@ public class ScilabString implements ScilabType {
                }
                return data[0].length;
        }
-    
+       
        /**
         * Check the emptiness of the associated data.
         * @return true, if the associated data array is empty. 
         */
-    public boolean isEmpty() {
-       return (data == null);
-    }
-    
-    /**
+       public boolean isEmpty() {
+               return (data == null);
+       }
+       
+       /**
         * @see org.scilab.modules.types.ScilabType#equals(Object)
-     */
-    public boolean equals(Object obj) {
-        if (obj instanceof ScilabString) {
-            return Arrays.deepEquals(this.getData(), ((ScilabString)obj).getData());
-        } else {
-            return false;
-        }
-    }
+        */
+       public boolean equals(Object obj) {
+               if (obj instanceof ScilabString) {
+                       return Arrays.deepEquals(this.getData(), ((ScilabString)obj).getData());
+               } else {
+                       return false;
+               }
+       }
 
        /**
+        * Display the representation in the Scilab language of the type
         * @return a Scilab-like String representation of the data.
         * @see java.lang.Object#toString()
         */
index 067753b..3dbb5ba 100644 (file)
@@ -19,17 +19,17 @@ import java.io.Serializable;
  */
 public interface ScilabType extends Serializable, Cloneable {
 
-    /**
-     * Return the width (number of elements) of the stored data
-     *
-     * @return the width
+       /**
+        * Return the width (number of elements) of the stored data
+        *
+        * @return the width
         */
        int getWidth();
        
-    /**
-     * Return the height (number of elements) of the stored data
-     *
-     * @return the height
+       /**
+        * Return the height (number of elements) of the stored data
+        *
+        * @return the height
         */
        int getHeight();
        
@@ -41,17 +41,17 @@ public interface ScilabType extends Serializable, Cloneable {
        boolean isEmpty();
        
 
-    /**
-     * Compare if obj is the same object or not
-     * @param obj the object we want to compare
-     * @return true if the two objects are equals, false otherwise
-     */
-    public boolean equals(Object obj);
+       /**
+        * Compare if obj is the same object or not
+        * @param obj the object we want to compare
+        * @return true if the two objects are equals, false otherwise
+        */
+       public boolean equals(Object obj);
 
-    /**
-     * Display the data
-     *
-     * @return the pretty print
+       /**
+        * Display the representation in the Scilab language of the type
+        *
+        * @return the pretty print
         */
        String toString();
 }
index 9017224..f5cf928 100644 (file)
@@ -22,6 +22,8 @@ import org.scilab.modules.types.ScilabIntegerTypeEnum;
 import org.scilab.modules.types.ScilabBoolean;
 import org.scilab.modules.types.ScilabString;
 import org.scilab.modules.types.ScilabList;
+import org.scilab.modules.types.ScilabTList;
+import org.scilab.modules.types.ScilabMList;
 
 public class testEquals {
 
@@ -41,6 +43,22 @@ public class testEquals {
                assert cMatrix.toString().equals("[42.0, 43.0 ; 21.0, 22.0]") == true;
        }
 
+       @Test
+       public void doubleMatrixTests() {
+               double [][]a={{21.2, 22.0, 42.0, 39.0},{23.2, 24.0, 44.0, 40.0}};
+               ScilabDouble emptyMatrix = new ScilabDouble();
+               assert emptyMatrix.getHeight() == 0;
+               assert emptyMatrix.getWidth() == 0;
+               assert emptyMatrix.isEmpty() == true;
+               assert emptyMatrix.toString().equals("[]") == true;
+               emptyMatrix.setRealPart(a);
+               emptyMatrix.setImaginaryPart(a);
+
+               ScilabBoolean aMatrix = new ScilabBoolean(true);
+               assert aMatrix.equals(emptyMatrix) == false;
+               assert emptyMatrix.equals(aMatrix) == false;
+       }
+
 
        @Test
        public void compareDoubleComplexTest() throws NullPointerException {
@@ -64,8 +82,9 @@ public class testEquals {
                double [] result = new double[]{21.2, 23.2, 22.0, 24.0, 42.0, 44.0, 39.0, 40.0, 210.2, 230.2, 220.0, 240.0, 420.0, 440.0, 390.0, 400.0};
                assert aMatrix.getSerializedComplexMatrix().length == result.length;
                assert Arrays.equals(aMatrix.getSerializedComplexMatrix(),result) == true;
-
-
+               ScilabDouble scalarComplex = new ScilabDouble(1,2);
+               assert aMatrix.equals(scalarComplex) == false;
+               assert aMatrix.equals(bMatrix) == true;
        }
 
 
@@ -103,6 +122,23 @@ public class testEquals {
 
 
        @Test
+       public void integer8MatrixTests() {
+               byte [][]a={{21, 22, 42, 39},{23, 24, 44, 40}};
+               ScilabInteger emptyMatrix = new ScilabInteger();
+               assert emptyMatrix.getHeight() == 0;
+               assert emptyMatrix.getWidth() == 0;
+               assert emptyMatrix.isEmpty() == true;
+               assert emptyMatrix.toString().equals("int([])") == true;
+               emptyMatrix.setData(a, true);
+
+               ScilabBoolean aMatrix = new ScilabBoolean(true);
+               assert aMatrix.equals(emptyMatrix) == false;
+               assert emptyMatrix.equals(aMatrix) == false;
+               ScilabInteger scalarInteger = new ScilabInteger((byte)2);
+       }
+
+
+       @Test
        public void compareInteger16Test() throws NullPointerException {
                short [][]a={{32,42,41}, {12,13,32}};
                short [][]b={{32,42,41}, {12,13,32}};
@@ -135,6 +171,18 @@ public class testEquals {
        }
 
        @Test
+       public void integer16MatrixTests() {
+               short [][]a={{21, 22, 42, 39},{23, 24, 44, 40}};
+               ScilabInteger emptyMatrix = new ScilabInteger();
+               emptyMatrix.setData(a, true);
+
+               ScilabBoolean aMatrix = new ScilabBoolean(true);
+               assert aMatrix.equals(emptyMatrix) == false;
+               assert emptyMatrix.equals(aMatrix) == false;
+               ScilabInteger scalarInteger = new ScilabInteger((short)2);
+       }
+
+       @Test
        public void compareInteger32Test() throws NullPointerException {
                int [][]a={{32,42,41}, {12,13,32}};
                int [][]b={{32,42,41}, {12,13,32}};
@@ -167,6 +215,18 @@ public class testEquals {
        }
 
        @Test
+       public void integer32MatrixTests() {
+               int [][]a={{21, 22, 42, 39},{23, 24, 44, 40}};
+               ScilabInteger emptyMatrix = new ScilabInteger();
+               emptyMatrix.setData(a, true);
+
+               ScilabBoolean aMatrix = new ScilabBoolean(true);
+               assert aMatrix.equals(emptyMatrix) == false;
+               assert emptyMatrix.equals(aMatrix) == false;
+               ScilabInteger scalarInteger = new ScilabInteger((int)2);
+       }
+
+       @Test
        public void compareInteger64Test() throws NullPointerException {
                long [][]a={{32,42,41}, {12,13,32}};
                long [][]b={{32,42,41}, {12,13,32}};
@@ -198,6 +258,18 @@ public class testEquals {
                assert ScilabInteger.convertOldType("TYPE64", false) == ScilabIntegerTypeEnum.sci_int64;
        }
 
+       @Test
+       public void integer64MatrixTests() {
+               long [][]a={{21, 22, 42, 39},{23, 24, 44, 40}};
+               ScilabInteger emptyMatrix = new ScilabInteger();
+               emptyMatrix.setData(a, true);
+
+               ScilabBoolean aMatrix = new ScilabBoolean(true);
+               assert aMatrix.equals(emptyMatrix) == false;
+               assert emptyMatrix.equals(aMatrix) == false;
+               ScilabInteger scalarInteger = new ScilabInteger((long)2);
+       }
+
 
        @Test
        public void compareBooleanTest() throws NullPointerException {
@@ -216,6 +288,20 @@ public class testEquals {
        }
 
        @Test
+       public void booleanMatrixTests() {
+               boolean [][]a={{true,false,true}, {true,true,true}};
+               ScilabBoolean emptyMatrix = new ScilabBoolean();
+               assert emptyMatrix.getHeight() == 0;
+               assert emptyMatrix.getWidth() == 0;
+               assert emptyMatrix.isEmpty() == true;
+               assert emptyMatrix.toString().equals("[]") == true;
+               emptyMatrix.setData(a);
+               ScilabDouble aMatrix = new ScilabDouble(2);
+               assert aMatrix.equals(emptyMatrix) == false;
+               assert emptyMatrix.equals(aMatrix) == false;
+       }
+
+       @Test
        public void compareStringTest() throws NullPointerException {
                String [][]a={{"This","is","my","string"},{"and","I want to", "compare"," them"}};
                String [][]b={{"This","is","my","string"},{"and","I want to", "compare"," them"}};
@@ -232,11 +318,38 @@ public class testEquals {
 
        }
 
+       @Test(expectedExceptions = IllegalArgumentException.class)
+       public void stringMatrixTests() {
+               String [][]a={{"This","is","my","string"},{"and","I want to", "compare"," them"}};
+               ScilabString emptyMatrix = new ScilabString();
+               assert emptyMatrix.getHeight() == 0;
+               assert emptyMatrix.getWidth() == 0;
+               assert emptyMatrix.isEmpty() == true;
+               assert emptyMatrix.toString().equals("[]") == true;
+               emptyMatrix.setData(a);
+               ScilabDouble aMatrix = new ScilabDouble(2);
+               assert aMatrix.equals(emptyMatrix) == false;
+               assert emptyMatrix.equals(aMatrix) == false;
+               String []b={"This","is","my","string"};
+               ScilabString vectorString = new ScilabString(b);
+               String []c = null;
+               ScilabString emptyString = new ScilabString(c);
+               ScilabString nullString = new ScilabString((String)null);
+
+       }
+
        @Test
        public void compareListTest() throws NullPointerException {
                ScilabList data = new ScilabList();
+               assert data.getHeight() == 0;
+               assert data.getWidth() == 0;
+               assert data.toString().equals("list()");
                data.add(new ScilabDouble(2));
+               assert data.getHeight() == 1;
+               assert data.getWidth() == 1;
                data.add(new ScilabDouble(51));
+               assert data.getHeight() == 1;
+               assert data.getWidth() == 2;
                data.add(new ScilabString("hello"));
                ScilabList data2 = new ScilabList();
                data2.add(new ScilabDouble(2));
@@ -249,8 +362,98 @@ public class testEquals {
                data3.add(new ScilabString("hello"));
                assert data.equals(data2) == true;
                assert data.equals(data3) == false;
-               assert data.toString().equals("list([2.0],\n[51.0],\n[\"hello\"])") == true;
-               assert data3.toString().equals("list([2.0],\n[42.0],\n[%t],\n[\"hello\"])") == true;
+               assert data.toString().equals("list([2.0], [51.0], [\"hello\"])") == true;
+               assert data3.toString().equals("list([2.0], [42.0], [%t], [\"hello\"])") == true;
+
+               ScilabList data4 = new ScilabList(data3);
+               assert data4.equals(data3) == true;
+
+       }
+
+
+       @Test
+       public void compareTListTest() throws NullPointerException {
+               ScilabTList data = new ScilabTList();
+               assert data.getHeight() == 0;
+               assert data.getWidth() == 0;
+               assert data.toString().equals("tlist()");
+               data.add(new ScilabString("hello"));
+               assert data.getHeight() == 1;
+               assert data.getWidth() == 1;
+               data.add(new ScilabDouble(2));
+               assert data.getHeight() == 1;
+               assert data.getWidth() == 2;
+               data.add(new ScilabDouble(51));
+               assert data.getHeight() == 1;
+               assert data.getWidth() == 3;
+               ScilabTList data2 = new ScilabTList();
+               data2.add(new ScilabString("hello"));
+               data2.add(new ScilabDouble(2));
+               data2.add(new ScilabDouble(51));
+               ScilabTList data3 = new ScilabTList();
+               data3.add(new ScilabString("hello"));
+               data3.add(new ScilabDouble(2));
+               data3.add(new ScilabDouble(42));
+               data3.add(new ScilabBoolean(true));
+               assert data.equals(data2) == true;
+               assert data.equals(data3) == false;
+
+               assert data.toString().equals("tlist([\"hello\"], [2.0], [51.0])") == true;
+               assert data3.toString().equals("tlist([\"hello\"], [2.0], [42.0], [%t])") == true;
+               String []b={"a","b","c"};
+
+               ScilabTList tlist = new ScilabTList(b);
+               tlist.add(new ScilabDouble(2));
+               tlist.add(new ScilabDouble(3));
+               assert tlist.toString().equals("tlist([\"a\", \"b\", \"c\"], [2.0], [3.0])") == true;
+               ScilabTList tlistFromAnOther = new ScilabTList(b, data2);
+               assert tlistFromAnOther.getHeight() == 1;
+               assert tlistFromAnOther.getWidth() == 4;
+               assert tlistFromAnOther.toString().equals("tlist([\"a\", \"b\", \"c\"], [\"hello\"], [2.0], [51.0])");
+       }
+
+
+       @Test
+       public void compareMListTest() throws NullPointerException {
+               ScilabMList data = new ScilabMList();
+               assert data.getHeight() == 0;
+               assert data.getWidth() == 0;
+               assert data.toString().equals("mlist()");
+               data.add(new ScilabString("hello"));
+               assert data.getHeight() == 1;
+               assert data.getWidth() == 1;
+               data.add(new ScilabDouble(2));
+               assert data.getHeight() == 1;
+               assert data.getWidth() == 2;
+               data.add(new ScilabDouble(51));
+               assert data.getHeight() == 1;
+               assert data.getWidth() == 3;
+               ScilabMList data2 = new ScilabMList();
+               data2.add(new ScilabString("hello"));
+               data2.add(new ScilabDouble(2));
+               data2.add(new ScilabDouble(51));
+               ScilabMList data3 = new ScilabMList();
+               data3.add(new ScilabString("hello"));
+               data3.add(new ScilabDouble(2));
+               data3.add(new ScilabDouble(42));
+               data3.add(new ScilabBoolean(true));
+               assert data.equals(data2) == true;
+               assert data.equals(data3) == false;
+               System.out.println("mlist " + data);
+               assert data.toString().equals("mlist([\"hello\"], [2.0], [51.0])") == true;
+               assert data3.toString().equals("mlist([\"hello\"], [2.0], [42.0], [%t])") == true;
+               String []b={"a","b","c"};
+
+               ScilabMList mlist = new ScilabMList(b);
+               mlist.add(new ScilabDouble(2));
+               mlist.add(new ScilabDouble(3));
+               assert mlist.toString().equals("mlist([\"a\", \"b\", \"c\"], [2.0], [3.0])") == true;
+               ScilabMList mlistFromAnOther = new ScilabMList(b, data2);
+               assert mlistFromAnOther.getHeight() == 1;
+               assert mlistFromAnOther.getWidth() == 4;
+               assert mlistFromAnOther.toString().equals("mlist([\"a\", \"b\", \"c\"], [\"hello\"], [2.0], [51.0])");
 
        }
+
+
 }