Skip to content

Commit 82fab2d

Browse files
added test for AList.sub (potential) problems
1 parent dad3ccf commit 82fab2d

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

src/Test/FSharp.Data.Adaptive.Tests/Program.fs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,51 @@ open BenchmarkDotNet.Running
44
open FSharp.Data.Traceable
55
open FSharp.Data.Adaptive
66

7+
8+
open NUnit.Framework
9+
open FsCheck
10+
open FSharp.Data.Adaptive
11+
open FSharp.Data.Traceable
12+
open FsUnit
13+
open FsCheck.NUnit
14+
15+
[<Test>]
16+
let ``[AList] sub``() =
17+
18+
let l = clist [0 .. 10]
19+
20+
let subbed =
21+
l
22+
|> AList.indexed
23+
|> AList.sortBy snd
24+
|> AList.sub 0 3
25+
26+
let thrd = subbed |> AList.force |> IndexList.toArray
27+
subbed |> AList.force |> printfn "%A"
28+
29+
transact (fun _ ->
30+
l.[fst thrd.[2]] <- 4
31+
)
32+
subbed |> AList.force |> Seq.toArray |> Array.map snd |> should equal [0;1;4]
33+
34+
35+
transact (fun _ ->
36+
l.[fst thrd.[2]] <- 5
37+
)
38+
subbed |> AList.force |> should equal [1;2;5]
39+
40+
41+
transact (fun _ ->
42+
l.[fst thrd.[2]] <- 6
43+
)
44+
subbed |> AList.force |> should equal [1;2;6]
45+
746
[<EntryPoint>]
847
let main _args =
948

49+
//``[AList] sub``();
50+
51+
1052
//let a = cval [1;2;3;4]
1153
//let b = AVal.cast<seq<int>> a
1254

0 commit comments

Comments
 (0)