提交 e789aca4 编写于 作者: K Kevin Ransom 提交者: Kevin Ransom (msft)

FX_NO_BASED_ARRAYS --- dead code removal

上级 75e37cdf
......@@ -30,14 +30,12 @@ type Array2Module() =
if i = 0 then System.Math.Sin(arg) else System.Math.Cos(arg))
let resultInt = Array2D.base1 intArr
if resultInt <> 0 then Assert.Fail()
#if FX_NO_BASED_ARRAYS
#else
// string array
let strArr = Array2D.createBased 0 0 2 3 "goodboy"
let resultStr = Array2D.base1 strArr
if resultStr <> 0 then Assert.Fail()
#endif
// empty array
let eptArr = Array2D.create 0 0 1
let resultEpt = Array2D.base1 eptArr
......@@ -60,13 +58,11 @@ type Array2Module() =
let resultInt = Array2D.base2 intArr
if resultInt <> 0 then Assert.Fail()
#if !FX_NO_BASED_ARRAYS
// string array
let strArr = Array2D.createBased 0 0 2 3 "goodboy"
let resultStr = Array2D.base2 strArr
if resultStr <> 0 then Assert.Fail()
#endif
// empty array
let eptArr = Array2D.create 0 0 1
let resultEpt = Array2D.base2 eptArr
......@@ -76,13 +72,11 @@ type Array2Module() =
let nullArr = null:string[,]
CheckThrowsNullRefException (fun () -> Array2D.base2 nullArr |> ignore)
#if !FX_NO_BASED_ARRAYS
// Verify printing format of non-zero based arrays
let v : int[,] = Array2D.createBased 10 1 3 4 2
let actual = (sprintf "%A" v).Replace("\r","").Replace("\n","")
let expected = "[bound1=10 bound2=1 [2; 2; 2; 2] [2; 2; 2; 2] [2; 2; 2; 2]]"
Assert.AreEqual(expected, actual)
#endif
()
[<Test>]
......@@ -131,7 +125,6 @@ type Array2Module() =
CheckThrowsArgumentException(fun () -> Array2D.blit intArr 0 0 intArr2 0 10 2 2 |> ignore)
()
#if !FX_NO_BASED_ARRAYS
[<Test>]
member this.BlitWithNonZeroBase() =
let a = Array2D.createBased 1 1 3 3 0
......@@ -184,7 +177,6 @@ type Array2Module() =
CheckThrowsArgumentException(fun () -> Array2D.blit a 1 1 b 1 1 4 4 |> ignore)
()
#endif
[<Test>]
member this.Copy() =
......@@ -230,7 +222,6 @@ type Array2Module() =
()
#if !FX_NO_BASED_ARRAYS
[<Test>]
member this.createBased() =
// integer array
......@@ -249,7 +240,6 @@ type Array2Module() =
let resultEpt = Array2D.createBased 0 0 0 0 1
if resultEpt <> eptArr then Assert.Fail()
()
#endif
[<Test>]
member this.Get() =
......@@ -285,26 +275,21 @@ type Array2Module() =
let intArr = Array2D.init 2 3 (fun i j -> i*100 + j)
if intArr.[1,1] <> 101 then Assert.Fail()
// string array
let strArr = Array2D.init 2 3 (fun i j -> i.ToString() + "-" + j.ToString())
if strArr.[1,1] <> "1-1" then Assert.Fail()
()
#if !FX_NO_BASED_ARRAYS
[<Test>]
member this.Init_Based() =
// integer array
let intArr = Array2D.initBased 1 1 2 3 (fun i j -> i*100 + j)
if intArr.[2,2] <> 202 then Assert.Fail()
// string array
let strArr = Array2D.initBased 1 1 2 3 (fun i j -> i.ToString() + "-" + j.ToString())
if strArr.[2,2] <> "2-2" then Assert.Fail()
()
#endif
[<Test>]
member this.Iter() =
......@@ -331,7 +316,6 @@ type Array2Module() =
CheckThrowsArgumentNullException (fun () -> Array2D.iter funStr nullArr |> ignore)
()
#if !FX_NO_BASED_ARRAYS
[<Test>]
member this.IterNonZeroBased() =
let a = Array2D.createBased 1 5 10 10 1
......@@ -343,8 +327,6 @@ type Array2Module() =
if !result <> 1600 then Assert.Fail()
()
#endif
[<Test>]
member this.Iteri() =
// integer array
......@@ -470,7 +452,6 @@ type Array2Module() =
()
#if !FX_NO_BASED_ARRAYS
[<Test>]
member this.Rebase() =
// integer array
......@@ -494,7 +475,6 @@ type Array2Module() =
CheckThrowsArgumentNullException (fun () -> Array2D.rebase nullArr |> ignore)
()
#endif
[<Test>]
member this.Set() =
......
......@@ -51,11 +51,7 @@ namespace Microsoft.FSharp.Collections
(System.Array.CreateInstance(typeof<'T>, [|n1;n2|]) :?> 'T[,])
#endif
else
#if FX_NO_BASED_ARRAYS
raise (NotSupportedException(SR.GetString(SR.nonZeroBasedDisallowed)))
#else
(Array.CreateInstance(typeof<'T>, [|n1;n2|],[|b1;b2|]) :?> 'T[,])
#endif
[<CompiledName("CreateBased")>]
let createBased b1 b2 n m (x:'T) =
......
......@@ -95,7 +95,6 @@ namespace Microsoft.FSharp.Collections
[<CompiledName("ZeroCreate")>]
val zeroCreate : length1:int -> length2:int -> 'T[,]
#if !FX_NO_BASED_ARRAYS
/// <summary>Creates a based array given the dimensions and a generator function to compute the elements.</summary>
///
/// <param name="base1">The base for the first dimension of the array.</param>
......@@ -133,7 +132,6 @@ namespace Microsoft.FSharp.Collections
/// <exception cref="System.ArgumentException">Thrown when base1, base2, length1, or length2 is negative.</exception>
[<CompiledName("ZeroCreateBased")>]
val zeroCreateBased : base1:int -> base2:int -> length1:int -> length2:int -> 'T[,]
#endif
/// <summary>Applies the given function to each element of the array.</summary>
///
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册