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_ARRAY
-
- creation {ANY}
- make
-
- feature {ANY}
-
- t_boolean: ARRAY[BOOLEAN];
- t_integer: ARRAY[INTEGER];
- t_animal: ARRAY[ANIMAL];
- t_real: ARRAY[REAL];
- t_any: ARRAY[ANY];
-
- make is
- local
- i: INTEGER;
- cat: CAT;
- dog: DOG;
- do
- t_boolean := <<true, false>>;
- is_true(1 = t_boolean.index_of(true));
- is_true(1 = t_boolean.fast_index_of(true));
- is_true(2 = t_boolean.index_of(false));
- is_true(2 = t_boolean.fast_index_of(false));
-
- is_true(equal(<<1,2,3>>,<<1,2,3>>));
-
- is_true(equal(<<'a','b','c'>>,<<'a','b','c'>>));
-
- -- ??? is_true(equal(<<1.5,2.5,3.>>,<<1.5,2.5,3.>>));
-
- t_integer := <<1,2>>;
- t_real := <<1.,2.>>;
- -- ???? is_true(equal(t_real,t_integer));
-
- !!cat;
- t_any := <<cat,cat>>;
- t_animal := <<cat,cat>>;
-
- is_true(equal(t_any,t_animal));
- t_any.put(Void,1);
- t_animal.put(Void,1);
- is_true(equal(t_any,t_animal));
- t_animal.put(cat,1);
- is_true(not equal(t_any,t_animal));
-
- !!dog;
- t_any.put(dog,1);
- t_animal.put(dog,1);
- is_true(equal(t_any,t_animal));
-
-
- -- !!cat;
- -- !!dog;
- -- t_any := <<cat,dog>>;
- -- t_animal := <<cat,dog>>;
- -- is_true(equal(t_any,t_animal));
-
-
- end;
-
- is_true(b: BOOLEAN) is
- do
- cpt := cpt + 1;
- if not b then
- std_output.put_string("TEST_ARRAY: ERROR Test # ");
- std_output.put_integer(cpt);
- std_output.put_string("%N");
- else
- --std_output.put_string("Yes%N");
- end;
- end;
-
- cpt: INTEGER;
-
- end -- TEST_ARRAY
-