Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit037c440

Browse files
committed
Expanding tests further
1 parent4200e8b commit037c440

File tree

2 files changed

+116
-60
lines changed

2 files changed

+116
-60
lines changed

‎tests/fsharp/typecheck/full-rank-arrays/Class1.cs‎

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -19,47 +19,47 @@ public ClassWithArrayCtor(T[,] array)
1919
m_array=array;
2020
}
2121

22-
publicClassWithArrayCtor(T[,,]array)
22+
publicClassWithArrayCtor(T[,,]array)
2323
{
2424
m_array=array;
2525
}
2626

27-
publicClassWithArrayCtor(T[,,,]array)
27+
publicClassWithArrayCtor(T[,,,]array)
2828
{
2929
m_array=array;
3030
}
3131

32-
publicClassWithArrayCtor(T[,,,,]array)
32+
publicClassWithArrayCtor(T[,,,,]array)
3333
{
3434
m_array=array;
3535
}
3636

37-
publicClassWithArrayCtor(T[,,,,,]array)
37+
publicClassWithArrayCtor(T[,,,,,]array)
3838
{
3939
m_array=array;
4040
}
4141

42-
publicClassWithArrayCtor(T[,,,,,,]array)
42+
publicClassWithArrayCtor(T[,,,,,,]array)
4343
{
4444
m_array=array;
4545
}
4646

47-
publicClassWithArrayCtor(T[,,,,,,,]array)
47+
publicClassWithArrayCtor(T[,,,,,,,]array)
4848
{
4949
m_array=array;
5050
}
5151

52-
publicClassWithArrayCtor(T[,,,,,,,,]array)
52+
publicClassWithArrayCtor(T[,,,,,,,,]array)
5353
{
5454
m_array=array;
5555
}
5656

57-
publicClassWithArrayCtor(T[,,,,,,,,,]array)
57+
publicClassWithArrayCtor(T[,,,,,,,,,]array)
5858
{
5959
m_array=array;
6060
}
6161

62-
publicClassWithArrayCtor(T[,,,,,,,,,,]array)
62+
publicClassWithArrayCtor(T[,,,,,,,,,,]array)
6363
{
6464
m_array=array;
6565
}
@@ -69,138 +69,138 @@ public static class StaticClassWithGenericMethod
6969
{
7070
publicstaticvoidExample<T>(T[]array)
7171
{
72-
thrownewNotImplementedException();
72+
Console.WriteLine(array);
7373
}
7474

7575
publicstaticvoidExample<T>(T[,]array)
7676
{
77-
thrownewNotImplementedException();
77+
Console.WriteLine(array);
7878
}
7979

80-
publicstaticvoidExample<T>(T[,,]array)
80+
publicstaticvoidExample<T>(T[,,]array)
8181
{
82-
thrownewNotImplementedException();
82+
Console.WriteLine(array);
8383
}
8484

85-
publicstaticvoidExample<T>(T[,,,]array)
85+
publicstaticvoidExample<T>(T[,,,]array)
8686
{
87-
thrownewNotImplementedException();
87+
Console.WriteLine(array);
8888
}
8989

90-
publicstaticvoidExample<T>(T[,,,,]array)
90+
publicstaticvoidExample<T>(T[,,,,]array)
9191
{
92-
thrownewNotImplementedException();
92+
Console.WriteLine(array);
9393
}
9494

95-
publicstaticvoidExample<T>(T[,,,,,]array)
95+
publicstaticvoidExample<T>(T[,,,,,]array)
9696
{
97-
thrownewNotImplementedException();
97+
Console.WriteLine(array);
9898
}
9999

100-
publicstaticvoidExample<T>(T[,,,,,,]array)
100+
publicstaticvoidExample<T>(T[,,,,,,]array)
101101
{
102-
thrownewNotImplementedException();
102+
Console.WriteLine(array);
103103
}
104104

105-
publicstaticvoidExample<T>(T[,,,,,,,]array)
105+
publicstaticvoidExample<T>(T[,,,,,,,]array)
106106
{
107-
thrownewNotImplementedException();
107+
Console.WriteLine(array);
108108
}
109109

110-
publicstaticvoidExample<T>(T[,,,,,,,,]array)
110+
publicstaticvoidExample<T>(T[,,,,,,,,]array)
111111
{
112-
thrownewNotImplementedException();
112+
Console.WriteLine(array);
113113
}
114114

115-
publicstaticvoidExample<T>(T[,,,,,,,,,]array)
115+
publicstaticvoidExample<T>(T[,,,,,,,,,]array)
116116
{
117-
thrownewNotImplementedException();
117+
Console.WriteLine(array);
118118
}
119119

120-
publicstaticvoidExample<T>(T[,,,,,,,,,,]array)
120+
publicstaticvoidExample<T>(T[,,,,,,,,,,]array)
121121
{
122-
thrownewNotImplementedException();
122+
Console.WriteLine(array);
123123
}
124124
}
125125

