-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStarBucket.Tests.fs
More file actions
56 lines (44 loc) · 1.23 KB
/
StarBucket.Tests.fs
File metadata and controls
56 lines (44 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
module OpenDiffix.Core.StarBucketTests
open Xunit
open FsUnit.Xunit
open CommonTypes
// C and D are below the default lowThresh of 3 and will be suppressed
let csv =
"""
letter
A
A
A
B
B
B
C
C
D
"""
let query =
"""
SELECT letter, diffix_count(*, RowIndex), diffix_low_count(RowIndex)
FROM table
GROUP BY 1
"""
[<Fact>]
let ``Counts all suppressed buckets`` () =
let mutable suppressedAnonCount = Null
let pullHookResultsCallback aggCtx bucket buckets =
suppressedAnonCount <- Bucket.finalizeAggregate 0 aggCtx bucket
buckets
HookTestHelpers.run [ StarBucket.hook pullHookResultsCallback ] csv query
|> ignore
suppressedAnonCount |> should equal (Integer 3L)
[<Fact>]
let ``Counts all suppressed buckets, but suppresses the star bucket`` () =
let mutable suppressedAnonCount = Null
let pullHookResultsCallback aggCtx bucket buckets =
suppressedAnonCount <- Bucket.finalizeAggregate 0 aggCtx bucket
buckets
// now only C is below the default lowThresh, and so is the *-bucket
let csvSuppressedStarBucket = csv.Replace("D\n", "")
HookTestHelpers.run [ StarBucket.hook pullHookResultsCallback ] csvSuppressedStarBucket query
|> ignore
suppressedAnonCount |> should equal Null