anchor.diff:      ()
               
   let private PartitionTester partInt partString =
  -    // int array
  +    // int vector
       let intSrc:int [] = [| 1..100 |]    
       let funcInt x = if (x%2=1) then true else false
  -    let intPartitioned : int[] * int[] = partInt funcInt intSrc
  +    let intPartitioned : vector<int> * vector<int> = partInt funcInt intSrc
       if ([|1..2..100|],[|2..2..100|]) <> intPartitioned then Assert.Fail ()
           
       let allLeft = partInt (fun _ -> true) intSrc
  
positive.code: 
  [<TestCase>]
  let init () : unit = 
      InitTester Array.init Array.init
          
  [<TestCase>]
  let initWithSideEffects  () : unit =
      let stamp = ref 0
      let f i = 
          stamp := !stamp + 1; 
          i 
      Array.init 0 f |> ignore
      Assert.AreEqual (0, !stamp)
          
      stamp := 0
      Array.init 10 f |> ignore
      Assert.AreEqual (10, !stamp)
  
  [<TestCase>]
  let isEmpty () : unit =
      // integer array
      let intArr = [| 3;4;7;8;10 |]    
      let resultInt = Array.isEmpty intArr 
      if resultInt <> false then Assert.Fail()
          
      // string array
      let strArr = [|"Lists"; "are";  "commonly" ; "list" |]    
      let resultStr = Array.isEmpty strArr 
      if resultStr <> false then Assert.Fail()
          
      // empty array    
      let emptyArr:int[] = [| |]
      let resultEpt = Array.isEmpty emptyArr 
      if resultEpt <> true then Assert.Fail()
  
      // null array
      let nullArr = null:string[] 
      checkThrowsArgumentNullException (fun () -> Array.isEmpty nullArr |> ignore)  
          
      ()
  
  [<TestCase>]
  let iter () : unit =
      // integer array
      let intArr = [| 1..10 |]  
      let resultInt = ref 0    
      let funInt (x:int) =   
          resultInt := !resultInt + x              
          () 
      Array.iter funInt intArr 
      if !resultInt <> 55 then Assert.Fail()    
          
      // string array
      let strArr = [|"Lists"; "are";  "commonly" ; "list" |]
      let resultStr = ref ""
      let funStr (x : string) =
          resultStr := (!resultStr) + x   
          ()
      Array.iter funStr strArr  
      if !resultStr <> "Listsarecommonlylist" then Assert.Fail()   
          
      // empty array    
      let emptyArr : int[] = [| |]
      let resultEpt = ref 0
      Array.iter funInt emptyArr 
      if !resultEpt <> 0 then Assert.Fail()    
  
      // null array
      let nullArr = null : string[]  
      checkThrowsArgumentNullException (fun () -> Array.iter funStr nullArr |> ignore)  
          
      ()
         
  [<TestCase>]
  let iter2 () : unit =
      // integer array
      let resultInt = ref 0    
      let funInt (x:int) (y:int) =   
          resultInt := !resultInt + x + y             
          () 
      Array.iter2 funInt [| 1..10 |] [|2..2..20|] 
      if !resultInt <> 165 then Assert.Fail()    
          
      // string array
      let resultStr = ref ""
      let funStr (x:string) (y:string) =
          resultStr := (!resultStr) + x  + y 
          ()
      Array.iter2 funStr [|"A"; "B";  "C" ; "D" |] [|"a"; "b"; "c"; "d"|]  
      if !resultStr <> "AaBbCcDd" then Assert.Fail()   
          
      // empty array    
      let emptyArr:int[] = [| |]
      let resultEpt = ref 0
      Array.iter2 funInt emptyArr emptyArr 
      if !resultEpt <> 0 then Assert.Fail()    
  
      // null array
      let nullArr = null:string[]  
      let validArray = [| "a" |]     
      checkThrowsArgumentNullException (fun () -> Array.iter2 funStr nullArr validArray |> ignore)  
      checkThrowsArgumentNullException (fun () -> Array.iter2 funStr validArray nullArr |> ignore)  
          
      // len1 <> len2        
      checkThrowsArgumentException(fun () -> Array.iter2 funInt [| 1..10 |] [|2..20|])
    
      ()
          
          
  [<TestCase>]
  let iteri () : unit =
      // integer array
      let intArr = [| 1..10 |]  
      let resultInt = ref 0    
      let funInt (x:int) y =   
          resultInt := !resultInt + x + y             
          () 
      Array.iteri funInt intArr 
      if !resultInt <> 100 then Assert.Fail()    
          
      // string array
      let strArr = [|"Lists"; "are";  "commonly" ; "list" |]
      let resultStr = ref 0
      let funStr (x:int) (y:string) =
          resultStr := (!resultStr) + x + y.Length
          ()
      Array.iteri funStr strArr  
      if !resultStr <> 26 then Assert.Fail()   
          
      // empty array    
      let emptyArr:int[] = [| |]
      let resultEpt = ref 0
      Array.iteri funInt emptyArr 
      if !resultEpt <> 0 then Assert.Fail()    
  
      // null array
      let nullArr = null:string[] 
      checkThrowsArgumentNullException (fun () -> Array.iteri funStr nullArr |> ignore)  
          
      ()
          
  [<TestCase>]
  let iteri2 () : unit =
      // integer array
      let resultInt = ref 0    
      let funInt (x:int) (y:int) (z:int) =   
          resultInt := !resultInt + x + y + z            
          () 
      Array.iteri2 funInt [| 1..10 |] [|2..2..20|] 
      if !resultInt <> 210 then Assert.Fail()    
          
      // string array
      let resultStr = ref ""
      let funStr (x:int) (y:string) (z:string) =
          resultStr := (!resultStr) + x.ToString()  + y + z
          ()
      Array.iteri2 funStr [|"A"; "B";  "C" ; "D" |] [|"a"; "b"; "c"; "d"|]  
      if !resultStr <> "0Aa1Bb2Cc3Dd" then Assert.Fail()   
          
      // empty array    
      let emptyArr:int[] = [| |]
      let resultEpt = ref 0
      Array.iteri2 funInt emptyArr emptyArr 
      if !resultEpt <> 0 then Assert.Fail()    
  
      // null array
      let nullArr = null:string[]
      let validArray = [| "a" |] 
      checkThrowsArgumentNullException (fun () -> Array.iteri2 funStr nullArr validArray |> ignore)  
      checkThrowsArgumentNullException (fun () -> Array.iteri2 funStr validArray nullArr |> ignore)  
          
      // len1 <> len2
      checkThrowsArgumentException(fun () -> Array.iteri2 funInt [| 1..10 |] [|2..20|]  |> ignore)
          
      ()                
  
  let private MapTester mapInt (mapString : (string -> int) -> array<string> -> array<int>) =
      // empty array 
      let f x = x + 1
      let result = mapInt f [| |]
      if result <> [| |] then Assert.Fail ()
          
      // int array
      let result = mapInt f [| 1..100 |]
      if result <> [| 2..101 |] then Assert.Fail ()
          
      // string array
      let result = [| "a"; "aa"; "aaa" |] |> mapString (fun s -> s.Length) 
      if result <> [| 1..3 |] then Assert.Fail ()
          
      // null array
      let nullArg : int [] = null
      checkThrowsArgumentNullException (fun () -> mapInt f nullArg |> ignore)
          
  