126126
publicstaticclassGenericStaticClassWithMethod<T>
127127
{
128128
publicstaticvoidExample(T[]array)
129129
{
130-
thrownewNotImplementedException();
130+
Console.WriteLine(array);
131131
}
132132

133133
publicstaticvoidExample(T[,]array)
134134
{
135-
thrownewNotImplementedException();
135+
Console.WriteLine(array);
136136
}
137137

138138
publicstaticvoidExample(T[,,]array)
139139
{
140-
thrownewNotImplementedException();
140+
Console.WriteLine(array);
141141
}
142142

143143
publicstaticvoidExample(T[,,,]array)
144144
{
145-
thrownewNotImplementedException();
145+
Console.WriteLine(array);
146146
}
147147

148148
publicstaticvoidExample(T[,,,,]array)
149149
{
150-
thrownewNotImplementedException();
150+
Console.WriteLine(array);
151151
}
152152

153153
publicstaticvoidExample(T[,,,,,]array)
154154
{
155-
thrownewNotImplementedException();
155+
Console.WriteLine(array);
156156
}
157157

158158
publicstaticvoidExample(T[,,,,,,]array)
159159
{
160-
thrownewNotImplementedException();
160+
Console.WriteLine(array);
161161
}
162162

163163
publicstaticvoidExample(T[,,,,,,,]array)
164164
{
165-
thrownewNotImplementedException();
165+
Console.WriteLine(array);
166166
}
167167

168168
publicstaticvoidExample(T[,,,,,,,,]array)
169169
{
170-
thrownewNotImplementedException();
170+
Console.WriteLine(array);
171171
}
172172

173173
publicstaticvoidExample(T[,,,,,,,,,]array)
174174
{
175-
thrownewNotImplementedException();
175+
Console.WriteLine(array);
176176
}
177177

178178
publicstaticvoidExample(T[,,,,,,,,,,]array)
179179
{
180-
thrownewNotImplementedException();
180+
Console.WriteLine(array);
181181
}
182182
}
183-
184-
publicstaticclassMethodsReturningHighDArrays
185-
{
183+
184+
publicstaticclassMethodsReturningHighDArrays
185+
{
186186
publicstaticT1[,]Example1<T1>()
187187
{
188-
thrownewNotImplementedException();
188+
returnnewT1[1,1];
189189
}
190-
191-
publicstaticT1[,,,,,]Example1<T1>(intx)
190+
191+
publicstaticT1[,,,,,]Example1<T1>(intx)
192192
{
193-
thrownewNotImplementedException();
193+
returnnewT1[1,1,1,1,1,1];
194194
}
195195

196196
publicstaticT1[,]Example2<T1>()
197197
{
198-
thrownewNotImplementedException();
198+
returnnewT1[1,1];
199199
}
200200

201-
publicstaticT1[,,,,,,]Example2<T1,T2>()
201+
publicstaticT1[,,,,,,]Example2<T1,T2>()
202202
{
203-
thrownewNotImplementedException();
203+
returnnewT1[1,1,1,1,1,1,1];
204204
}
205205
}
206206
}

‎tests/fsharp/typecheck/full-rank-arrays/test.fsx‎

Lines changed: 66 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33

44
#r"HighRankArrayTests.dll"
55
openHighRankArrayTests
6+
openSystem
7+
8+
type't``[,,,,,,,,,]``with
9+
memberthis.GetFirst()=
10+
// not supported
11+
// this.[0,0,0,0,0,0,0,0,0,0]
12+
this.GetValue(0,0,0,0,0,0,0,0,0,0)
13+
memberthis.SetFirst(x)=
14+
// not supported
15+
// this.[0,0,0,0,0,0,0,0,0,0] <- x
16+
this.SetValue(x,0,0,0,0,0,0,0,0,0,0)
617

718
(* In the F# 3.1.2 release and earlier versions, the compiler's overload resolution
819
breaks on the following class definition. The referenced assembly defines
@@ -12,44 +23,89 @@ open HighRankArrayTests
1223
F#, but it should still be possible to call one of the overloads which does
1324
not include such a parameter.*)
1425
typeClass1()=
15-
memberthis.X1=
26+
memberthis.X1()=
1627
GenericStaticClassWithMethod<int>.Example[|2;3;4;5|]
28+
letx= Array.CreateInstance(typeof<int>,2,2,2,2,2,2,2):?>``[,,,,,,]``<int>
29+
GenericStaticClassWithMethod<int>.Example(x)
1730

