#include "components/attribution_reporting/privacy_math.h"
#include <stdint.h>
#include <cmath>
#include <limits>
#include <map>
#include <optional>
#include <set>
#include <utility>
#include <vector>
#include "base/numerics/checked_math.h"
#include "base/test/gmock_expected_support.h"
#include "base/time/time.h"
#include "base/types/expected.h"
#include "base/types/expected_macros.h"
#include "build/build_config.h"
#include "components/attribution_reporting/attribution_scopes_data.h"
#include "components/attribution_reporting/attribution_scopes_set.h"
#include "components/attribution_reporting/event_report_windows.h"
#include "components/attribution_reporting/max_event_level_reports.h"
#include "components/attribution_reporting/source_type.mojom.h"
#include "components/attribution_reporting/test_utils.h"
#include "components/attribution_reporting/trigger_config.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace attribution_reporting {
namespace {
EventReportWindows;
MaxEventLevelReports;
TriggerSpecs;
SourceType;
TEST(PrivacyMathTest, BinomialCoefficient) { … }
TEST(PrivacyMathTest, GetKCombinationAtIndex) { … }
#if BUILDFLAG(IS_WIN) && !defined(NDEBUG)
#define MAYBE_GetKCombination_NoRepeats …
#else
#define MAYBE_GetKCombination_NoRepeats …
#endif
TEST(PrivacyMathTest, MAYBE_GetKCombination_NoRepeats) { … }
#if BUILDFLAG(IS_WIN) && !defined(NDEBUG)
#define MAYBE_GetKCombination_MatchesDefinition …
#else
#define MAYBE_GetKCombination_MatchesDefinition …
#endif
TEST(PrivacyMathTest, MAYBE_GetKCombination_MatchesDefinition) { … }
TEST(PrivacyMathTest, GetNumberOfStarsAndBarsSequences) { … }
TEST(PrivacyMathTest, GetStarIndices) { … }
TEST(PrivacyMathTest, GetBarsPrecedingEachStar) { … }
TEST(PrivacyMathTest, BinaryEntropy) { … }
TEST(PrivacyMathTest, GetRandomizedResponseRate) { … }
TEST(PrivacyMathTest, ComputeChannelCapacity) { … }
TEST(PrivacyMathTest, ComputeChannelCapacityWithScopes) { … }
TEST(PrivacyMathTest, GetFakeReportsForSequenceIndex) { … }
void RunRandomFakeReportsTest(const TriggerSpecs& specs,
const int num_samples,
const double tolerance) { … }
TEST(PrivacyMathTest, GetRandomFakeReports_Event_MatchesExpectedDistribution) { … }
#if BUILDFLAG(IS_WIN) && !defined(NDEBUG)
#define MAYBE_GetRandomFakeReports_Navigation_MatchesExpectedDistribution …
#else
#define MAYBE_GetRandomFakeReports_Navigation_MatchesExpectedDistribution …
#endif
TEST(PrivacyMathTest,
MAYBE_GetRandomFakeReports_Navigation_MatchesExpectedDistribution) { … }
TEST(PrivacyMathTest, GetRandomFakeReports_Custom_MatchesExpectedDistribution) { … }
const struct { … } kNumStateTestCases[] = …;
TEST(PrivacyMathTest, GetNumStates) { … }
TEST(PrivacyMathTest, NumStatesForTriggerSpecs_UniqueSampling) { … }
TEST(PrivacyMathTest, NonDefaultTriggerDataForSingleSharedSpec) { … }
TEST(PrivacyMathTest, RandomizedResponse_ExceedsChannelCapacity) { … }
TEST(PrivacyMathTest, RandomizedResponse_ExceedsScopesChannelCapacity) { … }
TEST(PrivacyMathTest, UnaryChannel) { … }
TEST(PrivacyMathTest, IsValid) { … }
}
}