140
|
1 // $HeadURL$
|
|
2 // $Date$
|
|
3 // $Author$
|
|
4
|
49
|
5 // @author@ Russ Lewis <spamhole-2001-07-16@deming-os.org>
|
|
6 // @date@ 2004-10-11
|
140
|
7 // @uri@ news:ckdc4r$re2$1@digitaldaemon.com
|
1487
|
8 // @uri@ http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.bugs&artnum=2068
|
67
|
9
|
|
10 module dstress.run.sort_05;
|
49
|
11
|
|
12 int main(){
|
297
|
13 double[] array;
|
|
14 array.length=10;
|
49
|
15 array[0]=double.max;
|
|
16 array[1]=0.875;
|
|
17 array[2]=0.75;
|
|
18 array[3]=0.625;
|
|
19 array[4]=0.5;
|
|
20 array[5]=0.375;
|
|
21 array[6]=0.25;
|
|
22 array[7]=0.125;
|
|
23 array[8]=0.0;
|
|
24 array[9]=double.min;
|
|
25
|
297
|
26 double[] sorted_copy = array.sort;
|
49
|
27
|
|
28 assert(sorted_copy.length==10);
|
297
|
29 assert(sorted_copy[0]==0.0);
|
|
30 assert(sorted_copy[1]==double.min);
|
|
31 assert(sorted_copy[2]==0.125);
|
|
32 assert(sorted_copy[3]==0.25);
|
|
33 assert(sorted_copy[4]==0.375);
|
|
34 assert(sorted_copy[5]==0.5);
|
|
35 assert(sorted_copy[6]==0.625);
|
|
36 assert(sorted_copy[7]==0.75);
|
|
37 assert(sorted_copy[8]==0.875);
|
|
38 assert(sorted_copy[9]==double.max);
|
49
|
39
|
297
|
40 assert(array.length==10);
|
|
41 assert(array[0]==0.0);
|
|
42 assert(array[1]==double.min);
|
|
43 assert(array[2]==0.125);
|
|
44 assert(array[3]==0.25);
|
|
45 assert(array[4]==0.375);
|
|
46 assert(array[5]==0.5);
|
|
47 assert(array[6]==0.625);
|
|
48 assert(array[7]==0.75);
|
|
49 assert(array[8]==0.875);
|
|
50 assert(array[9]==double.max);
|
|
51
|
|
52 assert(&array != &sorted_copy);
|
|
53
|
49
|
54 return 0;
|
|
55 }
|