negative.code: 
  [<TestCase>]
  let empty () : unit =
      let emptyVector = Vector.empty
      if Vector.length emptyVector <> 0 then Assert.Fail()
  
  [<TestCase>]
  let append () : unit =
      // integer vector
      Vector.append
          (Vector.ofArray [| 1; 2 |])
          (Vector.ofArray [| 3; 4 |])
      |> should equal
          (Vector.ofArray [| 1; 2; 3; 4 |])
          
      // string vector
      Vector.append
          (Vector.ofArray [| "a"; "b" |])
          (Vector.ofArray [| "C"; "D" |])
      |> should equal
          (Vector.ofArray [| "a"; "b"; "C"; "D" |])
  
      // empty vector
      let emptyArray : vector<int>  = [|   |]
      let singleArray : vector<int> = [| 1 |]
          
      let appEmptySingle = Vector.append emptyArray singleArray
      let appSingleEmpty = Vector.append singleArray emptyArray
          
      Assert.IsTrue( (appEmptySingle = [| 1 |]) )
      Assert.IsTrue( (appSingleEmpty = [| 1 |]) )
        
      // null vector
      let nullArray = null:vector<int>
      let validArray = [| 1 |]
      checkThrowsArgumentNullException (fun () -> Vector.append validArray nullArray |> ignore)    
      checkThrowsArgumentNullException (fun () -> Vector.append nullArray validArray |> ignore)   
  
      ()
  
  [<TestCase>]
  let average () : unit =   
        
      // empty float32 vector
      let emptyFloatArray = Vector.empty<float32> 
      checkThrowsArgumentException(fun () -> Vector.average emptyFloatArray |> ignore)
          
      // empty double vector
      let emptyDoubleArray = Vector.empty<float> 
      checkThrowsArgumentException(fun () -> Vector.average emptyDoubleArray |> ignore)
          
      // empty decimal vector
      let emptyDecimalArray = Vector.empty<decimal> 
      checkThrowsArgumentException (fun () -> Vector.average emptyDecimalArray |>ignore )
  
      // float32 vector
      let floatArray: vector<float32> = [| 1.2f; 3.5f; 6.7f |]
      let averageOfFloat = Vector.average floatArray
      if averageOfFloat <> 3.8000000000000003f then Assert.Fail()
          
      // double vector
      let doubleArray: float[] = [| 1.0;8.0 |]
      let averageOfDouble = Vector.average doubleArray
      if averageOfDouble <> 4.5 then Assert.Fail()
          
      // decimal vector
      let decimalArray: decimal[] = [| 0M; 19M; 19.03M |]
      let averageOfDecimal = Vector.average decimalArray
      if averageOfDecimal <> 12.676666666666666666666666667M then Assert.Fail()      
          
      // null vector
      let nullArr = null : double[]    
      checkThrowsArgumentNullException (fun () -> Vector.average nullArr |> ignore) 
  
      ()
          
  [<TestCase>]
  let averageBy () : unit =  
      
      // empty double vector   
      let emptyDouArray = Vector.empty<float>
      let funcd x = x + 6.7
      checkThrowsArgumentException(fun () -> Vector.averageBy funcd emptyDouArray |> ignore)
                  
      // empty float32 vector
      let emptyFloat32Array: vector<float32> = [||]
      let funcf x = x + 9.8f 
      checkThrowsArgumentException(fun () -> Vector.averageBy funcf emptyFloat32Array |> ignore)
          
      // empty decimal vector
      let emptyDecimalArray = Vector.empty<decimal>
      let funcDecimal x = x + 9.8M 
      checkThrowsArgumentException(fun () -> Vector.averageBy funcDecimal emptyDecimalArray |> ignore)
          
      // float32 vector
      let floatArray: vector<float32> = [| 1.2f;3.5f;6.7f |]      
      let averageOfFloat = Vector.averageBy funcf floatArray
      if averageOfFloat <> 13.5999994f then Assert.Fail()
          
      // double vector
      let doubleArray: float[] = [| 1.0;8.0 |]
      let averageOfDouble = Vector.averageBy funcd doubleArray
      if averageOfDouble <> 11.2 then Assert.Fail()
          
      // decimal vector
      let decimalArray: decimal[] = [| 0M;19M;19.03M |]
      let averageOfDecimal = Vector.averageBy funcDecimal decimalArray
      if averageOfDecimal <> 22.476666666666666666666666667M then Assert.Fail()     
          
      // null vector
      let nullArr : double[] = null
      checkThrowsArgumentNullException (fun () -> Vector.averageBy funcd nullArr |> ignore) 
          
      ()
          
  [<TestCase>]
  let blit () : unit = 
      // int vector   
      let intSrc = [| 1..10 |]
      let intDes:vector<int> = Array.zeroCreate 10 
      Vector.blit intSrc 0 intDes 0 5
      if intDes.[4] <> 5 then Assert.Fail()
      if intDes.[5] <> 0 then Assert.Fail()
          
      // string vector
      let strSrc = [| "a";"b";"c";"d";"e";"j"|]
      let strDes = Array.create 10 "w"
      Vector.blit strSrc 1 strDes 2 3
      if strDes.[3] <> "c" || Array.get strDes 4 = "w" then Assert.Fail()
       
      // null vector
      let nullArr = null:string[]
      checkThrowsArgumentNullException (fun () -> Vector.blit nullArr 1 strDes 2 3 |> ignore) 
  
      // bounds check
      checkThrowsArgumentException (fun () -> Vector.blit intSrc -1 intDes 1 3 |> ignore)
      checkThrowsArgumentException (fun () -> Vector.blit intSrc 1 intDes -1 3 |> ignore)
      checkThrowsArgumentException (fun () -> Vector.blit intSrc 1 intDes 1 -3 |> ignore)
      checkThrowsArgumentException (fun () -> Vector.blit intSrc 1 intDes 1 300 |> ignore)
      checkThrowsArgumentException (fun () -> Vector.blit intSrc 1 intDes 5 8 |> ignore)
          
      ()
  
        
  let private ChooseTester chooseInt chooseString = 
      // int vector
      let intSrc:int [] = [| 1..100 |]    
      let funcInt x = if (x%5=0) then Some x else None       
      let intChoosed : vector<int> = chooseInt funcInt intSrc
      if intChoosed.[1] <> 10 then Assert.Fail()
          
      // string vector
      let stringSrc: string [] = "Lists are a commonly used data structure. They are not mutable, i.e., you can't delete an element of a list – instead you create a new list with the element deleted. List values often share storage under the hood, i.e., a list value only allocate more memory when you actually execute construction operations.".Split([|' '|], System.StringSplitOptions.RemoveEmptyEntries)
      let funcString x = match x with
                          | "list"-> Some x
  