Skip to content

Commit 91ebe22

Browse files
committed
Create property test for Array.blit
1 parent 7f2b687 commit 91ebe22

File tree

1 file changed

+11
-1
lines changed
  • src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections

1 file changed

+11
-1
lines changed

src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ArrayProperties.fs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ let distinctByStable<'a when 'a : comparison> (xs : 'a []) =
1515
isStable sorted
1616

1717
[<Test>]
18-
let ``Seq.distinctBy is stable`` () =
18+
let ``Array.distinctBy is stable`` () =
1919
Check.QuickThrowOnFailure distinctByStable<int>
2020
Check.QuickThrowOnFailure distinctByStable<string>
21+
22+
let blitWorksLikeCopy<'a when 'a : comparison> (source : 'a [], sourceIndex, target : 'a [], targetIndex, count) =
23+
let a = runAndCheckIfAnyError (fun () -> Array.blit source sourceIndex target targetIndex count)
24+
let b = runAndCheckIfAnyError (fun () -> Array.Copy(source, sourceIndex, target, targetIndex, count))
25+
a = b
26+
27+
[<Test>]
28+
let ``Array.blit works like Array.Copy`` () =
29+
Check.QuickThrowOnFailure blitWorksLikeCopy<int>
30+
Check.QuickThrowOnFailure blitWorksLikeCopy<string>

0 commit comments

Comments
 (0)