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_EXPANDED
-
- creation {ANY}
- make
-
- feature {ANY}
-
- a: ARRAY[INTEGER];
- c1,c2,c3,cv: INTEGER;
- i: INTEGER;
-
- make is
- do
- c1 := 31;
- c2 := 32;
- c3 := 33;
-
- !!a.make(1,0);
- is_true(a.lower = 1);
- is_true(a.upper = 0);
- is_true(a.count = 0);
- is_true(a.empty);
-
- a.make(1,1);
- is_true(a.count = 1);
- is_true(a.lower = 1);
- is_true(a.upper = 1);
- is_true(a.item(1) = 0);
-
- !!a.make(1,4);
- is_true(a.count = 4);
- from
- i := 1;
- until
- i > a.count
- loop
- is_true(a.item(i) = 0);
- i := i + 1;
- end;
-
- !!a.make(-1,-2);
- is_true(a.count = 0);
- a.add_last(c1);
- is_true(a.count = 1);
- is_true(a.item(-1) = c1);
-
- a := <<c1>>;
- is_true(a.count = 1);
- is_true(a.item(1) = c1);
- a.add_last(c2);
- is_true(a.count = 2);
- is_true(a.item(1) = c1);
- is_true(a.item(2) = c2);
-
- !!a.make(1,3);
- a.put(c2,2);
- is_true(equal(a,<<0,c2,0>>));
- a.put(67,2);
- is_true(equal(a,<<0,67,0>>));
- a.make(1,3);
- is_true(equal(a,<<0,0,0>>));
-
- !!a.make(2,2);
- a.force(c1,1);
- is_true(equal(a,<<c1,0>>));
- a.force(c3,3);
- is_true(equal(a,<<c1,0,c3>>));
-
- a := <<1,2,3,4>>;
- is_true(a.index_of(1) = 1);
- is_true(equal(a.index_of(1),1));
- is_true(equal(1,a.index_of(1)));
- is_true(a.index_of(3) = 3);
- is_true(equal(3,a.index_of(3)));
- end;
-
- is_true(b: BOOLEAN) is
- do
- cpt := cpt + 1;
- if not b then
- std_output.put_string("TEST_ARRAY_EXPANDED: ERROR Test # ");
- std_output.put_integer(cpt);
- std_output.put_string("%N");
- else
- -- std_output.put_string("yes%N");
- end;
- end;
-
- cpt: INTEGER;
-
- end -- XX43
-