home *** CD-ROM | disk | FTP | other *** search
- -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C)
- -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
- --
- class TEST_GENERAL1
-
- creation {ANY}
- make
-
- feature {ANY}
-
- any: ANY;
-
- ai: ARRAY[INTEGER];
-
- ar: ARRAY[REAL];
-
- d: DICTIONARY[STRING,STRING];
-
- cat: CAT;
-
- dog: DOG;
-
- make is
- local
- i: INTEGER;
- do
- -- Testing `generating_type' ----------------------------- :
- is_true(generating_type.is_equal("TEST_GENERAL1"));
-
- !!ai.make(1,2);
- is_true(("ARRAY[INTEGER]").is_equal(ai.generating_type));
-
- !!ar.make(1,2);
- is_true(("ARRAY[REAL]").is_equal(ar.generating_type));
-
- !!d.make;
- is_true(d.generating_type.is_equal("DICTIONARY[STRING,STRING]"));
-
- is_true(i.generating_type.is_equal("INTEGER"));
-
- is_true(i.to_real.generating_type.is_equal("REAL"));
-
- is_true(i.to_double.generating_type.is_equal("DOUBLE"));
-
- is_true(i.digit.generating_type.is_equal("CHARACTER"));
-
- is_true(i.to_string.generating_type.is_equal("STRING"));
-
- is_true(i.to_string.to_integer.generating_type.is_equal("INTEGER"));
-
- any := i.to_string;
- is_true(any.generating_type.is_equal("STRING"));
-
- any := i;
- is_true(any.generating_type.is_equal("INTEGER_REF"));
-
-
- -- Testing `generator' ----------------------------------- :
- is_true(generator.is_equal("TEST_GENERAL1"));
- is_true(("ARRAY").is_equal(ai.generator));
- is_true(("ARRAY").is_equal(ar.generator));
- is_true(d.generator.is_equal("DICTIONARY"));
- is_true(i.generator.is_equal("INTEGER"));
- is_true(i.to_real.generator.is_equal("REAL"));
- is_true(i.to_double.generator.is_equal("DOUBLE"));
- is_true(i.digit.generator.is_equal("CHARACTER"));
- is_true(i.to_string.generator.is_equal("STRING"));
- any := i.to_string;
- is_true(any.generator.is_equal("STRING"));
- any := i;
- is_true(any.generator.is_equal("INTEGER_REF"));
-
- -- Testing `object_id' and `id_object'-------------------- :
- is_true(Current = id_object(object_id));
- is_true(("ARRAY").object_id /= ("ARRAY").object_id);
- i := ar.object_id;
- is_true(id_object(i) = ar);
-
- -- Testing `object_size' --------------------------------- :
- !!cat;
- !!dog;
- is_true((1).object_size = (true).object_size);
- is_true(('a').object_size = 1);
- is_true(dog.object_size = cat.object_size);
- is_true(dog.object_size >= i.object_size);
- is_true(object_size > i.object_size);
- any := dog;
- is_true(dog.object_size = any.object_size);
-
- -- Testing `same_type' ----------------------------------- :
- is_true(same_type(Current));
- is_true(ai.same_type(<<1,2>>));
- is_true(ar.same_type(<<0.5>>));
- is_true(not ar.same_type(ai));
- is_true(d.same_type(clone(d)));
- -- *** is_true(i.same_type(3+1));
- -- *** is_true(i.to_real.same_type(3.5));
- -- *** is_true(i.to_double.same_type((4).to_double));
- i := 7;
- -- *** is_true(i.digit.same_type('a'));
- is_true(i.to_string.same_type("foo"));
- any := i;
- is_true(any.same_type(i));
- any := ar;
- is_true(any.same_type(ar));
-
- end;
-
- is_true(b: BOOLEAN) is
- do
- cpt := cpt + 1;
- if not b then
- std_output.put_string("TEST_GENERAL1: ERROR Test # ");
- std_output.put_integer(cpt);
- std_output.put_string("%N");
- else
- -- std_output.put_string("Yes%N");
- end;
- end;
-
- cpt: INTEGER;
-
- end -- class TEST_GENERAL1
-