18-
memberthis.X2=
31+
memberthis.X2()=
1932
StaticClassWithGenericMethod.Example[|1;2;3;4|]
33+
letx= Array.CreateInstance(typeof<int>,2,2,2,2,2,2,2):?>``[,,,,,,]``<int>
34+
// not supported
35+
// x.[0,1,0,1,0,1,0] <- 42
36+
// x.[1,0,1,0,1,0,1] |> printfn "%d"
37+
x.SetValue(42,0,1,0,1,0,1,0)
38+
downcast(x.GetValue(1,0,1,0,1,0,1))|> printfn"%d"
39+
StaticClassWithGenericMethod.Example(x)
2040

21-
memberthis.X3=
22-
letfoo= ClassWithArrayCtor([|1;3;5;7|])
41+
memberthis.X3()=
42+
ClassWithArrayCtor([|1;3;5;7|])|> printfn"%A"
43+
letx= Array.CreateInstance(typeof<int>,2,2,2,2,2,2):?>``[,,,,,]``<int>
44+
// not supported
45+
// x.[0,1,0,1,0,1] <- 42
46+
// x.[1,0,1,0,1,0] |> printfn "%d"
47+
x.SetValue(42,0,1,0,1,0,1)
48+
downcast(x.GetValue(1,0,1,0,1,0))|> printfn"%d"
49+
ClassWithArrayCtor(x)|> printfn"%A"
2350
()
2451

25-
memberthis.X4=
52+
memberthis.X4()=
2653
lety1= MethodsReturningHighDArrays.Example1<int>()
2754
lety2= MethodsReturningHighDArrays.Example1<int>(2)
2855

2956
StaticClassWithGenericMethod.Example(y1)
3057
StaticClassWithGenericMethod.Example(y2)
31-
ClassWithArrayCtor(y1)|> ignore
32-
ClassWithArrayCtor(y2)|> ignore
58+
letx= Array.CreateInstance(typeof<int>,2,2,2,2,2,2,2,2):?>``[,,,,,,,]``<int>
59+
// not supported
60+
// x.[0,1,0,1,0,1,0,1] <- 42
61+
// x.[1,0,1,0,1,0,1,0] |> printfn "%d"
62+
x.SetValue(42,0,1,0,1,0,1,0,1)
63+
downcast(x.GetValue(1,0,1,0,1,0,1,0))|> printfn"%d"
64+
StaticClassWithGenericMethod.Example(x)
65+
66+
ClassWithArrayCtor(y1)|> printfn"%A"
67+
ClassWithArrayCtor(y2)|> printfn"%A"
3368

3469
()
3570

36-
memberthis.X5=
71+
memberthis.X5()=
3772
lety1= MethodsReturningHighDArrays.Example2<_>()
3873
lety2= MethodsReturningHighDArrays.Example2<_,_>()
3974

4075
StaticClassWithGenericMethod.Example(y1)
4176
StaticClassWithGenericMethod.Example(y2)
42-
ClassWithArrayCtor(y1)|>ignore
43-
ClassWithArrayCtor(y2)|>ignore
77+
ClassWithArrayCtor(y1)|>printfn"%A"
78+
ClassWithArrayCtor(y2)|>printfn"%A"
4479

4580
()
4681

82+
memberthis.X6()=
83+
letgetFirst(x:``[,,,,,,,,,]``<'t>):'t=
84+
downcast(x.GetFirst())
85+
letsetFirst y(x:``[,,,,,,,,,]``<'t>)=
86+
x.SetFirst(y)
87+
88+
letx= Array.CreateInstance(typeof<string>,2,2,2,2,2,2,2,2,2,2):?>``[,,,,,,,,,]``<string>
89+
x|> setFirst"foo"
90+
x|> getFirst|> printfn"%s"
91+
92+
93+
memberthis.RunTests()=
94+
this.X1()
95+
this.X2()
96+
this.X3()
97+
this.X4()
98+
this.X5()
99+
this.X6()
100+
47101
(* avoid ;; -- to avoid fsi error recovery*)
48102

49103
let_=
50104
(* May not be enough if fsi does error recovery...
51105
* So avoid using ;;
52106
*)
107+
letx= Class1()
108+
x.RunTests()
53109
System.Console.WriteLine"Test Passed";
54110
System.IO.File.WriteAllText("test.ok","ok");
55111
exit0

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp