Add error_calculator tests with eventCodeBufferMax

Improve error_calculator test code coverage by testing a new metric with
eventCodeBufferMax != 0

Change-Id: Icee0c4f76aec800d7cb23be28918e84cdab197e0
Reviewed-on: https://fuchsia-review.googlesource.com/c/cobalt/+/508678
Fuchsia-Auto-Submit: Jared Weinstein <jaredweinstein@google.com>
Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com>
Reviewed-by: Laura Peskin <pesk@google.com>
diff --git a/src/bin/config_parser/src/privacy/error_calculator_test.go b/src/bin/config_parser/src/privacy/error_calculator_test.go
index d6d377e..49174a9 100644
--- a/src/bin/config_parser/src/privacy/error_calculator_test.go
+++ b/src/bin/config_parser/src/privacy/error_calculator_test.go
@@ -14,10 +14,6 @@
 // The try-bots expect glog to be imported, but we do not use it.
 var _ = glog.Info
 
-var metric = config.MetricDefinition{
-	EventCodeBufferMax: 5,
-}
-
 func TestEstimateWithEpsilon(t *testing.T) {
 	privacyParamsCalculator, err := NewPrivacyEncodingParamsCalculatorForTesting(testParamRecords)
 	if err != nil {
@@ -29,6 +25,12 @@
 		MetricName: "Occurrence",
 		MetricType: config.MetricDefinition_OCCURRENCE,
 	}
+	testMetricWithBufferMax := config.MetricDefinition{
+		MetricName:         "OccurrenceWithBufferMax",
+		MetricType:         config.MetricDefinition_OCCURRENCE,
+		EventCodeBufferMax: 5,
+	}
+
 	uniqueDeviceCount := config.ReportDefinition{
 		ReportName:                "UniqueDeviceCounts",
 		ReportType:                config.ReportDefinition_UNIQUE_DEVICE_COUNTS,
@@ -171,6 +173,12 @@
 
 		{args{&testMetric, &uniqueDeviceCount, 0, 100000, 0}, true, 0},
 
+		// Metric with EventBufferMax set.
+		{args{&testMetricWithBufferMax, &uniqueDeviceCount, 1, 10000, 0}, true, 4.935511431266572},
+		{args{&testMetricWithBufferMax, &fleetwideOccurrenceCount, 1, 10000, 0}, true, 386.4795472694349},
+		{args{&testMetricWithBufferMax, &uniqueDeviceNumericStats, 1, 10000, 500}, true, 0.03372677729859206},
+		{args{&testMetricWithBufferMax, &fleetwideMeans, 1, 10000, 500}, true, 2117.7764297912554},
+
 		// Invalid input
 		{args{&testMetric, &uniqueDeviceNumericStats, 1, 10000, 0}, false, 0},
 		{args{&testMetric, &hourlyValueNumericStats, 1, 10000, 0}, false, 0},