root/trunk/ProjectFortress/tests/BadBounds.fss

Revision 3034, 2.1 kB (checked in by sukyoungryu, 4 weeks ago)

[parser] Simplified grammar for dimensions and units.
[copyright] Fixed copyright notices.

Line 
1 (*******************************************************************************
2     Copyright 2008 Sun Microsystems, Inc.,
3     4150 Network Circle, Santa Clara, California 95054, U.S.A.
4     All rights reserved.
5
6     U.S. Government Rights - Commercial software.
7     Government users are subject to the Sun Microsystems, Inc. standard
8     license agreement and applicable provisions of the FAR and its supplements.
9
10     Use is subject to license terms.
11
12     This distribution may include materials developed by third parties.
13
14     Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered
15     trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
16  ******************************************************************************)
17
18 component BadBounds
19 export Executable
20 run(args:String...) :() = do
21   b:ZZ32[3,2] = [1 2
22                  3 4
23                  5 6]
24   println ("b lower bounds " b.bounds().lower() )
25   println ("b upper bounds " b.bounds().upper() )
26   println ("b.bounds = " b.bounds())
27
28   bShifted = b.bounds ≫ (2,5)
29   assert(b.bounds.extent, bShifted.extent)
30   println b.bounds.ilkName
31   assert(bShifted.lower, (2, 5))
32
33   assert(bShifted ≪ (2,5), b.bounds)
34
35   for (i,j) <- b.indices() do
36       println("b[" i "," j "] = " b[i,j])
37   end
38
39   for (i,j) <- sequential(b.indices()) do
40       println("b[" i "," j "] = " b[i,j])
41   end
42
43   c :ZZ32[3,4,2] = [ 1  2  3  4
44                      5  6  7  8
45                      9 10 11 12;; 13 14 15 16
46                                   17 18 19 20
47                                   21 22 23 24 ]
48
49   cShifted = c.bounds ≫ (2,5,8)
50   assert(c.bounds.extent, cShifted.extent)
51   println c.bounds.ilkName
52   assert(cShifted.lower, (2, 5, 8))
53
54   assert(cShifted ≪ (2, 5, 8), c.bounds)
55
56   for (i,j,k) <- c.indices() do
57             println ("c[" i "," j "," k "] = " c[i,j,k] )
58   end
59   for (i,j,k) <- sequential(c.indices()) do
60             println ("c[" i "," j "," k "] = " c[i,j,k] )
61   end
62   println ("c lower bounds " c.bounds().lower() )
63   println ("c upper bounds " c.bounds().upper() )
64   println ("c.bounds = " c.bounds())
65
66 end
67
68 end
Note: See TracBrowser for help on using the browser.