|
|
|
#
|
|
|
|
# Copyright 2019 The Abseil Authors.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# https://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
#
|
|
|
|
|
|
|
|
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
|
|
|
|
|
|
|
# Internal-only implementation classes for Abseil Random
|
|
|
|
load(
|
|
|
|
"//absl:copts/configure_copts.bzl",
|
|
|
|
"ABSL_DEFAULT_COPTS",
|
|
|
|
"ABSL_DEFAULT_LINKOPTS",
|
|
|
|
"ABSL_RANDOM_RANDEN_COPTS",
|
|
|
|
"ABSL_TEST_COPTS",
|
|
|
|
"absl_random_randen_copts_init",
|
|
|
|
)
|
|
|
|
|
|
|
|
package(default_visibility = [
|
|
|
|
"//absl/random:__pkg__",
|
|
|
|
])
|
|
|
|
|
|
|
|
licenses(["notice"])
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "traits",
|
|
|
|
hdrs = ["traits.h"],
|
|
|
|
copts = ABSL_DEFAULT_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = ["//absl/base:config"],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "distribution_caller",
|
|
|
|
hdrs = ["distribution_caller.h"],
|
|
|
|
copts = ABSL_DEFAULT_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
"//absl/base:config",
|
|
|
|
"//absl/base:fast_type_id",
|
|
|
|
"//absl/utility",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "fast_uniform_bits",
|
|
|
|
hdrs = [
|
|
|
|
"fast_uniform_bits.h",
|
|
|
|
],
|
|
|
|
copts = ABSL_DEFAULT_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
Export of internal Abseil changes
--
4833151c207fac9f57a735efe6d5db4c83368415 by Gennadiy Rozental <rogeeff@google.com>:
Import of CCTZ from GitHub.
PiperOrigin-RevId: 320398694
--
a1becb36b223230f0a45f204a5fb33b83d2deffe by Gennadiy Rozental <rogeeff@google.com>:
Update CMakeLists.txt
Import of https://github.com/abseil/abseil-cpp/pull/737
PiperOrigin-RevId: 320391906
--
b529c45856fe7a3447f1f3259286d57e13b1f292 by Abseil Team <absl-team@google.com>:
Improves a comment about use of absl::Condition.
PiperOrigin-RevId: 320384329
--
c7b1dacda2739c10dc1ccbfb56b07ed7fe2464a4 by Laramie Leavitt <lar@google.com>:
Improve FastUniformBits performance for std::minstd_rand.
The rejection algorithm was too pessimistic before, and not in line with the [rand.adapt.ibits]. Specifically, when sampling from an URBG with a non power of 2 range, FastUniformBits constructed a rejection threshold with a power-of-2 range that was too restrictive.
For example, minstd_rand has a range of
[1, 2147483646], which has a range of 2145386495, or about 30.999 bits.
Before FastUniformBits rejected values between 1<<30 and 2145386495, which includes approximately 50% of the generated values. However, since a minimum of 3 calls are required to generate a full 64-bit value from an entropy pool of 30.9 bits, the correct value for rejection sampling is the range value which masks 21 (0x7fe00000) or 22 bits and rejects values greater than that. This reduces the probability of rejecting a sample to about 0.1%
NOTE: Abseil random does not guarantee sequence stability over time, and this is expected to change sequences in some cases.
PiperOrigin-RevId: 320285836
--
15800a39557a07dd52e0add66a0ab67aed00590b by Gennadiy Rozental <rogeeff@google.com>:
Internal change.
PiperOrigin-RevId: 320220913
--
ef39348360873f6d19669755fe0b5d09a945a501 by Gennadiy Rozental <rogeeff@google.com>:
Internal change
PiperOrigin-RevId: 320181729
--
4f9f6ef8034a24da1832e4c838c72f80fc2ea062 by Gennadiy Rozental <rogeeff@google.com>:
Internal change
PiperOrigin-RevId: 320176084
--
6bfc8008462801657d231585bd5c37fc18bb25b6 by Gennadiy Rozental <rogeeff@google.com>:
Internal change
PiperOrigin-RevId: 320176070
--
b35b055ab1f41e6056031ff0641cabab23530027 by Abseil Team <absl-team@google.com>:
Disabling using header module as well as building one for randen_hwaes_impl
PiperOrigin-RevId: 320024299
GitOrigin-RevId: 4833151c207fac9f57a735efe6d5db4c83368415
Change-Id: I9cf102dbf46ed07752a508b7cda3ab3858857d0d
4 years ago
|
|
|
deps = [
|
|
|
|
"//absl/base:config",
|
|
|
|
"//absl/meta:type_traits",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "seed_material",
|
|
|
|
srcs = [
|
|
|
|
"seed_material.cc",
|
|
|
|
],
|
|
|
|
hdrs = [
|
|
|
|
"seed_material.h",
|
|
|
|
],
|
|
|
|
copts = ABSL_DEFAULT_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS + select({
|
|
|
|
"//absl:windows": ["-DEFAULTLIB:bcrypt.lib"],
|
|
|
|
"//conditions:default": [],
|
|
|
|
}),
|
|
|
|
deps = [
|
|
|
|
":fast_uniform_bits",
|
|
|
|
"//absl/base:core_headers",
|
|
|
|
"//absl/base:raw_logging_internal",
|
|
|
|
"//absl/strings",
|
|
|
|
"//absl/types:optional",
|
|
|
|
"//absl/types:span",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "pool_urbg",
|
|
|
|
srcs = [
|
|
|
|
"pool_urbg.cc",
|
|
|
|
],
|
|
|
|
hdrs = [
|
|
|
|
"pool_urbg.h",
|
|
|
|
],
|
|
|
|
copts = ABSL_DEFAULT_COPTS,
|
|
|
|
linkopts = select({
|
|
|
|
"//absl:windows": [],
|
|
|
|
"//absl:wasm": [],
|
|
|
|
"//conditions:default": ["-pthread"],
|
|
|
|
}) + ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
":randen",
|
|
|
|
":seed_material",
|
|
|
|
":traits",
|
|
|
|
"//absl/base",
|
|
|
|
"//absl/base:config",
|
|
|
|
"//absl/base:core_headers",
|
|
|
|
"//absl/base:endian",
|
|
|
|
"//absl/base:raw_logging_internal",
|
|
|
|
"//absl/random:seed_gen_exception",
|
|
|
|
"//absl/types:span",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "explicit_seed_seq",
|
|
|
|
testonly = 1,
|
|
|
|
hdrs = [
|
|
|
|
"explicit_seed_seq.h",
|
|
|
|
],
|
|
|
|
copts = ABSL_DEFAULT_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
"//absl/base:config",
|
|
|
|
"//absl/base:endian",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "sequence_urbg",
|
|
|
|
testonly = 1,
|
|
|
|
hdrs = [
|
|
|
|
"sequence_urbg.h",
|
|
|
|
],
|
|
|
|
copts = ABSL_DEFAULT_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = ["//absl/base:config"],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "salted_seed_seq",
|
|
|
|
hdrs = [
|
|
|
|
"salted_seed_seq.h",
|
|
|
|
],
|
|
|
|
copts = ABSL_DEFAULT_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
":seed_material",
|
|
|
|
"//absl/container:inlined_vector",
|
|
|
|
"//absl/meta:type_traits",
|
|
|
|
"//absl/types:optional",
|
|
|
|
"//absl/types:span",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "iostream_state_saver",
|
|
|
|
hdrs = ["iostream_state_saver.h"],
|
|
|
|
copts = ABSL_DEFAULT_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
"//absl/meta:type_traits",
|
|
|
|
"//absl/numeric:int128",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "generate_real",
|
|
|
|
hdrs = [
|
|
|
|
"generate_real.h",
|
|
|
|
],
|
|
|
|
copts = ABSL_DEFAULT_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
":fastmath",
|
|
|
|
":traits",
|
|
|
|
"//absl/meta:type_traits",
|
|
|
|
"//absl/numeric:bits",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "fastmath",
|
|
|
|
hdrs = [
|
|
|
|
"fastmath.h",
|
|
|
|
],
|
|
|
|
copts = ABSL_DEFAULT_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = ["//absl/numeric:bits"],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "wide_multiply",
|
|
|
|
hdrs = ["wide_multiply.h"],
|
|
|
|
copts = ABSL_DEFAULT_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
":traits",
|
|
|
|
"//absl/base:config",
|
|
|
|
"//absl/numeric:bits",
|
|
|
|
"//absl/numeric:int128",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "nonsecure_base",
|
|
|
|
hdrs = ["nonsecure_base.h"],
|
|
|
|
copts = ABSL_DEFAULT_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
":pool_urbg",
|
|
|
|
":salted_seed_seq",
|
|
|
|
":seed_material",
|
|
|
|
"//absl/base:core_headers",
|
|
|
|
"//absl/meta:type_traits",
|
|
|
|
"//absl/types:optional",
|
|
|
|
"//absl/types:span",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "pcg_engine",
|
|
|
|
hdrs = ["pcg_engine.h"],
|
|
|
|
copts = ABSL_DEFAULT_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
":fastmath",
|
|
|
|
":iostream_state_saver",
|
|
|
|
"//absl/base:config",
|
|
|
|
"//absl/meta:type_traits",
|
|
|
|
"//absl/numeric:bits",
|
|
|
|
"//absl/numeric:int128",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "randen_engine",
|
|
|
|
hdrs = ["randen_engine.h"],
|
|
|
|
copts = ABSL_DEFAULT_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
":iostream_state_saver",
|
|
|
|
":randen",
|
|
|
|
"//absl/base:endian",
|
|
|
|
"//absl/meta:type_traits",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "platform",
|
|
|
|
srcs = [
|
|
|
|
"randen_round_keys.cc",
|
|
|
|
],
|
|
|
|
hdrs = [
|
|
|
|
"randen_traits.h",
|
|
|
|
],
|
|
|
|
copts = ABSL_DEFAULT_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
textual_hdrs = [
|
|
|
|
"platform.h",
|
|
|
|
],
|
|
|
|
deps = ["//absl/base:config"],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "randen",
|
|
|
|
srcs = [
|
|
|
|
"randen.cc",
|
|
|
|
],
|
|
|
|
hdrs = [
|
|
|
|
"randen.h",
|
|
|
|
],
|
|
|
|
copts = ABSL_DEFAULT_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
":platform",
|
|
|
|
":randen_hwaes",
|
|
|
|
":randen_slow",
|
|
|
|
"//absl/base:raw_logging_internal",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "randen_slow",
|
|
|
|
srcs = ["randen_slow.cc"],
|
|
|
|
hdrs = ["randen_slow.h"],
|
|
|
|
copts = ABSL_DEFAULT_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
":platform",
|
|
|
|
"//absl/base:config",
|
|
|
|
"//absl/base:core_headers",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
absl_random_randen_copts_init()
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "randen_hwaes",
|
|
|
|
srcs = [
|
|
|
|
"randen_detect.cc",
|
|
|
|
],
|
|
|
|
hdrs = [
|
|
|
|
"randen_detect.h",
|
|
|
|
"randen_hwaes.h",
|
|
|
|
],
|
|
|
|
copts = ABSL_DEFAULT_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
":platform",
|
|
|
|
":randen_hwaes_impl",
|
|
|
|
"//absl/base:config",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
# build with --save_temps to see assembly language output.
|
|
|
|
cc_library(
|
|
|
|
name = "randen_hwaes_impl",
|
|
|
|
srcs = [
|
|
|
|
"randen_hwaes.cc",
|
|
|
|
"randen_hwaes.h",
|
|
|
|
],
|
|
|
|
copts = ABSL_DEFAULT_COPTS + ABSL_RANDOM_RANDEN_COPTS + select({
|
|
|
|
"//absl:windows": [],
|
|
|
|
"//conditions:default": ["-Wno-pass-failed"],
|
|
|
|
}),
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
":platform",
|
|
|
|
"//absl/base:config",
|
|
|
|
"//absl/base:core_headers",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_binary(
|
|
|
|
name = "gaussian_distribution_gentables",
|
|
|
|
srcs = [
|
|
|
|
"gaussian_distribution_gentables.cc",
|
|
|
|
],
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
"//absl/base:core_headers",
|
|
|
|
"//absl/random:distributions",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "distribution_test_util",
|
|
|
|
testonly = 1,
|
|
|
|
srcs = [
|
|
|
|
"chi_square.cc",
|
|
|
|
"distribution_test_util.cc",
|
|
|
|
],
|
|
|
|
hdrs = [
|
|
|
|
"chi_square.h",
|
|
|
|
"distribution_test_util.h",
|
|
|
|
],
|
|
|
|
copts = ABSL_DEFAULT_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
"//absl/base:config",
|
|
|
|
"//absl/base:core_headers",
|
|
|
|
"//absl/base:raw_logging_internal",
|
|
|
|
"//absl/strings",
|
|
|
|
"//absl/strings:str_format",
|
|
|
|
"//absl/types:span",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
# Common tags for tests, etc.
|
|
|
|
ABSL_RANDOM_NONPORTABLE_TAGS = [
|
|
|
|
"no_test_android_arm",
|
|
|
|
"no_test_android_arm64",
|
|
|
|
"no_test_android_x86",
|
|
|
|
"no_test_darwin_x86_64",
|
|
|
|
"no_test_ios_x86_64",
|
|
|
|
"no_test_loonix",
|
|
|
|
"no_test_msvc_x64",
|
|
|
|
"no_test_wasm",
|
|
|
|
]
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "traits_test",
|
|
|
|
size = "small",
|
|
|
|
srcs = ["traits_test.cc"],
|
|
|
|
copts = ABSL_TEST_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
":traits",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "generate_real_test",
|
|
|
|
size = "small",
|
|
|
|
srcs = [
|
|
|
|
"generate_real_test.cc",
|
|
|
|
],
|
|
|
|
copts = ABSL_TEST_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
":generate_real",
|
|
|
|
"//absl/flags:flag",
|
|
|
|
"//absl/numeric:bits",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "distribution_test_util_test",
|
|
|
|
size = "small",
|
|
|
|
srcs = ["distribution_test_util_test.cc"],
|
|
|
|
copts = ABSL_TEST_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
":distribution_test_util",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "fastmath_test",
|
|
|
|
size = "small",
|
|
|
|
srcs = ["fastmath_test.cc"],
|
|
|
|
copts = ABSL_TEST_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
":fastmath",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "explicit_seed_seq_test",
|
|
|
|
size = "small",
|
|
|
|
srcs = ["explicit_seed_seq_test.cc"],
|
|
|
|
copts = ABSL_TEST_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
":explicit_seed_seq",
|
|
|
|
"//absl/random:seed_sequences",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "salted_seed_seq_test",
|
|
|
|
size = "small",
|
|
|
|
srcs = ["salted_seed_seq_test.cc"],
|
|
|
|
copts = ABSL_TEST_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
":salted_seed_seq",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "chi_square_test",
|
|
|
|
size = "small",
|
|
|
|
srcs = [
|
|
|
|
"chi_square_test.cc",
|
|
|
|
],
|
|
|
|
copts = ABSL_TEST_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
":distribution_test_util",
|
|
|
|
"//absl/base:core_headers",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "fast_uniform_bits_test",
|
|
|
|
size = "small",
|
|
|
|
srcs = [
|
|
|
|
"fast_uniform_bits_test.cc",
|
|
|
|
],
|
|
|
|
copts = ABSL_TEST_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
":fast_uniform_bits",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "mock_helpers",
|
|
|
|
hdrs = ["mock_helpers.h"],
|
|
|
|
deps = [
|
|
|
|
"//absl/base:fast_type_id",
|
|
|
|
"//absl/types:optional",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "mock_overload_set",
|
|
|
|
testonly = 1,
|
|
|
|
hdrs = ["mock_overload_set.h"],
|
|
|
|
deps = [
|
|
|
|
":mock_helpers",
|
|
|
|
"//absl/random:mocking_bit_gen",
|
|
|
|
"@com_google_googletest//:gtest",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "nonsecure_base_test",
|
|
|
|
size = "small",
|
|
|
|
srcs = [
|
|
|
|
"nonsecure_base_test.cc",
|
|
|
|
],
|
|
|
|
copts = ABSL_TEST_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
":nonsecure_base",
|
|
|
|
"//absl/random",
|
|
|
|
"//absl/random:distributions",
|
|
|
|
"//absl/random:seed_sequences",
|
|
|
|
"//absl/strings",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "seed_material_test",
|
|
|
|
size = "small",
|
|
|
|
srcs = ["seed_material_test.cc"],
|
|
|
|
copts = ABSL_TEST_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
":seed_material",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "pool_urbg_test",
|
|
|
|
size = "small",
|
|
|
|
srcs = [
|
|
|
|
"pool_urbg_test.cc",
|
|
|
|
],
|
|
|
|
copts = ABSL_TEST_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
":pool_urbg",
|
|
|
|
"//absl/meta:type_traits",
|
|
|
|
"//absl/types:span",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "pcg_engine_test",
|
|
|
|
size = "medium", # Trying to measure accuracy.
|
|
|
|
srcs = ["pcg_engine_test.cc"],
|
|
|
|
copts = ABSL_TEST_COPTS,
|
|
|
|
flaky = 1,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
":explicit_seed_seq",
|
|
|
|
":pcg_engine",
|
|
|
|
"//absl/time",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "randen_engine_test",
|
|
|
|
size = "medium",
|
|
|
|
srcs = [
|
|
|
|
"randen_engine_test.cc",
|
|
|
|
],
|
|
|
|
copts = ABSL_TEST_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
":explicit_seed_seq",
|
|
|
|
":randen_engine",
|
|
|
|
"//absl/base:raw_logging_internal",
|
|
|
|
"//absl/strings",
|
|
|
|
"//absl/time",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "randen_test",
|
|
|
|
size = "small",
|
|
|
|
srcs = ["randen_test.cc"],
|
|
|
|
copts = ABSL_TEST_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
":randen",
|
|
|
|
"//absl/meta:type_traits",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "randen_slow_test",
|
|
|
|
size = "small",
|
|
|
|
srcs = ["randen_slow_test.cc"],
|
|
|
|
copts = ABSL_TEST_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
":platform",
|
|
|
|
":randen_slow",
|
|
|
|
"//absl/base:endian",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "randen_hwaes_test",
|
|
|
|
size = "small",
|
|
|
|
srcs = ["randen_hwaes_test.cc"],
|
|
|
|
copts = ABSL_TEST_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
tags = ABSL_RANDOM_NONPORTABLE_TAGS,
|
|
|
|
deps = [
|
|
|
|
":platform",
|
|
|
|
":randen_hwaes",
|
|
|
|
":randen_hwaes_impl", # build_cleaner: keep
|
|
|
|
"//absl/base:raw_logging_internal",
|
|
|
|
"//absl/strings:str_format",
|
|
|
|
"@com_google_googletest//:gtest",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "wide_multiply_test",
|
|
|
|
size = "small",
|
|
|
|
srcs = ["wide_multiply_test.cc"],
|
|
|
|
copts = ABSL_TEST_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
":wide_multiply",
|
|
|
|
"//absl/numeric:bits",
|
|
|
|
"//absl/numeric:int128",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "nanobenchmark",
|
|
|
|
srcs = ["nanobenchmark.cc"],
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
textual_hdrs = ["nanobenchmark.h"],
|
|
|
|
deps = [
|
|
|
|
":platform",
|
|
|
|
":randen_engine",
|
|
|
|
"//absl/base:config",
|
|
|
|
"//absl/base:core_headers",
|
|
|
|
"//absl/base:raw_logging_internal",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "uniform_helper",
|
|
|
|
hdrs = ["uniform_helper.h"],
|
|
|
|
copts = ABSL_DEFAULT_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
Export of internal Abseil changes
--
7d0468a6610ed85586d5c87fd65de8dac5118923 by Derek Mauro <dmauro@google.com>:
Import of CCTZ from GitHub.
PiperOrigin-RevId: 313226473
--
1131ef6d116f5ce7d46537a82f300ea06dcaaa53 by Gennadiy Rozental <rogeeff@google.com>:
Migrate internal interface to use mutable references.
PiperOrigin-RevId: 312931131
--
96225212a9f5fbd0b38c71fe65539164992c7c3b by Laramie Leavitt <lar@google.com>:
Remove random/internal/distributions.h
This file was something of an historical artifact. All of the related
code has either been removed or migraged, and so the only remaining type
belongs with uniform_helper.h, as it is used to infer the return type
of the absl::Uniform method in a few cases.
PiperOrigin-RevId: 312878173
--
6dcbd5be58ad425e08740ff64088373ee7fe4a72 by Mark Barolak <mbar@google.com>:
Release the StrFormat test case for Cords to open source.
PiperOrigin-RevId: 312707974
--
34484d18dfb63a0a7ad6e2aaeb570e33592968be by Abseil Team <absl-team@google.com>:
Let Cord::Cord(string&&), Cord::operator=(string&&),
Cord::Append(string&&), and Cord::Prepend(string&&) steal string data
and embed it into the Cord as a single external chunk, instead of
copying it into flat chunks (at most 4083-byte each).
Stealing string data is faster, but it creates a long chunk, which leads
to a higher more memory usage if its subcords are created and outlive
the whole Cord.
These functions revert to copying the data if any of the following
conditions holds:
- string size is at most kMaxBytesToCopy (511), to avoid the overhead
of an external chunk for short strings;
- less than half of string capacity is used, to avoid pinning to much
unused memory.
PiperOrigin-RevId: 312683785
GitOrigin-RevId: 7d0468a6610ed85586d5c87fd65de8dac5118923
Change-Id: If79b5a1dfe6d53a8ddddbc7da84338f11fc4cfa3
5 years ago
|
|
|
":traits",
|
|
|
|
"//absl/base:config",
|
|
|
|
"//absl/meta:type_traits",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "nanobenchmark_test",
|
|
|
|
size = "small",
|
|
|
|
srcs = ["nanobenchmark_test.cc"],
|
|
|
|
flaky = 1,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
tags = [
|
|
|
|
"benchmark",
|
|
|
|
"no_test_ios_x86_64",
|
|
|
|
"no_test_loonix", # Crashing.
|
|
|
|
],
|
|
|
|
deps = [
|
|
|
|
":nanobenchmark",
|
|
|
|
"//absl/base:raw_logging_internal",
|
|
|
|
"//absl/strings",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "randen_benchmarks",
|
|
|
|
size = "medium",
|
|
|
|
timeout = "long",
|
|
|
|
srcs = ["randen_benchmarks.cc"],
|
|
|
|
copts = ABSL_TEST_COPTS + ABSL_RANDOM_RANDEN_COPTS,
|
|
|
|
flaky = 1,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
tags = ABSL_RANDOM_NONPORTABLE_TAGS + ["benchmark"],
|
|
|
|
deps = [
|
|
|
|
":nanobenchmark",
|
|
|
|
":platform",
|
|
|
|
":randen",
|
|
|
|
":randen_engine",
|
|
|
|
":randen_hwaes",
|
|
|
|
":randen_hwaes_impl",
|
|
|
|
":randen_slow",
|
|
|
|
"//absl/base:raw_logging_internal",
|
|
|
|
"//absl/strings",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "iostream_state_saver_test",
|
|
|
|
size = "small",
|
|
|
|
srcs = ["iostream_state_saver_test.cc"],
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
":iostream_state_saver",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
Export of internal Abseil changes
--
790f9061df340cd900e8da70e66c363f7af3c2eb by Abseil Team <absl-team@google.com>:
Add support for rvalue reference to function types.
PiperOrigin-RevId: 324508531
--
51fe201dbb41a3ebc3d49ff65250b5f464279d43 by Abseil Team <absl-team@google.com>:
Cleaning up function comment style; no substantive change.
PiperOrigin-RevId: 324497401
--
da8595d5266577d0c170528d12f6de17b8affcc2 by Abseil Team <absl-team@google.com>:
Add support for demangling GNU vector types.
PiperOrigin-RevId: 324494559
--
0cb0acf88c1750f6963c9cb85249f9b4f0bd5104 by Abseil Team <absl-team@google.com>:
Add support for thread-local types.
PiperOrigin-RevId: 324491183
--
c676bc8380560599cd26f7f231e04e6be532e904 by Abseil Team <absl-team@google.com>:
Add support for demangling "Du" (char8_t).
PiperOrigin-RevId: 324441607
--
b218bf6467bc62b327214782c881e8224ad91509 by Abseil Team <absl-team@google.com>:
Update doc comments in header of `any.h` to reflect that `absl::variant` has been released.
PiperOrigin-RevId: 324431690
--
e5b579f3f1aa598c1f62e71dba7103b98811de59 by Laramie Leavitt <lar@google.com>:
Bugfix: Fix bounds in absl::Uniform where one of the bounds is min/max.
When absl::Uniform(rng, tag, a, b) is called, the tag is used in conjunction with the type to determine whether or not to manipulate the bounds to make them inclusive or exclusive through the uniform_*_bound functions. Unfortunately, at limits of the interval the function was not well behaved.
The previous implementation used wrapping arithmetic. This causes incorrect bounds computation at the extremes (numeric_limits::min / numeric_limits::max) the bound would wrap.
Improve this situation by:
1/ Changing the uniform_*_bound functions to use saturating arithmetic instead of wrapping, thus in the unsigned case, the upper_bound of IntervalOpenOpen for 0 is now 0, rather than numeric_limits::max, likewise for the lower bound.
2/ Adjusting the hi/lo checks in the distributions. When the interval is empty, such as for absl::Uniform(absl::IntervalOpenOpen, gen, 1, 0), the return value is somewhat nonsensical. Now absl::Uniform more consistently returns the low input rather than any adjusted input. In the above case, that means that 1 is returned rather than 2.
NOTE: Calls to absl::Uniform where the resolved upper bound is < the lower bound are still ill-formed and should be avoided.
3/ Adding better tests.
The underlying uniform_*_distribution classes are not affected.
PiperOrigin-RevId: 324240873
GitOrigin-RevId: 790f9061df340cd900e8da70e66c363f7af3c2eb
Change-Id: I2a2208650ea3135c575e200b868ce1d275069fc8
4 years ago
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "uniform_helper_test",
|
|
|
|
size = "small",
|
|
|
|
srcs = ["uniform_helper_test.cc"],
|
|
|
|
copts = ABSL_TEST_COPTS,
|
|
|
|
linkopts = ABSL_DEFAULT_LINKOPTS,
|
|
|
|
deps = [
|
|
|
|
":uniform_helper",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|