react-native-windows 0.84.0 → 0.84.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Directory.Build.props +2 -17
- package/Folly/ThreadNameStub.cpp +4 -6
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +1 -7
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters +0 -3
- package/PropertySheets/CIBuildOptimizations.props +2 -2
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/PropertySheets/JSEngine.props +1 -1
- package/PropertySheets/NuGet.LockFile.props +10 -1
- package/PropertySheets/React.Cpp.props +3 -3
- package/ReactCommon/ReactCommon.vcxproj +0 -5
- package/Scripts/NuGetRestoreForceEvaluateAllSolutions.ps1 +61 -6
- package/Scripts/Tfs/Layout-Desktop-Headers.ps1 +4 -37
- package/Scripts/UpdateNightlyDependencies.ps1 +47 -0
- package/Scripts/creaternwapp.cmd +5 -8
- package/Scripts/creaternwlib.cmd +10 -23
- package/Shared/Shared.vcxitems +2 -0
- package/{Folly → external}/.clang-format +0 -1
- package/external/External.vcxitems +10 -0
- package/external/fast-float/.syncignore +10 -0
- package/external/fast-float/LICENSE-APACHE +190 -0
- package/external/fast-float/LICENSE-BOOST +23 -0
- package/external/fast-float/LICENSE-MIT +27 -0
- package/external/fast-float/README.md +545 -0
- package/external/fast-float/cgmanifest.json +15 -0
- package/external/fast-float/fast-float.vcxitems +14 -0
- package/external/fast-float/include/fast_float/ascii_number.h +588 -0
- package/external/fast-float/include/fast_float/bigint.h +638 -0
- package/external/fast-float/include/fast_float/constexpr_feature_detect.h +46 -0
- package/external/fast-float/include/fast_float/decimal_to_binary.h +212 -0
- package/external/fast-float/include/fast_float/digit_comparison.h +457 -0
- package/external/fast-float/include/fast_float/fast_float.h +59 -0
- package/external/fast-float/include/fast_float/fast_table.h +708 -0
- package/external/fast-float/include/fast_float/float_common.h +1240 -0
- package/external/fast-float/include/fast_float/parse_number.h +399 -0
- package/external/fast-float/sync-config.json +8 -0
- package/external/fmt/.syncignore +10 -0
- package/external/fmt/CONTRIBUTING.md +20 -0
- package/external/fmt/LICENSE +27 -0
- package/external/fmt/README.md +484 -0
- package/external/fmt/doc/ChangeLog-old.md +3290 -0
- package/external/fmt/doc/api.md +650 -0
- package/external/fmt/doc/fmt.css +61 -0
- package/external/fmt/doc/fmt.js +4 -0
- package/external/fmt/doc/get-started.md +222 -0
- package/external/fmt/doc/index.md +151 -0
- package/external/fmt/doc/perf.svg +1 -0
- package/external/fmt/doc/python-license.txt +290 -0
- package/external/fmt/doc/syntax.md +887 -0
- package/external/fmt/fmt.vcxitems +28 -0
- package/external/fmt/include/fmt/args.h +228 -0
- package/external/fmt/include/fmt/base.h +3077 -0
- package/external/fmt/include/fmt/chrono.h +2432 -0
- package/external/fmt/include/fmt/color.h +612 -0
- package/external/fmt/include/fmt/compile.h +529 -0
- package/external/fmt/include/fmt/core.h +5 -0
- package/external/fmt/include/fmt/format-inl.h +1928 -0
- package/external/fmt/include/fmt/format.h +4427 -0
- package/external/fmt/include/fmt/os.h +439 -0
- package/external/fmt/include/fmt/ostream.h +211 -0
- package/external/fmt/include/fmt/printf.h +656 -0
- package/external/fmt/include/fmt/ranges.h +882 -0
- package/external/fmt/include/fmt/std.h +699 -0
- package/external/fmt/include/fmt/xchar.h +322 -0
- package/external/fmt/src/fmt.cc +135 -0
- package/external/fmt/src/format.cc +43 -0
- package/external/fmt/src/os.cc +403 -0
- package/external/fmt/sync-config.json +8 -0
- package/external/folly/.syncignore +60 -0
- package/external/folly/LICENSE +200 -0
- package/external/folly/README.md +263 -0
- package/{fmt → external/folly/folly}/.clang-format +0 -1
- package/external/folly/folly/AtomicHashArray-inl.h +546 -0
- package/external/folly/folly/AtomicHashArray.h +431 -0
- package/external/folly/folly/AtomicHashMap-inl.h +653 -0
- package/external/folly/folly/AtomicHashMap.h +484 -0
- package/external/folly/folly/AtomicIntrusiveLinkedList.h +206 -0
- package/external/folly/folly/AtomicLinkedList.h +110 -0
- package/external/folly/folly/AtomicUnorderedMap.h +522 -0
- package/external/folly/folly/BUCK +1631 -0
- package/external/folly/folly/BUILD_MODE.bzl +72 -0
- package/external/folly/folly/Benchmark.cpp +986 -0
- package/external/folly/folly/Benchmark.h +680 -0
- package/external/folly/folly/BenchmarkUtil.h +47 -0
- package/external/folly/folly/Bits.h +17 -0
- package/external/folly/folly/CMakeLists.txt +110 -0
- package/external/folly/folly/CPortability.h +338 -0
- package/external/folly/folly/CancellationToken-inl.h +449 -0
- package/external/folly/folly/CancellationToken.cpp +250 -0
- package/external/folly/folly/CancellationToken.h +365 -0
- package/external/folly/folly/Chrono.h +132 -0
- package/external/folly/folly/ClockGettimeWrappers.cpp +93 -0
- package/external/folly/folly/ClockGettimeWrappers.h +29 -0
- package/external/folly/folly/ConcurrentBitSet.h +157 -0
- package/external/folly/folly/ConcurrentLazy.h +74 -0
- package/external/folly/folly/ConcurrentSkipList-inl.h +341 -0
- package/external/folly/folly/ConcurrentSkipList.h +824 -0
- package/external/folly/folly/ConstructorCallbackList.h +158 -0
- package/external/folly/folly/Conv.h +2026 -0
- package/external/folly/folly/CppAttributes.h +170 -0
- package/external/folly/folly/CpuId.h +297 -0
- package/external/folly/folly/DefaultKeepAliveExecutor.h +172 -0
- package/external/folly/folly/Demangle.cpp +255 -0
- package/external/folly/folly/Demangle.h +73 -0
- package/external/folly/folly/DiscriminatedPtr.h +236 -0
- package/external/folly/folly/DynamicConverter.h +17 -0
- package/external/folly/folly/Exception.h +150 -0
- package/external/folly/folly/ExceptionString.cpp +51 -0
- package/external/folly/folly/ExceptionString.h +33 -0
- package/external/folly/folly/ExceptionWrapper-inl.h +264 -0
- package/external/folly/folly/ExceptionWrapper.cpp +37 -0
- package/external/folly/folly/ExceptionWrapper.h +377 -0
- package/external/folly/folly/Executor.cpp +111 -0
- package/external/folly/folly/Executor.h +351 -0
- package/external/folly/folly/Expected.h +1725 -0
- package/external/folly/folly/FBString.h +2888 -0
- package/external/folly/folly/FBVector.h +17 -0
- package/external/folly/folly/File.cpp +180 -0
- package/external/folly/folly/File.h +177 -0
- package/external/folly/folly/FileUtil.cpp +378 -0
- package/external/folly/folly/FileUtil.h +332 -0
- package/external/folly/folly/Fingerprint.cpp +135 -0
- package/external/folly/folly/Fingerprint.h +289 -0
- package/external/folly/folly/FixedString.h +2965 -0
- package/external/folly/folly/FollyMemcpy.cpp +30 -0
- package/external/folly/folly/FollyMemcpy.h +23 -0
- package/external/folly/folly/FollyMemset.cpp +29 -0
- package/external/folly/folly/FollyMemset.h +25 -0
- package/external/folly/folly/Format-inl.h +1152 -0
- package/external/folly/folly/Format.cpp +429 -0
- package/external/folly/folly/Format.h +463 -0
- package/external/folly/folly/FormatArg.h +285 -0
- package/external/folly/folly/FormatTraits.h +65 -0
- package/external/folly/folly/Function.h +1159 -0
- package/external/folly/folly/GLog.h +85 -0
- package/external/folly/folly/GroupVarint.cpp +153 -0
- package/external/folly/folly/GroupVarint.h +630 -0
- package/external/folly/folly/Hash.h +20 -0
- package/external/folly/folly/IPAddress.cpp +490 -0
- package/external/folly/folly/IPAddress.h +667 -0
- package/external/folly/folly/IPAddressException.h +82 -0
- package/external/folly/folly/IPAddressV4.cpp +305 -0
- package/external/folly/folly/IPAddressV4.h +495 -0
- package/external/folly/folly/IPAddressV6.cpp +541 -0
- package/external/folly/folly/IPAddressV6.h +627 -0
- package/external/folly/folly/Indestructible.h +164 -0
- package/external/folly/folly/IndexedMemPool.h +550 -0
- package/external/folly/folly/IntrusiveList.h +17 -0
- package/external/folly/folly/Lazy.h +142 -0
- package/external/folly/folly/Likely.h +76 -0
- package/external/folly/folly/MPMCPipeline.h +280 -0
- package/external/folly/folly/MPMCQueue.h +1556 -0
- package/external/folly/folly/MacAddress.cpp +188 -0
- package/external/folly/folly/MacAddress.h +260 -0
- package/external/folly/folly/MapUtil.h +17 -0
- package/external/folly/folly/Math.h +258 -0
- package/external/folly/folly/MaybeManagedPtr.h +120 -0
- package/external/folly/folly/Memory.h +900 -0
- package/external/folly/folly/MicroLock.cpp +76 -0
- package/external/folly/folly/MicroLock.h +354 -0
- package/external/folly/folly/MicroSpinLock.h +17 -0
- package/external/folly/folly/MoveWrapper.h +76 -0
- package/external/folly/folly/ObserverContainer.h +1026 -0
- package/external/folly/folly/Optional.h +743 -0
- package/external/folly/folly/Overload.h +325 -0
- package/external/folly/folly/PackedSyncPtr.h +147 -0
- package/external/folly/folly/Padded.h +464 -0
- package/external/folly/folly/Poly-inl.h +230 -0
- package/external/folly/folly/Poly.h +1095 -0
- package/external/folly/folly/PolyException.h +43 -0
- package/external/folly/folly/Portability.h +644 -0
- package/external/folly/folly/Preprocessor.h +236 -0
- package/external/folly/folly/ProducerConsumerQueue.h +182 -0
- package/external/folly/folly/RWSpinLock.h +17 -0
- package/external/folly/folly/Random-inl.h +86 -0
- package/external/folly/folly/Random.cpp +184 -0
- package/external/folly/folly/Random.h +434 -0
- package/external/folly/folly/Range.h +1772 -0
- package/external/folly/folly/Replaceable.h +636 -0
- package/external/folly/folly/ScopeGuard.cpp +29 -0
- package/external/folly/folly/ScopeGuard.h +420 -0
- package/external/folly/folly/SharedMutex.cpp +81 -0
- package/external/folly/folly/SharedMutex.h +1751 -0
- package/external/folly/folly/Singleton-inl.h +332 -0
- package/external/folly/folly/Singleton.cpp +512 -0
- package/external/folly/folly/Singleton.h +891 -0
- package/external/folly/folly/SingletonThreadLocal.cpp +53 -0
- package/external/folly/folly/SingletonThreadLocal.h +263 -0
- package/external/folly/folly/SocketAddress.cpp +786 -0
- package/external/folly/folly/SocketAddress.h +768 -0
- package/external/folly/folly/SpinLock.h +55 -0
- package/external/folly/folly/String-inl.h +668 -0
- package/external/folly/folly/String.cpp +777 -0
- package/external/folly/folly/String.h +767 -0
- package/external/folly/folly/Subprocess.cpp +1142 -0
- package/external/folly/folly/Subprocess.h +1055 -0
- package/external/folly/folly/Synchronized.h +1833 -0
- package/external/folly/folly/SynchronizedPtr.h +106 -0
- package/external/folly/folly/ThreadCachedInt.h +175 -0
- package/external/folly/folly/ThreadLocal.h +478 -0
- package/external/folly/folly/TimeoutQueue.cpp +78 -0
- package/external/folly/folly/TimeoutQueue.h +123 -0
- package/external/folly/folly/TokenBucket.h +673 -0
- package/external/folly/folly/Traits.h +1442 -0
- package/external/folly/folly/Try-inl.h +372 -0
- package/external/folly/folly/Try.cpp +23 -0
- package/external/folly/folly/Try.h +728 -0
- package/external/folly/folly/UTF8String.h +56 -0
- package/external/folly/folly/Unicode.cpp +201 -0
- package/external/folly/folly/Unicode.h +94 -0
- package/external/folly/folly/Unit.h +65 -0
- package/external/folly/folly/Uri-inl.h +101 -0
- package/external/folly/folly/Uri.cpp +190 -0
- package/external/folly/folly/Uri.h +142 -0
- package/external/folly/folly/Utility.h +932 -0
- package/external/folly/folly/VERSION +1 -0
- package/external/folly/folly/Varint.h +230 -0
- package/external/folly/folly/VirtualExecutor.h +17 -0
- package/external/folly/folly/algorithm/simd/BUCK +47 -0
- package/external/folly/folly/algorithm/simd/Contains.cpp +42 -0
- package/external/folly/folly/algorithm/simd/Contains.h +116 -0
- package/external/folly/folly/algorithm/simd/FindFixed.h +301 -0
- package/external/folly/folly/algorithm/simd/Ignore.h +52 -0
- package/external/folly/folly/algorithm/simd/Movemask.h +207 -0
- package/external/folly/folly/algorithm/simd/detail/BUCK +70 -0
- package/external/folly/folly/algorithm/simd/detail/ContainsImpl.h +91 -0
- package/external/folly/folly/algorithm/simd/detail/SimdAnyOf.h +83 -0
- package/external/folly/folly/algorithm/simd/detail/SimdForEach.h +209 -0
- package/external/folly/folly/algorithm/simd/detail/SimdPlatform.h +445 -0
- package/external/folly/folly/algorithm/simd/detail/Traits.h +125 -0
- package/external/folly/folly/algorithm/simd/detail/UnrollUtils.h +126 -0
- package/external/folly/folly/base64.h +264 -0
- package/external/folly/folly/chrono/BUCK +29 -0
- package/external/folly/folly/chrono/Clock.h +65 -0
- package/external/folly/folly/chrono/Conv.h +712 -0
- package/external/folly/folly/chrono/test/BUCK +26 -0
- package/external/folly/folly/chrono/test/ClockTest.cpp +68 -0
- package/external/folly/folly/chrono/test/ConvTest.cpp +652 -0
- package/external/folly/folly/concurrency/AtomicSharedPtr.h +387 -0
- package/external/folly/folly/concurrency/BUCK +170 -0
- package/external/folly/folly/concurrency/CacheLocality.h +460 -0
- package/external/folly/folly/concurrency/ConcurrentHashMap.h +822 -0
- package/external/folly/folly/concurrency/CoreCachedSharedPtr.h +232 -0
- package/external/folly/folly/concurrency/DeadlockDetector.cpp +27 -0
- package/external/folly/folly/concurrency/DeadlockDetector.h +44 -0
- package/external/folly/folly/concurrency/DynamicBoundedQueue.h +751 -0
- package/external/folly/folly/concurrency/PriorityUnboundedQueueSet.h +207 -0
- package/external/folly/folly/concurrency/ProcessLocalUniqueId.cpp +46 -0
- package/external/folly/folly/concurrency/ProcessLocalUniqueId.h +38 -0
- package/external/folly/folly/concurrency/SingletonRelaxedCounter.h +325 -0
- package/external/folly/folly/concurrency/ThreadCachedSynchronized.h +227 -0
- package/external/folly/folly/concurrency/UnboundedQueue.h +891 -0
- package/external/folly/folly/concurrency/container/BUCK +77 -0
- package/external/folly/folly/concurrency/container/FlatCombiningPriorityQueue.h +426 -0
- package/external/folly/folly/concurrency/container/LockFreeRingBuffer.h +306 -0
- package/external/folly/folly/concurrency/container/RelaxedConcurrentPriorityQueue.h +1212 -0
- package/external/folly/folly/concurrency/container/SingleWriterFixedHashMap.h +322 -0
- package/external/folly/folly/concurrency/container/atomic_grow_array.h +564 -0
- package/external/folly/folly/concurrency/container/test/BUCK +75 -0
- package/external/folly/folly/concurrency/container/test/FlatCombiningPriorityQueueTest.cpp +570 -0
- package/external/folly/folly/concurrency/container/test/LockFreeRingBufferTest.cpp +276 -0
- package/external/folly/folly/concurrency/container/test/RelaxedConcurrentPriorityQueueTest.cpp +1570 -0
- package/external/folly/folly/concurrency/container/test/SingleWriterFixedHashMapTest.cpp +401 -0
- package/external/folly/folly/concurrency/container/test/atomic_grow_array_test.cpp +187 -0
- package/external/folly/folly/concurrency/detail/AtomicSharedPtr-detail.h +212 -0
- package/external/folly/folly/concurrency/detail/ConcurrentHashMap-detail.h +1911 -0
- package/external/folly/folly/concurrency/memory/AtomicReadMostlyMainPtr.cpp +43 -0
- package/external/folly/folly/concurrency/memory/AtomicReadMostlyMainPtr.h +190 -0
- package/external/folly/folly/concurrency/memory/BUCK +53 -0
- package/external/folly/folly/concurrency/memory/PrimaryPtr.h +338 -0
- package/external/folly/folly/concurrency/memory/ReadMostlySharedPtr.h +511 -0
- package/external/folly/folly/concurrency/memory/TLRefCount.h +228 -0
- package/external/folly/folly/concurrency/memory/test/AtomicReadMostlyMainPtrBenchmark.cpp +56 -0
- package/external/folly/folly/concurrency/memory/test/AtomicReadMostlyMainPtrTest.cpp +454 -0
- package/external/folly/folly/concurrency/memory/test/BUCK +95 -0
- package/external/folly/folly/concurrency/memory/test/PrimaryPtrTest.cpp +303 -0
- package/external/folly/folly/concurrency/memory/test/ReadMostlySharedPtrBenchmark.cpp +138 -0
- package/external/folly/folly/concurrency/memory/test/ReadMostlySharedPtrStressTest.cpp +75 -0
- package/external/folly/folly/concurrency/memory/test/ReadMostlySharedPtrTest.cpp +378 -0
- package/external/folly/folly/concurrency/memory/test/RefCountBenchmark.cpp +90 -0
- package/external/folly/folly/concurrency/memory/test/RefCountTest.cpp +168 -0
- package/external/folly/folly/concurrency/test/AtomicSharedPtrCounted.h +156 -0
- package/external/folly/folly/concurrency/test/AtomicSharedPtrPerformance.cpp +255 -0
- package/external/folly/folly/concurrency/test/AtomicSharedPtrTest.cpp +257 -0
- package/external/folly/folly/concurrency/test/BUCK +229 -0
- package/external/folly/folly/concurrency/test/CacheLocalityBenchmark.cpp +392 -0
- package/external/folly/folly/concurrency/test/CacheLocalityTest.cpp +1229 -0
- package/external/folly/folly/concurrency/test/ConcurrentHashMapBench.cpp +260 -0
- package/external/folly/folly/concurrency/test/ConcurrentHashMapTest.cpp +1242 -0
- package/external/folly/folly/concurrency/test/CoreCachedSharedPtrTest.cpp +408 -0
- package/external/folly/folly/concurrency/test/DynamicBoundedQueueTest.cpp +984 -0
- package/external/folly/folly/concurrency/test/PriorityUnboundedQueueSetTest.cpp +73 -0
- package/external/folly/folly/concurrency/test/ProcessLocalUniqueIdTest.cpp +66 -0
- package/external/folly/folly/concurrency/test/SingletonRelaxedCounterBench.cpp +101 -0
- package/external/folly/folly/concurrency/test/SingletonRelaxedCounterTest.cpp +185 -0
- package/external/folly/folly/concurrency/test/ThreadCachedSynchronizedBench.cpp +76 -0
- package/external/folly/folly/concurrency/test/ThreadCachedSynchronizedTest.cpp +93 -0
- package/external/folly/folly/concurrency/test/UnboundedQueueTest.cpp +1302 -0
- package/external/folly/folly/container/Access.h +57 -0
- package/external/folly/folly/container/Array.h +87 -0
- package/external/folly/folly/container/BUCK +353 -0
- package/external/folly/folly/container/BitIterator.h +203 -0
- package/external/folly/folly/container/Enumerate.h +162 -0
- package/external/folly/folly/container/EvictingCacheMap.h +730 -0
- package/external/folly/folly/container/F14.md +300 -0
- package/external/folly/folly/container/F14Map-fwd.h +113 -0
- package/external/folly/folly/container/F14Map.h +2108 -0
- package/external/folly/folly/container/F14Set-fwd.h +95 -0
- package/external/folly/folly/container/F14Set.h +1603 -0
- package/external/folly/folly/container/FBVector.h +1711 -0
- package/external/folly/folly/container/Foreach-inl.h +316 -0
- package/external/folly/folly/container/Foreach.h +209 -0
- package/external/folly/folly/container/HeterogeneousAccess-fwd.h +33 -0
- package/external/folly/folly/container/HeterogeneousAccess.h +171 -0
- package/external/folly/folly/container/IntrusiveHeap.h +268 -0
- package/external/folly/folly/container/IntrusiveList.h +131 -0
- package/external/folly/folly/container/Iterator.h +843 -0
- package/external/folly/folly/container/MapUtil.h +376 -0
- package/external/folly/folly/container/Merge.h +90 -0
- package/external/folly/folly/container/RegexMatchCache.cpp +521 -0
- package/external/folly/folly/container/RegexMatchCache.h +699 -0
- package/external/folly/folly/container/Reserve.h +109 -0
- package/external/folly/folly/container/SparseByteSet.h +123 -0
- package/external/folly/folly/container/View.h +81 -0
- package/external/folly/folly/container/WeightedEvictingCacheMap.h +651 -0
- package/external/folly/folly/container/detail/BUCK +115 -0
- package/external/folly/folly/container/detail/BitIteratorDetail.h +87 -0
- package/external/folly/folly/container/detail/F14Defaults.h +34 -0
- package/external/folly/folly/container/detail/F14IntrinsicsAvailability.h +67 -0
- package/external/folly/folly/container/detail/F14MapFallback.h +717 -0
- package/external/folly/folly/container/detail/F14Mask.h +235 -0
- package/external/folly/folly/container/detail/F14Policy.h +1523 -0
- package/external/folly/folly/container/detail/F14SetFallback.h +528 -0
- package/external/folly/folly/container/detail/F14Table.cpp +71 -0
- package/external/folly/folly/container/detail/F14Table.h +2680 -0
- package/external/folly/folly/container/detail/Util.h +303 -0
- package/external/folly/folly/container/detail/tape_detail.h +135 -0
- package/external/folly/folly/container/detail/test/BUCK +14 -0
- package/external/folly/folly/container/detail/test/F14DetailTest.cpp +47 -0
- package/external/folly/folly/container/heap_vector_types.h +1683 -0
- package/external/folly/folly/container/range_traits.h +81 -0
- package/external/folly/folly/container/small_vector.h +1476 -0
- package/external/folly/folly/container/sorted_vector_types.h +1652 -0
- package/external/folly/folly/container/span.h +408 -0
- package/external/folly/folly/container/tape.h +608 -0
- package/external/folly/folly/container/test/.clang-tidy +12 -0
- package/external/folly/folly/container/test/AccessTest.cpp +138 -0
- package/external/folly/folly/container/test/ArrayTest.cpp +84 -0
- package/external/folly/folly/container/test/BUCK +568 -0
- package/external/folly/folly/container/test/BitIteratorBench.cpp +112 -0
- package/external/folly/folly/container/test/BitIteratorTest.cpp +109 -0
- package/external/folly/folly/container/test/EnumerateTest.cpp +294 -0
- package/external/folly/folly/container/test/EvictingCacheMapBench.cpp +80 -0
- package/external/folly/folly/container/test/EvictingCacheMapTest.cpp +842 -0
- package/external/folly/folly/container/test/F14AsanSupportTest.cpp +143 -0
- package/external/folly/folly/container/test/F14FwdTest.cpp +37 -0
- package/external/folly/folly/container/test/F14InterprocessTest.cpp +404 -0
- package/external/folly/folly/container/test/F14MapTest.cpp +2543 -0
- package/external/folly/folly/container/test/F14PolicyTest.cpp +49 -0
- package/external/folly/folly/container/test/F14SetTest.cpp +1738 -0
- package/external/folly/folly/container/test/F14SmallOverheads.cpp +215 -0
- package/external/folly/folly/container/test/F14TestUtil.h +117 -0
- package/external/folly/folly/container/test/FBVectorBenchmark.cpp +380 -0
- package/external/folly/folly/container/test/FBVectorBenchmarks.cpp.h +100 -0
- package/external/folly/folly/container/test/FBVectorTest.cpp +326 -0
- package/external/folly/folly/container/test/FBVectorTests.cpp.h +304 -0
- package/external/folly/folly/container/test/ForeachBenchmark.cpp +388 -0
- package/external/folly/folly/container/test/ForeachTest.cpp +338 -0
- package/external/folly/folly/container/test/HashMapsBench.cpp +458 -0
- package/external/folly/folly/container/test/HeterogeneousAccessTest.cpp +242 -0
- package/external/folly/folly/container/test/IntrusiveHeapTest.cpp +262 -0
- package/external/folly/folly/container/test/IteratorTest.cpp +989 -0
- package/external/folly/folly/container/test/MapUtilTest.cpp +365 -0
- package/external/folly/folly/container/test/MergeTest.cpp +66 -0
- package/external/folly/folly/container/test/RegexMatchCacheTest.cpp +634 -0
- package/external/folly/folly/container/test/ReserveTest.cpp +173 -0
- package/external/folly/folly/container/test/SparseByteSetBenchmark.cpp +153 -0
- package/external/folly/folly/container/test/SparseByteSetTest.cpp +117 -0
- package/external/folly/folly/container/test/TrackingTypes.h +584 -0
- package/external/folly/folly/container/test/UtilTest.cpp +609 -0
- package/external/folly/folly/container/test/WeightedEvictingCacheMapTest.cpp +800 -0
- package/external/folly/folly/container/test/heap_vector_types_test.cpp +1774 -0
- package/external/folly/folly/container/test/range_traits_test.cpp +59 -0
- package/external/folly/folly/container/test/small_vector_test.cpp +1571 -0
- package/external/folly/folly/container/test/sorted_vector_test.cpp +1589 -0
- package/external/folly/folly/container/test/span_test.cpp +520 -0
- package/external/folly/folly/container/test/tape_bench.cpp +200 -0
- package/external/folly/folly/container/test/tape_test.cpp +590 -0
- package/external/folly/folly/defs.bzl +238 -0
- package/external/folly/folly/detail/AsyncTrace.cpp +36 -0
- package/external/folly/folly/detail/AsyncTrace.h +44 -0
- package/external/folly/folly/detail/AtomicHashUtils.h +42 -0
- package/external/folly/folly/detail/AtomicUnorderedMapUtils.h +80 -0
- package/external/folly/folly/detail/BUCK +406 -0
- package/external/folly/folly/detail/DiscriminatedPtrDetail.h +172 -0
- package/external/folly/folly/detail/FileUtilDetail.cpp +63 -0
- package/external/folly/folly/detail/FileUtilDetail.h +85 -0
- package/external/folly/folly/detail/FileUtilVectorDetail.h +81 -0
- package/external/folly/folly/detail/FingerprintPolynomial.h +132 -0
- package/external/folly/folly/detail/Futex-inl.h +123 -0
- package/external/folly/folly/detail/Futex.cpp +273 -0
- package/external/folly/folly/detail/Futex.h +109 -0
- package/external/folly/folly/detail/GroupVarintDetail.h +101 -0
- package/external/folly/folly/detail/IPAddress.cpp +37 -0
- package/external/folly/folly/detail/IPAddress.h +57 -0
- package/external/folly/folly/detail/IPAddressSource.h +278 -0
- package/external/folly/folly/detail/Iterators.h +156 -0
- package/external/folly/folly/detail/MPMCPipelineDetail.h +122 -0
- package/external/folly/folly/detail/MemoryIdler.cpp +233 -0
- package/external/folly/folly/detail/MemoryIdler.h +216 -0
- package/external/folly/folly/detail/PerfScoped.cpp +112 -0
- package/external/folly/folly/detail/PerfScoped.h +70 -0
- package/external/folly/folly/detail/PolyDetail.h +921 -0
- package/external/folly/folly/detail/RangeCommon.cpp +55 -0
- package/external/folly/folly/detail/RangeCommon.h +93 -0
- package/external/folly/folly/detail/RangeSse42.cpp +198 -0
- package/external/folly/folly/detail/RangeSse42.h +30 -0
- package/external/folly/folly/detail/SimpleSimdStringUtils.cpp +31 -0
- package/external/folly/folly/detail/SimpleSimdStringUtils.h +27 -0
- package/external/folly/folly/detail/SimpleSimdStringUtilsImpl.h +63 -0
- package/external/folly/folly/detail/Singleton.h +34 -0
- package/external/folly/folly/detail/SlowFingerprint.h +90 -0
- package/external/folly/folly/detail/SocketFastOpen.cpp +175 -0
- package/external/folly/folly/detail/SocketFastOpen.h +89 -0
- package/external/folly/folly/detail/SplitStringSimd.cpp +84 -0
- package/external/folly/folly/detail/SplitStringSimd.h +151 -0
- package/external/folly/folly/detail/SplitStringSimdImpl.h +149 -0
- package/external/folly/folly/detail/Sse.cpp +35 -0
- package/external/folly/folly/detail/Sse.h +45 -0
- package/external/folly/folly/detail/StaticSingletonManager.cpp +119 -0
- package/external/folly/folly/detail/StaticSingletonManager.h +298 -0
- package/external/folly/folly/detail/ThreadLocalDetail.cpp +492 -0
- package/external/folly/folly/detail/ThreadLocalDetail.h +800 -0
- package/external/folly/folly/detail/TrapOnAvx512.cpp +41 -0
- package/external/folly/folly/detail/TrapOnAvx512.h +21 -0
- package/external/folly/folly/detail/TurnSequencer.h +295 -0
- package/external/folly/folly/detail/TypeList.h +551 -0
- package/external/folly/folly/detail/UniqueInstance.cpp +136 -0
- package/external/folly/folly/detail/UniqueInstance.h +68 -0
- package/external/folly/folly/detail/base64_detail/BUCK +102 -0
- package/external/folly/folly/detail/base64_detail/Base64Api.cpp +40 -0
- package/external/folly/folly/detail/base64_detail/Base64Api.h +101 -0
- package/external/folly/folly/detail/base64_detail/Base64Common.h +80 -0
- package/external/folly/folly/detail/base64_detail/Base64Constants.h +79 -0
- package/external/folly/folly/detail/base64_detail/Base64HiddenConstants.h +129 -0
- package/external/folly/folly/detail/base64_detail/Base64SWAR.cpp +161 -0
- package/external/folly/folly/detail/base64_detail/Base64SWAR.h +32 -0
- package/external/folly/folly/detail/base64_detail/Base64Scalar.h +262 -0
- package/external/folly/folly/detail/base64_detail/Base64Simd.h +102 -0
- package/external/folly/folly/detail/base64_detail/Base64_SSE4_2.cpp +42 -0
- package/external/folly/folly/detail/base64_detail/Base64_SSE4_2.h +33 -0
- package/external/folly/folly/detail/base64_detail/Base64_SSE4_2_Platform.h +167 -0
- package/external/folly/folly/detail/base64_detail/README.md +392 -0
- package/external/folly/folly/detail/base64_detail/tests/BUCK +36 -0
- package/external/folly/folly/detail/base64_detail/tests/Base64AgainstScalarTest.cpp +141 -0
- package/external/folly/folly/detail/base64_detail/tests/Base64PlatformTest.cpp +273 -0
- package/external/folly/folly/detail/base64_detail/tests/Base64SpecialCasesTest.cpp +555 -0
- package/external/folly/folly/detail/test/AsyncTraceTest.cpp +43 -0
- package/external/folly/folly/detail/test/BUCK +118 -0
- package/external/folly/folly/detail/test/FileUtilDetailTest.cpp +56 -0
- package/external/folly/folly/detail/test/PerfScopedTest.cpp +107 -0
- package/external/folly/folly/detail/test/SimpleSimdStringUtilsTest.cpp +92 -0
- package/external/folly/folly/detail/test/SplitStringSimdTest.cpp +242 -0
- package/external/folly/folly/detail/test/StaticSingletonManagerTest.cpp +121 -0
- package/external/folly/folly/detail/test/ThreadLocalBenchmark.cpp +116 -0
- package/external/folly/folly/detail/test/ThreadLocalDetailTest.cpp +194 -0
- package/external/folly/folly/detail/test/TrapOnAvx512TestNegative.cpp +29 -0
- package/external/folly/folly/detail/test/UniqueInstanceTest.cpp +60 -0
- package/external/folly/folly/detail/thread_local_globals.cpp +69 -0
- package/external/folly/folly/detail/thread_local_globals.h +36 -0
- package/external/folly/folly/docs/AtomicHashMap.md +134 -0
- package/external/folly/folly/docs/Benchmark.md +310 -0
- package/external/folly/folly/docs/Conv.md +291 -0
- package/external/folly/folly/docs/Dynamic.md +220 -0
- package/external/folly/folly/docs/DynamicConverter.md +71 -0
- package/external/folly/folly/docs/Executors.md +63 -0
- package/external/folly/folly/docs/FBString.md +46 -0
- package/external/folly/folly/docs/FBVector.md +200 -0
- package/external/folly/folly/docs/Fbvector--graphical_solutions.png +0 -0
- package/external/folly/folly/docs/Format.md +177 -0
- package/external/folly/folly/docs/Function.md +92 -0
- package/external/folly/folly/docs/Futures.md +263 -0
- package/external/folly/folly/docs/GroupVarint.md +46 -0
- package/external/folly/folly/docs/Histogram.md +104 -0
- package/external/folly/folly/docs/MapUtils.md +80 -0
- package/external/folly/folly/docs/Overview.md +263 -0
- package/external/folly/folly/docs/PackedSyncPtr.md +77 -0
- package/external/folly/folly/docs/Poly.md +500 -0
- package/external/folly/folly/docs/ProducerConsumerQueue.md +82 -0
- package/external/folly/folly/docs/Rcu.md +218 -0
- package/external/folly/folly/docs/SmallLocks.md +24 -0
- package/external/folly/folly/docs/Synchronized.md +793 -0
- package/external/folly/folly/docs/ThreadCachedInt.md +98 -0
- package/external/folly/folly/docs/ThreadLocal.md +105 -0
- package/external/folly/folly/docs/Traits.md +161 -0
- package/external/folly/folly/docs/small_vector.md +64 -0
- package/external/folly/folly/docs/style.css +23 -0
- package/external/folly/folly/dynamic-inl.h +17 -0
- package/external/folly/folly/dynamic.h +17 -0
- package/external/folly/folly/folly_extended_library.bzl +28 -0
- package/external/folly/folly/functional/ApplyTuple.h +204 -0
- package/external/folly/folly/functional/BUCK +57 -0
- package/external/folly/folly/functional/Invoke.h +880 -0
- package/external/folly/folly/functional/Partial.h +130 -0
- package/external/folly/folly/functional/protocol.h +203 -0
- package/external/folly/folly/functional/test/ApplyTupleTest.cpp +549 -0
- package/external/folly/folly/functional/test/BUCK +57 -0
- package/external/folly/folly/functional/test/InvokeTest.cpp +483 -0
- package/external/folly/folly/functional/test/PartialTest.cpp +141 -0
- package/external/folly/folly/functional/test/protocol_test.cpp +177 -0
- package/external/folly/folly/functional/test/traits_test.cpp +551 -0
- package/external/folly/folly/functional/traits.h +675 -0
- package/external/folly/folly/hash/BUCK +86 -0
- package/external/folly/folly/hash/Checksum.cpp +275 -0
- package/external/folly/folly/hash/Checksum.h +94 -0
- package/external/folly/folly/hash/FarmHash.h +46 -0
- package/external/folly/folly/hash/Hash.h +1045 -0
- package/external/folly/folly/hash/MurmurHash.h +86 -0
- package/external/folly/folly/hash/SpookyHashV1.cpp +391 -0
- package/external/folly/folly/hash/SpookyHashV1.h +307 -0
- package/external/folly/folly/hash/SpookyHashV2.cpp +392 -0
- package/external/folly/folly/hash/SpookyHashV2.h +339 -0
- package/external/folly/folly/hash/detail/BUCK +26 -0
- package/external/folly/folly/hash/detail/ChecksumDetail.cpp +296 -0
- package/external/folly/folly/hash/detail/ChecksumDetail.h +137 -0
- package/external/folly/folly/hash/detail/Crc32CombineDetail.cpp +191 -0
- package/external/folly/folly/hash/detail/Crc32cDetail.cpp +303 -0
- package/external/folly/folly/hash/test/BUCK +132 -0
- package/external/folly/folly/hash/test/ChecksumBenchmark.cpp +91 -0
- package/external/folly/folly/hash/test/ChecksumTest.cpp +587 -0
- package/external/folly/folly/hash/test/FarmHashTest.cpp +41 -0
- package/external/folly/folly/hash/test/HashBenchmark.cpp +238 -0
- package/external/folly/folly/hash/test/HashTest.cpp +997 -0
- package/external/folly/folly/hash/test/MurmurHashTest.cpp +76 -0
- package/external/folly/folly/hash/test/SpookyHashV1Test.cpp +559 -0
- package/external/folly/folly/hash/test/SpookyHashV2Test.cpp +549 -0
- package/external/folly/folly/hash/test/traits_test.cpp +69 -0
- package/external/folly/folly/hash/traits.h +115 -0
- package/external/folly/folly/json/BUCK +155 -0
- package/external/folly/folly/json/DynamicConverter.h +464 -0
- package/external/folly/folly/json/DynamicParser-inl.h +316 -0
- package/external/folly/folly/json/DynamicParser.cpp +198 -0
- package/external/folly/folly/json/DynamicParser.h +394 -0
- package/external/folly/folly/json/JSONSchema.cpp +1030 -0
- package/external/folly/folly/json/JSONSchema.h +73 -0
- package/external/folly/folly/json/JsonMockUtil.h +73 -0
- package/external/folly/folly/json/JsonTestUtil.cpp +167 -0
- package/external/folly/folly/json/JsonTestUtil.h +88 -0
- package/external/folly/folly/json/bser/BUCK +24 -0
- package/external/folly/folly/json/bser/Bser.h +107 -0
- package/external/folly/folly/json/bser/Dump.cpp +253 -0
- package/external/folly/folly/json/bser/Load.cpp +246 -0
- package/external/folly/folly/json/bser/test/BUCK +14 -0
- package/external/folly/folly/json/bser/test/BserTest.cpp +149 -0
- package/external/folly/folly/json/dynamic.cpp +552 -0
- package/external/folly/folly/json/dynamic.h +1346 -0
- package/external/folly/folly/json/json.h +238 -0
- package/external/folly/folly/json/json_patch.cpp +325 -0
- package/external/folly/folly/json/json_patch.h +126 -0
- package/external/folly/folly/json/json_pointer.cpp +114 -0
- package/external/folly/folly/json/json_pointer.h +87 -0
- package/external/folly/folly/json/test/BUCK +147 -0
- package/external/folly/folly/json/test/DynamicBenchmark.cpp +146 -0
- package/external/folly/folly/json/test/DynamicConverterTest.cpp +518 -0
- package/external/folly/folly/json/test/DynamicOtherTest.cpp +344 -0
- package/external/folly/folly/json/test/DynamicParserTest.cpp +443 -0
- package/external/folly/folly/json/test/DynamicTest.cpp +1647 -0
- package/external/folly/folly/json/test/JSONSchemaTest.cpp +450 -0
- package/external/folly/folly/json/test/JsonBenchmark.cpp +264 -0
- package/external/folly/folly/json/test/JsonOtherTest.cpp +51 -0
- package/external/folly/folly/json/test/JsonTest.cpp +1153 -0
- package/external/folly/folly/json/test/JsonTestUtilTest.cpp +97 -0
- package/external/folly/folly/json/test/json_patch_test.cpp +361 -0
- package/external/folly/folly/json/test/json_pointer_test.cpp +58 -0
- package/external/folly/folly/json/tool/BUCK +13 -0
- package/external/folly/folly/json/tool/JSONSchemaTester.cpp +58 -0
- package/external/folly/folly/json.h +17 -0
- package/external/folly/folly/json_patch.h +17 -0
- package/external/folly/folly/json_pointer.h +17 -0
- package/external/folly/folly/lang/Access.h +29 -0
- package/external/folly/folly/lang/Align.h +240 -0
- package/external/folly/folly/lang/Aligned.h +92 -0
- package/external/folly/folly/lang/Assume.h +82 -0
- package/external/folly/folly/lang/BUCK +287 -0
- package/external/folly/folly/lang/Badge.h +108 -0
- package/external/folly/folly/lang/Bits.h +570 -0
- package/external/folly/folly/lang/BitsClass.h +312 -0
- package/external/folly/folly/lang/Builtin.h +74 -0
- package/external/folly/folly/lang/CArray.h +34 -0
- package/external/folly/folly/lang/CString.cpp +86 -0
- package/external/folly/folly/lang/CString.h +55 -0
- package/external/folly/folly/lang/Cast.h +51 -0
- package/external/folly/folly/lang/CheckedMath.h +253 -0
- package/external/folly/folly/lang/CustomizationPoint.h +58 -0
- package/external/folly/folly/lang/Exception.cpp +822 -0
- package/external/folly/folly/lang/Exception.h +716 -0
- package/external/folly/folly/lang/Extern.h +55 -0
- package/external/folly/folly/lang/Hint-inl.h +144 -0
- package/external/folly/folly/lang/Hint.h +238 -0
- package/external/folly/folly/lang/Keep.h +98 -0
- package/external/folly/folly/lang/New.h +124 -0
- package/external/folly/folly/lang/Ordering.h +140 -0
- package/external/folly/folly/lang/Pretty.h +159 -0
- package/external/folly/folly/lang/PropagateConst.h +413 -0
- package/external/folly/folly/lang/RValueReferenceWrapper.h +152 -0
- package/external/folly/folly/lang/SafeAssert.cpp +589 -0
- package/external/folly/folly/lang/StaticConst.h +33 -0
- package/external/folly/folly/lang/Thunk.h +100 -0
- package/external/folly/folly/lang/TypeInfo.h +58 -0
- package/external/folly/folly/lang/UncaughtExceptions.cpp +17 -0
- package/external/folly/folly/lang/UncaughtExceptions.h +19 -0
- package/external/folly/folly/lang/test/AlignTest.cpp +87 -0
- package/external/folly/folly/lang/test/AlignedTest.cpp +130 -0
- package/external/folly/folly/lang/test/BUCK +258 -0
- package/external/folly/folly/lang/test/BadgeTest.cpp +89 -0
- package/external/folly/folly/lang/test/BitsBenchmark.cpp +164 -0
- package/external/folly/folly/lang/test/BitsClassBenchmark.cpp +122 -0
- package/external/folly/folly/lang/test/BitsClassTest.cpp +379 -0
- package/external/folly/folly/lang/test/BitsTest.cpp +577 -0
- package/external/folly/folly/lang/test/CStringTest.cpp +60 -0
- package/external/folly/folly/lang/test/CastTest.cpp +47 -0
- package/external/folly/folly/lang/test/CheckedMathTest.cpp +394 -0
- package/external/folly/folly/lang/test/ExceptionBench.cpp +427 -0
- package/external/folly/folly/lang/test/ExceptionTest.cpp +413 -0
- package/external/folly/folly/lang/test/ExternTest.cpp +39 -0
- package/external/folly/folly/lang/test/HintTest.cpp +100 -0
- package/external/folly/folly/lang/test/NewTest.cpp +38 -0
- package/external/folly/folly/lang/test/OrderingTest.cpp +105 -0
- package/external/folly/folly/lang/test/PrettyTest.cpp +44 -0
- package/external/folly/folly/lang/test/PropagateConstTest.cpp +356 -0
- package/external/folly/folly/lang/test/RValueReferenceWrapperTest.cpp +85 -0
- package/external/folly/folly/lang/test/SafeAssertTest.cpp +75 -0
- package/external/folly/folly/lang/test/ThunkTest.cpp +105 -0
- package/external/folly/folly/lang/test/ToAsciiBench.cpp +466 -0
- package/external/folly/folly/lang/test/ToAsciiTest.cpp +266 -0
- package/external/folly/folly/lang/test/TypeInfoTest.cpp +56 -0
- package/external/folly/folly/memcpy.S +292 -0
- package/external/folly/folly/memcpy_select_aarch64.cpp +145 -0
- package/external/folly/folly/memory/Arena-inl.h +83 -0
- package/external/folly/folly/memory/Arena.h +325 -0
- package/external/folly/folly/memory/BUCK +191 -0
- package/external/folly/folly/memory/JemallocHugePageAllocator.cpp +449 -0
- package/external/folly/folly/memory/JemallocHugePageAllocator.h +105 -0
- package/external/folly/folly/memory/JemallocHugePageAllocatorTest.cpp +341 -0
- package/external/folly/folly/memory/JemallocNodumpAllocator.cpp +176 -0
- package/external/folly/folly/memory/JemallocNodumpAllocator.h +119 -0
- package/external/folly/folly/memory/JemallocNodumpAllocatorTest.cpp +61 -0
- package/external/folly/folly/memory/MallctlHelper.cpp +37 -0
- package/external/folly/folly/memory/MallctlHelper.h +167 -0
- package/external/folly/folly/memory/Malloc.h +551 -0
- package/external/folly/folly/memory/MemoryResource.h +57 -0
- package/external/folly/folly/memory/ReentrantAllocator.cpp +162 -0
- package/external/folly/folly/memory/ReentrantAllocator.h +261 -0
- package/external/folly/folly/memory/SanitizeAddress.cpp +75 -0
- package/external/folly/folly/memory/SanitizeAddress.h +117 -0
- package/external/folly/folly/memory/SanitizeLeak.cpp +119 -0
- package/external/folly/folly/memory/SanitizeLeak.h +108 -0
- package/external/folly/folly/memory/ThreadCachedArena.cpp +53 -0
- package/external/folly/folly/memory/ThreadCachedArena.h +90 -0
- package/external/folly/folly/memory/UninitializedMemoryHacks.h +426 -0
- package/external/folly/folly/memory/detail/BUCK +10 -0
- package/external/folly/folly/memory/detail/MallocImpl.cpp +52 -0
- package/external/folly/folly/memory/detail/MallocImpl.h +97 -0
- package/external/folly/folly/memory/not_null-inl.h +522 -0
- package/external/folly/folly/memory/not_null.h +449 -0
- package/external/folly/folly/memory/test/ArenaTest.cpp +354 -0
- package/external/folly/folly/memory/test/BUCK +146 -0
- package/external/folly/folly/memory/test/MallctlHelperTest.cpp +169 -0
- package/external/folly/folly/memory/test/MallocBenchmark.cpp +91 -0
- package/external/folly/folly/memory/test/MallocTest.cpp +78 -0
- package/external/folly/folly/memory/test/MemoryResourceTest.cpp +31 -0
- package/external/folly/folly/memory/test/ReentrantAllocatorTest.cpp +144 -0
- package/external/folly/folly/memory/test/SanitizeAddressTest.cpp +67 -0
- package/external/folly/folly/memory/test/SanitizeLeakTest.cpp +139 -0
- package/external/folly/folly/memory/test/ThreadCachedArenaTest.cpp +276 -0
- package/external/folly/folly/memory/test/UninitializedMemoryHacksODR.cpp +21 -0
- package/external/folly/folly/memory/test/UninitializedMemoryHacksTest.cpp +327 -0
- package/external/folly/folly/memory/test/not_null_test.cpp +608 -0
- package/external/folly/folly/memset.S +245 -0
- package/external/folly/folly/memset_select_aarch64.cpp +72 -0
- package/external/folly/folly/portability/Asm.h +50 -0
- package/external/folly/folly/portability/Atomic.h +31 -0
- package/external/folly/folly/portability/BUCK +456 -0
- package/external/folly/folly/portability/Builtins.cpp +31 -0
- package/external/folly/folly/portability/Builtins.h +161 -0
- package/external/folly/folly/portability/Config.h +43 -0
- package/external/folly/folly/portability/Constexpr.h +145 -0
- package/external/folly/folly/portability/Dirent.cpp +140 -0
- package/external/folly/folly/portability/Dirent.h +41 -0
- package/external/folly/folly/portability/Event.h +44 -0
- package/external/folly/folly/portability/Fcntl.cpp +120 -0
- package/external/folly/folly/portability/Fcntl.h +67 -0
- package/external/folly/folly/portability/Filesystem.cpp +67 -0
- package/external/folly/folly/portability/Filesystem.h +114 -0
- package/external/folly/folly/portability/FmtCompile.h +40 -0
- package/external/folly/folly/portability/GFlags.h +139 -0
- package/external/folly/folly/portability/GMock.h +35 -0
- package/external/folly/folly/portability/GTest.h +35 -0
- package/external/folly/folly/portability/IOVec.h +34 -0
- package/external/folly/folly/portability/Libgen.cpp +59 -0
- package/external/folly/folly/portability/Libgen.h +29 -0
- package/external/folly/folly/portability/Libunwind.h +21 -0
- package/external/folly/folly/portability/Malloc.cpp +31 -0
- package/external/folly/folly/portability/Malloc.h +53 -0
- package/external/folly/folly/portability/Math.h +90 -0
- package/external/folly/folly/portability/Memory.h +26 -0
- package/external/folly/folly/portability/OpenSSL.cpp +17 -0
- package/external/folly/folly/portability/OpenSSL.h +102 -0
- package/external/folly/folly/portability/PThread.cpp +697 -0
- package/external/folly/folly/portability/PThread.h +148 -0
- package/external/folly/folly/portability/README.md +21 -0
- package/external/folly/folly/portability/Sched.cpp +41 -0
- package/external/folly/folly/portability/Sched.h +45 -0
- package/external/folly/folly/portability/Sockets.cpp +245 -0
- package/external/folly/folly/portability/Sockets.h +155 -0
- package/external/folly/folly/portability/SourceLocation.h +49 -0
- package/external/folly/folly/portability/Stdio.cpp +77 -0
- package/external/folly/folly/portability/Stdio.h +32 -0
- package/external/folly/folly/portability/Stdlib.cpp +172 -0
- package/external/folly/folly/portability/Stdlib.h +64 -0
- package/external/folly/folly/portability/String.cpp +53 -0
- package/external/folly/folly/portability/String.h +39 -0
- package/external/folly/folly/portability/SysFile.cpp +46 -0
- package/external/folly/folly/portability/SysFile.h +27 -0
- package/external/folly/folly/portability/SysMembarrier.cpp +104 -0
- package/external/folly/folly/portability/SysMembarrier.h +26 -0
- package/external/folly/folly/portability/SysMman.cpp +242 -0
- package/external/folly/folly/portability/SysMman.h +68 -0
- package/external/folly/folly/portability/SysResource.cpp +108 -0
- package/external/folly/folly/portability/SysResource.h +71 -0
- package/external/folly/folly/portability/SysStat.cpp +66 -0
- package/external/folly/folly/portability/SysStat.h +52 -0
- package/external/folly/folly/portability/SysSyscall.h +73 -0
- package/external/folly/folly/portability/SysTime.cpp +62 -0
- package/external/folly/folly/portability/SysTime.h +50 -0
- package/external/folly/folly/portability/SysTypes.h +44 -0
- package/external/folly/folly/portability/SysUio.cpp +179 -0
- package/external/folly/folly/portability/SysUio.h +51 -0
- package/external/folly/folly/portability/Syslog.h +39 -0
- package/external/folly/folly/portability/Time.cpp +357 -0
- package/external/folly/folly/portability/Time.h +74 -0
- package/external/folly/folly/portability/Unistd.h +111 -0
- package/external/folly/folly/portability/Windows.h +108 -0
- package/external/folly/folly/portability/openat2.c +30 -0
- package/external/folly/folly/portability/openat2.h +39 -0
- package/external/folly/folly/portability/test/BUCK +59 -0
- package/external/folly/folly/portability/test/ConstexprTest.cpp +102 -0
- package/external/folly/folly/portability/test/FilesystemTest.cpp +35 -0
- package/external/folly/folly/portability/test/LibgenTest.cpp +35 -0
- package/external/folly/folly/portability/test/OpenSSLPortabilityTest.cpp +108 -0
- package/external/folly/folly/portability/test/PThreadTest.cpp +80 -0
- package/external/folly/folly/portability/test/TimeTest.cpp +90 -0
- package/external/folly/folly/small_vector.h +17 -0
- package/external/folly/folly/somerge_defs.bzl +399 -0
- package/external/folly/folly/sorted_vector_types.h +17 -0
- package/external/folly/folly/stop_watch.h +317 -0
- package/external/folly/folly/synchronization/AsymmetricThreadFence.cpp +91 -0
- package/external/folly/folly/synchronization/AsymmetricThreadFence.h +60 -0
- package/external/folly/folly/synchronization/AtomicNotification-inl.h +146 -0
- package/external/folly/folly/synchronization/AtomicNotification.cpp +34 -0
- package/external/folly/folly/synchronization/AtomicNotification.h +117 -0
- package/external/folly/folly/synchronization/AtomicRef.h +181 -0
- package/external/folly/folly/synchronization/AtomicStruct.h +150 -0
- package/external/folly/folly/synchronization/AtomicUtil-inl.h +482 -0
- package/external/folly/folly/synchronization/AtomicUtil.h +179 -0
- package/external/folly/folly/synchronization/BUCK +418 -0
- package/external/folly/folly/synchronization/Baton.h +419 -0
- package/external/folly/folly/synchronization/CallOnce.h +263 -0
- package/external/folly/folly/synchronization/DelayedInit.h +179 -0
- package/external/folly/folly/synchronization/DistributedMutex-inl.h +1744 -0
- package/external/folly/folly/synchronization/DistributedMutex.cpp +27 -0
- package/external/folly/folly/synchronization/DistributedMutex.h +342 -0
- package/external/folly/folly/synchronization/EventCount.h +200 -0
- package/external/folly/folly/synchronization/FlatCombining.h +629 -0
- package/external/folly/folly/synchronization/Hazptr-fwd.h +217 -0
- package/external/folly/folly/synchronization/Hazptr.cpp +36 -0
- package/external/folly/folly/synchronization/Hazptr.h +209 -0
- package/external/folly/folly/synchronization/HazptrDomain.cpp +68 -0
- package/external/folly/folly/synchronization/HazptrDomain.h +832 -0
- package/external/folly/folly/synchronization/HazptrHolder.h +431 -0
- package/external/folly/folly/synchronization/HazptrObj.h +533 -0
- package/external/folly/folly/synchronization/HazptrObjLinked.h +315 -0
- package/external/folly/folly/synchronization/HazptrRec.h +68 -0
- package/external/folly/folly/synchronization/HazptrThrLocal.h +180 -0
- package/external/folly/folly/synchronization/HazptrThreadPoolExecutor.cpp +46 -0
- package/external/folly/folly/synchronization/HazptrThreadPoolExecutor.h +25 -0
- package/external/folly/folly/synchronization/Latch.h +160 -0
- package/external/folly/folly/synchronization/LifoSem.h +767 -0
- package/external/folly/folly/synchronization/Lock.h +887 -0
- package/external/folly/folly/synchronization/MicroSpinLock.h +154 -0
- package/external/folly/folly/synchronization/NativeSemaphore.h +187 -0
- package/external/folly/folly/synchronization/ParkingLot.cpp +37 -0
- package/external/folly/folly/synchronization/ParkingLot.h +330 -0
- package/external/folly/folly/synchronization/PicoSpinLock.h +167 -0
- package/external/folly/folly/synchronization/RWSpinLock.h +549 -0
- package/external/folly/folly/synchronization/Rcu.cpp +26 -0
- package/external/folly/folly/synchronization/Rcu.h +553 -0
- package/external/folly/folly/synchronization/RelaxedAtomic.h +336 -0
- package/external/folly/folly/synchronization/SanitizeThread.cpp +141 -0
- package/external/folly/folly/synchronization/SanitizeThread.h +166 -0
- package/external/folly/folly/synchronization/SaturatingSemaphore.h +324 -0
- package/external/folly/folly/synchronization/SmallLocks.h +36 -0
- package/external/folly/folly/synchronization/ThrottledLifoSem.h +362 -0
- package/external/folly/folly/synchronization/WaitOptions.cpp +25 -0
- package/external/folly/folly/synchronization/WaitOptions.h +75 -0
- package/external/folly/folly/synchronization/detail/AtomicUtils.h +59 -0
- package/external/folly/folly/synchronization/detail/BUCK +104 -0
- package/external/folly/folly/synchronization/detail/Hardware.cpp +192 -0
- package/external/folly/folly/synchronization/detail/Hardware.h +75 -0
- package/external/folly/folly/synchronization/detail/HazptrUtils.h +339 -0
- package/external/folly/folly/synchronization/detail/InlineFunctionRef.h +229 -0
- package/external/folly/folly/synchronization/detail/Sleeper.cpp +27 -0
- package/external/folly/folly/synchronization/detail/Sleeper.h +62 -0
- package/external/folly/folly/synchronization/detail/Spin.h +96 -0
- package/external/folly/folly/synchronization/detail/ThreadCachedLists.h +174 -0
- package/external/folly/folly/synchronization/detail/ThreadCachedReaders.h +189 -0
- package/external/folly/folly/synchronization/detail/ThreadCachedTag.h +26 -0
- package/external/folly/folly/synchronization/detail/test/BUCK +28 -0
- package/external/folly/folly/synchronization/detail/test/HardwareTest.cpp +74 -0
- package/external/folly/folly/synchronization/detail/test/InlineFunctionRefTest.cpp +286 -0
- package/external/folly/folly/synchronization/example/BUCK +27 -0
- package/external/folly/folly/synchronization/example/HazptrLockFreeLIFO.h +88 -0
- package/external/folly/folly/synchronization/example/HazptrSWMRSet.h +133 -0
- package/external/folly/folly/synchronization/example/HazptrWideCAS.h +62 -0
- package/external/folly/folly/synchronization/test/AtomicNotificationTest.cpp +236 -0
- package/external/folly/folly/synchronization/test/AtomicRefTest.cpp +170 -0
- package/external/folly/folly/synchronization/test/AtomicStructTest.cpp +65 -0
- package/external/folly/folly/synchronization/test/AtomicUtilBench.cpp +457 -0
- package/external/folly/folly/synchronization/test/AtomicUtilTest.cpp +650 -0
- package/external/folly/folly/synchronization/test/BUCK +495 -0
- package/external/folly/folly/synchronization/test/Barrier.h +52 -0
- package/external/folly/folly/synchronization/test/BarrierTest.cpp +56 -0
- package/external/folly/folly/synchronization/test/BatonBenchmark.cpp +77 -0
- package/external/folly/folly/synchronization/test/BatonTest.cpp +164 -0
- package/external/folly/folly/synchronization/test/BatonTestHelpers.h +118 -0
- package/external/folly/folly/synchronization/test/CallOnceBenchmark.cpp +72 -0
- package/external/folly/folly/synchronization/test/CallOnceTest.cpp +153 -0
- package/external/folly/folly/synchronization/test/DelayedInitTest.cpp +281 -0
- package/external/folly/folly/synchronization/test/DistributedMutexTest.cpp +2074 -0
- package/external/folly/folly/synchronization/test/EventCountTest.cpp +124 -0
- package/external/folly/folly/synchronization/test/FlatCombiningBenchmark.cpp +1789 -0
- package/external/folly/folly/synchronization/test/FlatCombiningExamples.h +222 -0
- package/external/folly/folly/synchronization/test/FlatCombiningTest.cpp +121 -0
- package/external/folly/folly/synchronization/test/FlatCombiningTestHelpers.h +227 -0
- package/external/folly/folly/synchronization/test/HazptrTest.cpp +1689 -0
- package/external/folly/folly/synchronization/test/LatchTest.cpp +224 -0
- package/external/folly/folly/synchronization/test/LifoSemBench.cpp +185 -0
- package/external/folly/folly/synchronization/test/LifoSemTests.cpp +353 -0
- package/external/folly/folly/synchronization/test/LockTest.cpp +1239 -0
- package/external/folly/folly/synchronization/test/NativeSemaphoreTest.cpp +37 -0
- package/external/folly/folly/synchronization/test/ParkingLotBenchmark.cpp +239 -0
- package/external/folly/folly/synchronization/test/ParkingLotTest.cpp +170 -0
- package/external/folly/folly/synchronization/test/RWSpinLockTest.cpp +235 -0
- package/external/folly/folly/synchronization/test/RcuBench.cpp +66 -0
- package/external/folly/folly/synchronization/test/RcuTest.cpp +330 -0
- package/external/folly/folly/synchronization/test/RelaxedAtomicTest.cpp +389 -0
- package/external/folly/folly/synchronization/test/SaturatingSemaphoreTest.cpp +166 -0
- package/external/folly/folly/synchronization/test/Semaphore.h +242 -0
- package/external/folly/folly/synchronization/test/SemaphoreTest.cpp +271 -0
- package/external/folly/folly/synchronization/test/SmallLocksBenchmark.cpp +1296 -0
- package/external/folly/folly/synchronization/test/SmallLocksTest.cpp +510 -0
- package/external/folly/folly/synchronization/test/ThreadCachedEpochBench.h +67 -0
- package/external/folly/folly/synchronization/test/ThreadCachedReadersBench.cpp +42 -0
- package/external/folly/folly/synchronization/test/ThreadCachedReadersTest.cpp +52 -0
- package/external/folly/folly/synchronization/test/ThrottledLifoSemTest.cpp +243 -0
- package/external/folly/folly/system/AtFork.cpp +205 -0
- package/external/folly/folly/system/AtFork.h +116 -0
- package/external/folly/folly/system/AuxVector.h +198 -0
- package/external/folly/folly/system/BUCK +144 -0
- package/external/folly/folly/system/EnvUtil.cpp +93 -0
- package/external/folly/folly/system/EnvUtil.h +113 -0
- package/external/folly/folly/system/HardwareConcurrency.cpp +39 -0
- package/external/folly/folly/system/HardwareConcurrency.h +23 -0
- package/external/folly/folly/system/MemoryMapping.cpp +477 -0
- package/external/folly/folly/system/MemoryMapping.h +287 -0
- package/external/folly/folly/system/Pid.cpp +87 -0
- package/external/folly/folly/system/Pid.h +34 -0
- package/external/folly/folly/system/Shell.cpp +33 -0
- package/external/folly/folly/system/Shell.h +93 -0
- package/external/folly/folly/system/ThreadId.cpp +89 -0
- package/external/folly/folly/system/ThreadId.h +62 -0
- package/external/folly/folly/system/ThreadName.cpp +330 -0
- package/external/folly/folly/system/ThreadName.h +72 -0
- package/external/folly/folly/system/test/AtForkTest.cpp +309 -0
- package/external/folly/folly/system/test/AuxVectorTest.cpp +55 -0
- package/external/folly/folly/system/test/BUCK +120 -0
- package/external/folly/folly/system/test/EnvUtilSubprocess.cpp +26 -0
- package/external/folly/folly/system/test/EnvUtilTest.cpp +197 -0
- package/external/folly/folly/system/test/MemoryMappingTest.cpp +179 -0
- package/external/folly/folly/system/test/PidTest.cpp +46 -0
- package/external/folly/folly/system/test/ShellTest.cpp +66 -0
- package/external/folly/folly/system/test/ThreadIdTest.cpp +114 -0
- package/external/folly/folly/system/test/ThreadNameTest.cpp +85 -0
- package/external/folly/folly.vcxitems +164 -0
- package/external/folly/static/logo.svg +1 -0
- package/external/folly/sync-config.json +8 -0
- package/package.json +6 -6
- package/template/cpp-lib/proj/MyLib.sln +0 -33
- package/template/cs-lib/proj/MyLib.sln +0 -33
- package/templates/cpp-app/windows/MyApp.sln +0 -33
- package/templates/cpp-lib/example/metro.config.js +30 -4
- package/templates/cpp-lib/windows/MyLib.sln +0 -33
- package/Folly/Folly.vcxproj +0 -378
- package/Folly/Folly.vcxproj.filters +0 -558
- package/fmt/fmt.vcxproj +0 -153
- package/fmt/fmt.vcxproj.filters +0 -59
- package/fmt/pch.cpp +0 -4
- package/fmt/pch.h +0 -2
- /package/{fmt → external/fmt}/cgmanifest.json +0 -0
- /package/{Folly → external/folly}/Folly.natvis +0 -0
- /package/{Folly → external/folly}/cgmanifest.json +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/ConstexprMath.h +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/Conv.cpp +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/chrono/Hardware.h +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/concurrency/CacheLocality.cpp +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/json/dynamic-inl.h +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/json/json.cpp +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/lang/SafeAssert.h +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/lang/ToAscii.cpp +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/lang/ToAscii.h +0 -0
- /package/{Folly/TEMP_UntilFollyUpdate → external/folly/folly}/portability/Unistd.cpp +0 -0
|
@@ -0,0 +1,997 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
#include <folly/hash/Hash.h>
|
|
18
|
+
|
|
19
|
+
#include <stdint.h>
|
|
20
|
+
|
|
21
|
+
#include <random>
|
|
22
|
+
#include <unordered_map>
|
|
23
|
+
#include <unordered_set>
|
|
24
|
+
#include <utility>
|
|
25
|
+
|
|
26
|
+
#include <folly/Conv.h>
|
|
27
|
+
#include <folly/MapUtil.h>
|
|
28
|
+
#include <folly/Random.h>
|
|
29
|
+
#include <folly/Range.h>
|
|
30
|
+
#include <folly/portability/GTest.h>
|
|
31
|
+
|
|
32
|
+
using namespace folly::hash;
|
|
33
|
+
|
|
34
|
+
TEST(Hash, Test128To64) {
|
|
35
|
+
constexpr uint64_t upper = 12345678910111213ULL;
|
|
36
|
+
constexpr uint64_t lower = 141516171819202122ULL;
|
|
37
|
+
EXPECT_NE(hash_128_to_64(upper, lower), hash_128_to_64(lower, upper));
|
|
38
|
+
EXPECT_EQ(
|
|
39
|
+
commutative_hash_128_to_64(upper, lower),
|
|
40
|
+
commutative_hash_128_to_64(lower, upper));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
TEST(Hash, Fnv32) {
|
|
44
|
+
const char* s1 = "hello, world!";
|
|
45
|
+
const uint32_t s1_res = 3605494790UL;
|
|
46
|
+
EXPECT_EQ(fnv32(s1), s1_res);
|
|
47
|
+
EXPECT_EQ(fnv32(s1), fnv32_buf(s1, strlen(s1)));
|
|
48
|
+
|
|
49
|
+
const char* s2 = "monkeys! m0nk3yz! ev3ry \\/\\/here~~~~";
|
|
50
|
+
const uint32_t s2_res = 1270448334UL;
|
|
51
|
+
EXPECT_EQ(fnv32(s2), s2_res);
|
|
52
|
+
EXPECT_EQ(fnv32(s2), fnv32_buf(s2, strlen(s2)));
|
|
53
|
+
|
|
54
|
+
const char* s3 = "";
|
|
55
|
+
const uint32_t s3_res = 2166136261UL;
|
|
56
|
+
EXPECT_EQ(fnv32(s3), s3_res);
|
|
57
|
+
EXPECT_EQ(fnv32(s3), fnv32_buf(s3, strlen(s3)));
|
|
58
|
+
|
|
59
|
+
const uint8_t s4_data[] = {0xFF, 0xFF, 0xFF, 0x00};
|
|
60
|
+
const char* s4 = reinterpret_cast<const char*>(s4_data);
|
|
61
|
+
const uint32_t s4_res = 2420936562UL;
|
|
62
|
+
EXPECT_EQ(fnv32(s4), s4_res);
|
|
63
|
+
EXPECT_EQ(fnv32(s4), fnv32_buf(s4, strlen(s4)));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
TEST(Hash, Fnv64) {
|
|
67
|
+
const char* s1 = "hello, world!";
|
|
68
|
+
const uint64_t s1_res = 13991426986746681734ULL;
|
|
69
|
+
EXPECT_EQ(fnv64(s1), s1_res);
|
|
70
|
+
EXPECT_EQ(fnv64(s1), fnv64_buf(s1, strlen(s1)));
|
|
71
|
+
|
|
72
|
+
const char* s2 = "monkeys! m0nk3yz! ev3ry \\/\\/here~~~~";
|
|
73
|
+
const uint64_t s2_res = 6091394665637302478ULL;
|
|
74
|
+
EXPECT_EQ(fnv64(s2), s2_res);
|
|
75
|
+
EXPECT_EQ(fnv64(s2), fnv64_buf(s2, strlen(s2)));
|
|
76
|
+
|
|
77
|
+
const char* s3 = "";
|
|
78
|
+
const uint64_t s3_res = 14695981039346656037ULL;
|
|
79
|
+
EXPECT_EQ(fnv64(s3), s3_res);
|
|
80
|
+
EXPECT_EQ(fnv64(s3), fnv64_buf(s3, strlen(s3)));
|
|
81
|
+
|
|
82
|
+
const uint8_t s4_data[] = {0xFF, 0xFF, 0xFF, 0x00};
|
|
83
|
+
const char* s4 = reinterpret_cast<const char*>(s4_data);
|
|
84
|
+
const uint64_t s4_res = 2787597222566293202ULL;
|
|
85
|
+
EXPECT_EQ(fnv64(s4), s4_res);
|
|
86
|
+
EXPECT_EQ(fnv64(s4), fnv64_buf(s4, strlen(s4)));
|
|
87
|
+
|
|
88
|
+
// note: Use fnv64_buf to make a single hash value from multiple
|
|
89
|
+
// fields/datatypes.
|
|
90
|
+
const char* t4_a = "E Pluribus";
|
|
91
|
+
int64_t t4_b = 0xF1E2D3C4B5A69788;
|
|
92
|
+
int32_t t4_c = 0xAB12CD34;
|
|
93
|
+
const char* t4_d = "Unum";
|
|
94
|
+
uint64_t t4_res = 15571330457339273965ULL;
|
|
95
|
+
uint64_t t4_hash1 = fnv64_buf(t4_a, strlen(t4_a));
|
|
96
|
+
uint64_t t4_hash2 =
|
|
97
|
+
fnv64_buf(reinterpret_cast<void*>(&t4_b), sizeof(int64_t), t4_hash1);
|
|
98
|
+
uint64_t t4_hash3 =
|
|
99
|
+
fnv64_buf(reinterpret_cast<void*>(&t4_c), sizeof(int32_t), t4_hash2);
|
|
100
|
+
uint64_t t4_hash4 = fnv64_buf(t4_d, strlen(t4_d), t4_hash3);
|
|
101
|
+
EXPECT_EQ(t4_hash4, t4_res);
|
|
102
|
+
// note: These are probabalistic, not determinate, but c'mon.
|
|
103
|
+
// These hash values should be different, or something's not
|
|
104
|
+
// working.
|
|
105
|
+
EXPECT_NE(t4_hash1, t4_hash4);
|
|
106
|
+
EXPECT_NE(t4_hash2, t4_hash4);
|
|
107
|
+
EXPECT_NE(t4_hash3, t4_hash4);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
TEST(Hash, Hsieh32) {
|
|
111
|
+
const char* s1 = "hello, world!";
|
|
112
|
+
const uint32_t s1_res = 2918802987ul;
|
|
113
|
+
EXPECT_EQ(hsieh_hash32(s1), s1_res);
|
|
114
|
+
EXPECT_EQ(hsieh_hash32(s1), hsieh_hash32_buf(s1, strlen(s1)));
|
|
115
|
+
|
|
116
|
+
const char* s2 = "monkeys! m0nk3yz! ev3ry \\/\\/here~~~~";
|
|
117
|
+
const uint32_t s2_res = 47373213ul;
|
|
118
|
+
EXPECT_EQ(hsieh_hash32(s2), s2_res);
|
|
119
|
+
EXPECT_EQ(hsieh_hash32(s2), hsieh_hash32_buf(s2, strlen(s2)));
|
|
120
|
+
|
|
121
|
+
const char* s3 = "";
|
|
122
|
+
const uint32_t s3_res = 0;
|
|
123
|
+
EXPECT_EQ(hsieh_hash32(s3), s3_res);
|
|
124
|
+
EXPECT_EQ(hsieh_hash32(s3), hsieh_hash32_buf(s3, strlen(s3)));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
TEST(Hash, TWangMix64) {
|
|
128
|
+
uint64_t i1 = 0x78a87873e2d31dafULL;
|
|
129
|
+
uint64_t i1_res = 3389151152926383528ULL;
|
|
130
|
+
EXPECT_EQ(i1_res, twang_mix64(i1));
|
|
131
|
+
EXPECT_EQ(i1, twang_unmix64(i1_res));
|
|
132
|
+
|
|
133
|
+
uint64_t i2 = 0x0123456789abcdefULL;
|
|
134
|
+
uint64_t i2_res = 3061460455458984563ull;
|
|
135
|
+
EXPECT_EQ(i2_res, twang_mix64(i2));
|
|
136
|
+
EXPECT_EQ(i2, twang_unmix64(i2_res));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
namespace {
|
|
140
|
+
void checkTWang(uint64_t r) {
|
|
141
|
+
uint64_t result = twang_mix64(r);
|
|
142
|
+
EXPECT_EQ(r, twang_unmix64(result));
|
|
143
|
+
}
|
|
144
|
+
} // namespace
|
|
145
|
+
|
|
146
|
+
TEST(Hash, TWangUnmix64) {
|
|
147
|
+
// We'll try (1 << i), (1 << i) + 1, (1 << i) - 1
|
|
148
|
+
for (int i = 1; i < 64; i++) {
|
|
149
|
+
checkTWang((uint64_t(1) << i) - 1);
|
|
150
|
+
checkTWang(uint64_t(1) << i);
|
|
151
|
+
checkTWang((uint64_t(1) << i) + 1);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
TEST(Hash, TWang32From64) {
|
|
156
|
+
uint64_t i1 = 0x78a87873e2d31dafULL;
|
|
157
|
+
uint32_t i1_res = 1525586863ul;
|
|
158
|
+
EXPECT_EQ(twang_32from64(i1), i1_res);
|
|
159
|
+
|
|
160
|
+
uint64_t i2 = 0x0123456789abcdefULL;
|
|
161
|
+
uint32_t i2_res = 2918899159ul;
|
|
162
|
+
EXPECT_EQ(twang_32from64(i2), i2_res);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
TEST(Hash, JenkinsRevMix32) {
|
|
166
|
+
uint32_t i1 = 3805486511ul;
|
|
167
|
+
uint32_t i1_res = 381808021ul;
|
|
168
|
+
EXPECT_EQ(i1_res, jenkins_rev_mix32(i1));
|
|
169
|
+
EXPECT_EQ(i1, jenkins_rev_unmix32(i1_res));
|
|
170
|
+
|
|
171
|
+
uint32_t i2 = 2309737967ul;
|
|
172
|
+
uint32_t i2_res = 1834777923ul;
|
|
173
|
+
EXPECT_EQ(i2_res, jenkins_rev_mix32(i2));
|
|
174
|
+
EXPECT_EQ(i2, jenkins_rev_unmix32(i2_res));
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
namespace {
|
|
178
|
+
void checkJenkins(uint32_t r) {
|
|
179
|
+
uint32_t result = jenkins_rev_mix32(r);
|
|
180
|
+
EXPECT_EQ(r, jenkins_rev_unmix32(result));
|
|
181
|
+
}
|
|
182
|
+
} // namespace
|
|
183
|
+
|
|
184
|
+
TEST(Hash, JenkinsRevUnmix32) {
|
|
185
|
+
// We'll try (1 << i), (1 << i) + 1, (1 << i) - 1
|
|
186
|
+
for (int i = 1; i < 32; i++) {
|
|
187
|
+
checkJenkins((1U << i) - 1);
|
|
188
|
+
checkJenkins(1U << i);
|
|
189
|
+
checkJenkins((1U << i) + 1);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
TEST(Hash, hasher) {
|
|
194
|
+
// Basically just confirms that things compile ok.
|
|
195
|
+
std::unordered_map<int32_t, int32_t, folly::hasher<int32_t>> m;
|
|
196
|
+
m.insert(std::make_pair(4, 5));
|
|
197
|
+
EXPECT_EQ(get_default(m, 4), 5);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
TEST(Hash, integralTypes) {
|
|
201
|
+
// Basically just confirms that things compile ok.
|
|
202
|
+
std::unordered_set<size_t> hashes;
|
|
203
|
+
folly::Hash hasher;
|
|
204
|
+
hashes.insert(hasher((char)1));
|
|
205
|
+
hashes.insert(hasher((signed char)2));
|
|
206
|
+
hashes.insert(hasher((unsigned char)3));
|
|
207
|
+
hashes.insert(hasher((short)4));
|
|
208
|
+
hashes.insert(hasher((signed short)5));
|
|
209
|
+
hashes.insert(hasher((unsigned short)6));
|
|
210
|
+
hashes.insert(hasher((int)7));
|
|
211
|
+
hashes.insert(hasher((signed int)8));
|
|
212
|
+
hashes.insert(hasher((unsigned int)9));
|
|
213
|
+
hashes.insert(hasher((long)10));
|
|
214
|
+
hashes.insert(hasher((signed long)11));
|
|
215
|
+
hashes.insert(hasher((unsigned long)12));
|
|
216
|
+
hashes.insert(hasher((long long)13));
|
|
217
|
+
hashes.insert(hasher((signed long long)14));
|
|
218
|
+
hashes.insert(hasher((unsigned long long)15));
|
|
219
|
+
hashes.insert(hasher((int8_t)16));
|
|
220
|
+
hashes.insert(hasher((uint8_t)17));
|
|
221
|
+
hashes.insert(hasher((int16_t)18));
|
|
222
|
+
hashes.insert(hasher((uint16_t)19));
|
|
223
|
+
hashes.insert(hasher((int32_t)20));
|
|
224
|
+
hashes.insert(hasher((uint32_t)21));
|
|
225
|
+
hashes.insert(hasher((int64_t)22));
|
|
226
|
+
hashes.insert(hasher((uint64_t)23));
|
|
227
|
+
hashes.insert(hasher((size_t)24));
|
|
228
|
+
|
|
229
|
+
size_t setSize = 24;
|
|
230
|
+
#if FOLLY_HAVE_INT128_T
|
|
231
|
+
hashes.insert(hasher((__int128_t)25));
|
|
232
|
+
hashes.insert(hasher((__uint128_t)26));
|
|
233
|
+
setSize += 2;
|
|
234
|
+
#endif
|
|
235
|
+
EXPECT_EQ(setSize, hashes.size());
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
namespace {
|
|
239
|
+
enum class TestEnum {
|
|
240
|
+
MIN = 0,
|
|
241
|
+
ITEM = 1,
|
|
242
|
+
MAX = 2,
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
enum class TestBigEnum : uint64_t {
|
|
246
|
+
ITEM = 1,
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
struct TestStruct {};
|
|
250
|
+
} // namespace
|
|
251
|
+
|
|
252
|
+
namespace std {
|
|
253
|
+
template <>
|
|
254
|
+
struct hash<TestEnum> {
|
|
255
|
+
std::size_t operator()(TestEnum const& e) const noexcept {
|
|
256
|
+
return hash<int>()(static_cast<int>(e));
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
template <>
|
|
261
|
+
struct hash<TestStruct> {
|
|
262
|
+
std::size_t operator()(TestStruct const&) const noexcept { return 0; }
|
|
263
|
+
};
|
|
264
|
+
} // namespace std
|
|
265
|
+
|
|
266
|
+
namespace {
|
|
267
|
+
thread_local size_t allocatedMemorySize{0};
|
|
268
|
+
|
|
269
|
+
template <class T>
|
|
270
|
+
class TestAlloc {
|
|
271
|
+
public:
|
|
272
|
+
using Alloc = std::allocator<T>;
|
|
273
|
+
using AllocTraits = std::allocator_traits<Alloc>;
|
|
274
|
+
using value_type = typename AllocTraits::value_type;
|
|
275
|
+
|
|
276
|
+
using pointer = typename AllocTraits::pointer;
|
|
277
|
+
using const_pointer = typename AllocTraits::const_pointer;
|
|
278
|
+
using reference = value_type&;
|
|
279
|
+
using const_reference = value_type const&;
|
|
280
|
+
using size_type = typename AllocTraits::size_type;
|
|
281
|
+
|
|
282
|
+
using propagate_on_container_swap = std::true_type;
|
|
283
|
+
using propagate_on_container_copy_assignment = std::true_type;
|
|
284
|
+
using propagate_on_container_move_assignment = std::true_type;
|
|
285
|
+
|
|
286
|
+
TestAlloc() {}
|
|
287
|
+
|
|
288
|
+
template <class T2>
|
|
289
|
+
TestAlloc(TestAlloc<T2> const& other) noexcept : a_(other.a_) {}
|
|
290
|
+
|
|
291
|
+
template <class T2>
|
|
292
|
+
TestAlloc& operator=(TestAlloc<T2> const& other) noexcept {
|
|
293
|
+
a_ = other.a_;
|
|
294
|
+
return *this;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
template <class T2>
|
|
298
|
+
TestAlloc(TestAlloc<T2>&& other) noexcept : a_(std::move(other.a_)) {}
|
|
299
|
+
|
|
300
|
+
template <class T2>
|
|
301
|
+
TestAlloc& operator=(TestAlloc<T2>&& other) noexcept {
|
|
302
|
+
a_ = std::move(other.a_);
|
|
303
|
+
return *this;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
static size_t getAllocatedMemorySize() { return allocatedMemorySize; }
|
|
307
|
+
|
|
308
|
+
static void resetTracking() { allocatedMemorySize = 0; }
|
|
309
|
+
|
|
310
|
+
T* allocate(size_t n) {
|
|
311
|
+
allocatedMemorySize += n * sizeof(T);
|
|
312
|
+
return a_.allocate(n);
|
|
313
|
+
}
|
|
314
|
+
void deallocate(T* p, size_t n) {
|
|
315
|
+
allocatedMemorySize -= n * sizeof(T);
|
|
316
|
+
a_.deallocate(p, n);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
private:
|
|
320
|
+
std::allocator<T> a_;
|
|
321
|
+
|
|
322
|
+
template <class U>
|
|
323
|
+
friend class TestAlloc;
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
template <class T1, class T2>
|
|
327
|
+
bool operator==(TestAlloc<T1> const&, TestAlloc<T2> const&) {
|
|
328
|
+
return true;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
template <class T1, class T2>
|
|
332
|
+
bool operator!=(TestAlloc<T1> const&, TestAlloc<T2> const&) {
|
|
333
|
+
return false;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
template <class M, class A>
|
|
337
|
+
std::vector<size_t> getStats(size_t iter) {
|
|
338
|
+
std::vector<size_t> ret;
|
|
339
|
+
ret.reserve(iter);
|
|
340
|
+
A::resetTracking();
|
|
341
|
+
M m;
|
|
342
|
+
ret.push_back(A::getAllocatedMemorySize());
|
|
343
|
+
for (size_t i = 1; i < iter; ++i) {
|
|
344
|
+
m.insert(std::make_pair(
|
|
345
|
+
folly::to<typename M::key_type>(i), typename M::mapped_type{}));
|
|
346
|
+
ret.push_back(A::getAllocatedMemorySize());
|
|
347
|
+
}
|
|
348
|
+
return ret;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
template <typename K, typename V, typename H>
|
|
352
|
+
void testNoCachedHashCode() {
|
|
353
|
+
using A = TestAlloc<std::pair<const K, V>>;
|
|
354
|
+
using M = std::unordered_map<K, V, std::hash<K>, std::equal_to<K>, A>;
|
|
355
|
+
using MActual = std::unordered_map<K, V, H, std::equal_to<K>, A>;
|
|
356
|
+
constexpr int kIter = 10;
|
|
357
|
+
auto expected = getStats<M, A>(kIter);
|
|
358
|
+
auto actual = getStats<MActual, A>(kIter);
|
|
359
|
+
ASSERT_EQ(expected.size(), actual.size());
|
|
360
|
+
for (size_t i = 0; i < expected.size(); ++i) {
|
|
361
|
+
ASSERT_EQ(expected[i], actual[i]);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
} // namespace
|
|
365
|
+
|
|
366
|
+
TEST(Hash, noCachedHashCode) {
|
|
367
|
+
testNoCachedHashCode<bool, char, folly::hasher<bool>>();
|
|
368
|
+
testNoCachedHashCode<int, char, folly::hasher<int>>();
|
|
369
|
+
testNoCachedHashCode<double, char, folly::hasher<double>>();
|
|
370
|
+
testNoCachedHashCode<TestEnum, char, folly::hasher<TestEnum>>();
|
|
371
|
+
|
|
372
|
+
testNoCachedHashCode<bool, std::string, folly::Hash>();
|
|
373
|
+
testNoCachedHashCode<int, std::string, folly::Hash>();
|
|
374
|
+
testNoCachedHashCode<double, std::string, folly::Hash>();
|
|
375
|
+
testNoCachedHashCode<TestEnum, std::string, folly::Hash>();
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
TEST(Hash, integerConversion) {
|
|
379
|
+
folly::hasher<uint64_t> h;
|
|
380
|
+
uint64_t k = 10;
|
|
381
|
+
EXPECT_EQ(h(k), h(10));
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
#if FOLLY_HAVE_INT128_T
|
|
385
|
+
TEST(Hash, int128StdHash) {
|
|
386
|
+
std::unordered_set<__int128> hs;
|
|
387
|
+
hs.insert(__int128_t{1});
|
|
388
|
+
hs.insert(__int128_t{2});
|
|
389
|
+
EXPECT_EQ(2, hs.size());
|
|
390
|
+
|
|
391
|
+
std::set<unsigned __int128> s;
|
|
392
|
+
s.insert(static_cast<unsigned __int128>(1));
|
|
393
|
+
s.insert(static_cast<unsigned __int128>(2));
|
|
394
|
+
EXPECT_EQ(2, s.size());
|
|
395
|
+
}
|
|
396
|
+
#endif
|
|
397
|
+
|
|
398
|
+
TEST(Hash, floatTypes) {
|
|
399
|
+
folly::Hash hasher;
|
|
400
|
+
|
|
401
|
+
EXPECT_EQ(hasher(0.0f), hasher(-0.0f));
|
|
402
|
+
EXPECT_EQ(hasher(0.0), hasher(-0.0));
|
|
403
|
+
|
|
404
|
+
// Basically just confirms that things compile ok.
|
|
405
|
+
std::unordered_set<size_t> hashes;
|
|
406
|
+
hashes.insert(hasher(0.0f));
|
|
407
|
+
hashes.insert(hasher(0.1f));
|
|
408
|
+
hashes.insert(hasher(0.2));
|
|
409
|
+
hashes.insert(hasher(0.2f));
|
|
410
|
+
hashes.insert(hasher(-0.3));
|
|
411
|
+
hashes.insert(hasher(-0.3f));
|
|
412
|
+
|
|
413
|
+
EXPECT_EQ(6, hashes.size());
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
// Not a full hasher since only handles one type
|
|
417
|
+
class TestHasher {
|
|
418
|
+
public:
|
|
419
|
+
size_t operator()(const std::pair<int, int>& p) const {
|
|
420
|
+
return p.first + p.second;
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
template <typename T, typename... Ts>
|
|
425
|
+
size_t hash_combine_test(const T& t, const Ts&... ts) {
|
|
426
|
+
return hash_combine_generic(TestHasher{}, t, ts...);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
TEST(Hash, pair) {
|
|
430
|
+
auto a = std::make_pair(1, 2);
|
|
431
|
+
auto b = std::make_pair(3, 4);
|
|
432
|
+
auto c = std::make_pair(1, 2);
|
|
433
|
+
auto d = std::make_pair(2, 1);
|
|
434
|
+
EXPECT_EQ(hash_combine(a), hash_combine(c));
|
|
435
|
+
EXPECT_NE(hash_combine(b), hash_combine(c));
|
|
436
|
+
EXPECT_NE(hash_combine(d), hash_combine(c));
|
|
437
|
+
|
|
438
|
+
// With composition
|
|
439
|
+
EXPECT_EQ(hash_combine(a, b), hash_combine(c, b));
|
|
440
|
+
// Test order dependence
|
|
441
|
+
EXPECT_NE(hash_combine(a, b), hash_combine(b, a));
|
|
442
|
+
|
|
443
|
+
// Test with custom hasher
|
|
444
|
+
EXPECT_EQ(hash_combine_test(a), hash_combine_test(c));
|
|
445
|
+
// 3 + 4 != 1 + 2
|
|
446
|
+
EXPECT_NE(hash_combine_test(b), hash_combine_test(c));
|
|
447
|
+
// This time, thanks to a terrible hash function, these are equal
|
|
448
|
+
EXPECT_EQ(hash_combine_test(d), hash_combine_test(c));
|
|
449
|
+
// With composition
|
|
450
|
+
EXPECT_EQ(hash_combine_test(a, b), hash_combine_test(c, b));
|
|
451
|
+
// Test order dependence
|
|
452
|
+
EXPECT_NE(hash_combine_test(a, b), hash_combine_test(b, a));
|
|
453
|
+
// Again, 1 + 2 == 2 + 1
|
|
454
|
+
EXPECT_EQ(hash_combine_test(a, b), hash_combine_test(d, b));
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
TEST(Hash, hashCombine) {
|
|
458
|
+
EXPECT_TRUE(noexcept(hash_combine(1, 2)));
|
|
459
|
+
EXPECT_NE(hash_combine(1, 2), hash_combine(2, 1));
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
TEST(Hash, hashBool) {
|
|
463
|
+
const auto hash = folly::Hash();
|
|
464
|
+
EXPECT_NE(hash(true), hash(false));
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
TEST(Hash, hashBool10) {
|
|
468
|
+
const auto hash = folly::Hash();
|
|
469
|
+
std::set<size_t> values;
|
|
470
|
+
for (bool b1 : {false, true}) {
|
|
471
|
+
for (bool b2 : {false, true}) {
|
|
472
|
+
for (bool b3 : {false, true}) {
|
|
473
|
+
for (bool b4 : {false, true}) {
|
|
474
|
+
for (bool b5 : {false, true}) {
|
|
475
|
+
for (bool b6 : {false, true}) {
|
|
476
|
+
for (bool b7 : {false, true}) {
|
|
477
|
+
for (bool b8 : {false, true}) {
|
|
478
|
+
for (bool b9 : {false, true}) {
|
|
479
|
+
for (bool b10 : {false, true}) {
|
|
480
|
+
values.insert(
|
|
481
|
+
hash(b1, b2, b3, b4, b5, b6, b7, b8, b9, b10));
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
EXPECT_EQ(values.size(), 1 << 10);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
TEST(Hash, stdTuple) {
|
|
496
|
+
typedef std::tuple<int64_t, std::string, int32_t> tuple3;
|
|
497
|
+
tuple3 t(42, "foo", 1);
|
|
498
|
+
|
|
499
|
+
std::unordered_map<tuple3, std::string> m;
|
|
500
|
+
m[t] = "bar";
|
|
501
|
+
EXPECT_EQ("bar", m[t]);
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
TEST(Hash, stdEmptyTuple) {
|
|
505
|
+
std::unordered_map<std::tuple<>, std::string, folly::Hash> m;
|
|
506
|
+
m[{}] = "foo";
|
|
507
|
+
EXPECT_EQ(m[{}], "foo");
|
|
508
|
+
|
|
509
|
+
folly::hasher<std::tuple<>> h;
|
|
510
|
+
EXPECT_EQ(h({}), 0);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
TEST(Hash, enumType) {
|
|
514
|
+
const auto hash = folly::Hash();
|
|
515
|
+
|
|
516
|
+
enum class Enum32 : int32_t { Foo, Bar };
|
|
517
|
+
EXPECT_EQ(hash(static_cast<int32_t>(Enum32::Foo)), hash(Enum32::Foo));
|
|
518
|
+
EXPECT_EQ(hash(static_cast<int32_t>(Enum32::Bar)), hash(Enum32::Bar));
|
|
519
|
+
EXPECT_NE(hash(Enum32::Foo), hash(Enum32::Bar));
|
|
520
|
+
|
|
521
|
+
std::unordered_map<Enum32, std::string, folly::Hash> m32;
|
|
522
|
+
m32[Enum32::Foo] = "foo";
|
|
523
|
+
EXPECT_EQ("foo", m32[Enum32::Foo]);
|
|
524
|
+
|
|
525
|
+
enum class Enum64 : int64_t { Foo, Bar };
|
|
526
|
+
EXPECT_EQ(hash(static_cast<int64_t>(Enum64::Foo)), hash(Enum64::Foo));
|
|
527
|
+
EXPECT_EQ(hash(static_cast<int64_t>(Enum64::Bar)), hash(Enum64::Bar));
|
|
528
|
+
EXPECT_NE(hash(Enum64::Foo), hash(Enum64::Bar));
|
|
529
|
+
|
|
530
|
+
std::unordered_map<Enum64, std::string, folly::Hash> m64;
|
|
531
|
+
m64[Enum64::Foo] = "foo";
|
|
532
|
+
EXPECT_EQ("foo", m64[Enum64::Foo]);
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
TEST(Hash, pairFollyHash) {
|
|
536
|
+
typedef std::pair<int64_t, int32_t> pair2;
|
|
537
|
+
pair2 p(42, 1);
|
|
538
|
+
|
|
539
|
+
std::unordered_map<pair2, std::string, folly::Hash> m;
|
|
540
|
+
m[p] = "bar";
|
|
541
|
+
EXPECT_EQ("bar", m[p]);
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
TEST(Hash, tupleFollyHash) {
|
|
545
|
+
typedef std::tuple<int64_t, int32_t, int32_t> tuple3;
|
|
546
|
+
tuple3 t(42, 1, 1);
|
|
547
|
+
|
|
548
|
+
std::unordered_map<tuple3, std::string, folly::Hash> m;
|
|
549
|
+
m[t] = "bar";
|
|
550
|
+
EXPECT_EQ("bar", m[t]);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
namespace {
|
|
554
|
+
template <class T>
|
|
555
|
+
size_t hash_vector(const std::vector<T>& v) {
|
|
556
|
+
return hash_range(v.begin(), v.end());
|
|
557
|
+
}
|
|
558
|
+
} // namespace
|
|
559
|
+
|
|
560
|
+
TEST(Hash, hashRange) {
|
|
561
|
+
EXPECT_EQ(hash_vector<int32_t>({1, 2}), hash_vector<int16_t>({1, 2}));
|
|
562
|
+
EXPECT_NE(hash_vector<int>({2, 1}), hash_vector<int>({1, 2}));
|
|
563
|
+
EXPECT_EQ(hash_vector<int>({}), hash_vector<float>({}));
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
TEST(Hash, commutativeHashCombine) {
|
|
567
|
+
EXPECT_EQ(
|
|
568
|
+
commutative_hash_combine_value_generic(
|
|
569
|
+
folly::Hash{}(12345ul), folly::Hash{}, 6789ul),
|
|
570
|
+
commutative_hash_combine_value_generic(
|
|
571
|
+
folly::Hash{}(6789ul), folly::Hash{}, 12345ul));
|
|
572
|
+
|
|
573
|
+
std::vector<int> v = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
|
|
574
|
+
std::random_device rd;
|
|
575
|
+
std::mt19937 g(rd());
|
|
576
|
+
auto h = commutative_hash_combine_range(v.begin(), v.end());
|
|
577
|
+
for (int i = 0; i < 100; i++) {
|
|
578
|
+
std::shuffle(v.begin(), v.end(), g);
|
|
579
|
+
EXPECT_EQ(h, commutative_hash_combine_range(v.begin(), v.end()));
|
|
580
|
+
}
|
|
581
|
+
EXPECT_NE(
|
|
582
|
+
h,
|
|
583
|
+
commutative_hash_combine_range_generic(
|
|
584
|
+
/* seed = */ 0xdeadbeef, folly::Hash{}, v.begin(), v.end()));
|
|
585
|
+
EXPECT_NE(
|
|
586
|
+
h, commutative_hash_combine_range(v.begin(), v.begin() + (v.size() - 1)));
|
|
587
|
+
|
|
588
|
+
EXPECT_EQ(h, commutative_hash_combine(1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
|
|
589
|
+
EXPECT_EQ(h, commutative_hash_combine(10, 2, 3, 4, 5, 6, 7, 8, 9, 1));
|
|
590
|
+
|
|
591
|
+
EXPECT_EQ(
|
|
592
|
+
commutative_hash_combine(12345, 6789),
|
|
593
|
+
commutative_hash_combine(6789, 12345));
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
TEST(Hash, stdTupleDifferentHash) {
|
|
597
|
+
typedef std::tuple<int64_t, std::string, int32_t> tuple3;
|
|
598
|
+
tuple3 t1(42, "foo", 1);
|
|
599
|
+
tuple3 t2(9, "bar", 3);
|
|
600
|
+
tuple3 t3(42, "foo", 3);
|
|
601
|
+
|
|
602
|
+
EXPECT_NE(std::hash<tuple3>()(t1), std::hash<tuple3>()(t2));
|
|
603
|
+
EXPECT_NE(std::hash<tuple3>()(t1), std::hash<tuple3>()(t3));
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
TEST(Hash, Strings) {
|
|
607
|
+
using namespace folly;
|
|
608
|
+
|
|
609
|
+
StringPiece a1 = "10050517", b1 = "51107032", a2 = "10050518",
|
|
610
|
+
b2 = "51107033", a3 = "10050519", b3 = "51107034",
|
|
611
|
+
a4 = "10050525", b4 = "51107040";
|
|
612
|
+
Range<const wchar_t*> w1 = range(L"10050517"), w2 = range(L"51107032"),
|
|
613
|
+
w3 = range(L"10050518"), w4 = range(L"51107033");
|
|
614
|
+
Hash h2;
|
|
615
|
+
EXPECT_NE(h2(a1), h2(b1));
|
|
616
|
+
EXPECT_NE(h2(a1), h2(b1));
|
|
617
|
+
EXPECT_NE(h2(a2), h2(b2));
|
|
618
|
+
EXPECT_NE(h2(a3), h2(b3));
|
|
619
|
+
EXPECT_NE(h2(ByteRange(a1)), h2(ByteRange(b1)));
|
|
620
|
+
EXPECT_NE(h2(ByteRange(a2)), h2(ByteRange(b2)));
|
|
621
|
+
EXPECT_NE(h2(ByteRange(a3)), h2(ByteRange(b3)));
|
|
622
|
+
EXPECT_NE(h2(ByteRange(a4)), h2(ByteRange(b4)));
|
|
623
|
+
EXPECT_NE(h2(w1), h2(w2));
|
|
624
|
+
EXPECT_NE(h2(w1), h2(w3));
|
|
625
|
+
EXPECT_NE(h2(w2), h2(w4));
|
|
626
|
+
|
|
627
|
+
// Check compatibility with std::string.
|
|
628
|
+
EXPECT_EQ(h2(a1), h2(a1.str()));
|
|
629
|
+
EXPECT_EQ(h2(a2), h2(a2.str()));
|
|
630
|
+
EXPECT_EQ(h2(a3), h2(a3.str()));
|
|
631
|
+
EXPECT_EQ(h2(a4), h2(a4.str()));
|
|
632
|
+
|
|
633
|
+
// Check compatibility with std::string_view.
|
|
634
|
+
EXPECT_EQ(h2(a1), h2(std::string_view{a1}));
|
|
635
|
+
EXPECT_EQ(h2(a2), h2(std::string_view{a2}));
|
|
636
|
+
EXPECT_EQ(h2(a3), h2(std::string_view{a3}));
|
|
637
|
+
EXPECT_EQ(h2(a4), h2(std::string_view{a4}));
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
namespace {
|
|
641
|
+
void deletePointer(const std::unique_ptr<std::string>&) {}
|
|
642
|
+
void deletePointer(const std::shared_ptr<std::string>&) {}
|
|
643
|
+
void deletePointer(std::string* pointer) {
|
|
644
|
+
delete pointer;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
template <template <typename...> class PtrType>
|
|
648
|
+
void pointerTestWithFollyHash() {
|
|
649
|
+
std::unordered_set<PtrType<std::string>, folly::Hash> set;
|
|
650
|
+
|
|
651
|
+
for (auto i = 0; i < 1000; ++i) {
|
|
652
|
+
auto random = PtrType<std::string>{
|
|
653
|
+
new std::string{folly::to<std::string>(folly::Random::rand64())}};
|
|
654
|
+
set.insert(std::move(random));
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
for (auto& pointer : set) {
|
|
658
|
+
EXPECT_TRUE(set.find(pointer) != set.end());
|
|
659
|
+
deletePointer(pointer);
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
template <typename T>
|
|
664
|
+
using Pointer = T*;
|
|
665
|
+
} // namespace
|
|
666
|
+
|
|
667
|
+
TEST(Hash, UniquePtr) {
|
|
668
|
+
pointerTestWithFollyHash<std::unique_ptr>();
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
TEST(Hash, SharedPtr) {
|
|
672
|
+
pointerTestWithFollyHash<std::shared_ptr>();
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
TEST(Hash, Pointer) {
|
|
676
|
+
pointerTestWithFollyHash<Pointer>();
|
|
677
|
+
|
|
678
|
+
EXPECT_TRUE(
|
|
679
|
+
(std::is_same<
|
|
680
|
+
folly::hasher<std::string*>::folly_is_avalanching,
|
|
681
|
+
folly::hasher<std::unique_ptr<std::string>>::folly_is_avalanching>::
|
|
682
|
+
value));
|
|
683
|
+
|
|
684
|
+
EXPECT_TRUE(
|
|
685
|
+
(std::is_same<
|
|
686
|
+
folly::hasher<std::string*>::folly_is_avalanching,
|
|
687
|
+
folly::hasher<std::shared_ptr<std::string>>::folly_is_avalanching>::
|
|
688
|
+
value));
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
struct FNVTestParam {
|
|
692
|
+
std::string in;
|
|
693
|
+
uint64_t out;
|
|
694
|
+
};
|
|
695
|
+
|
|
696
|
+
class FNVTest : public ::testing::TestWithParam<FNVTestParam> {};
|
|
697
|
+
|
|
698
|
+
TEST_P(FNVTest, Fnva64Buf) {
|
|
699
|
+
EXPECT_EQ(
|
|
700
|
+
GetParam().out, fnva64_buf(GetParam().in.data(), GetParam().in.size()));
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
TEST_P(FNVTest, Fnva64) {
|
|
704
|
+
EXPECT_EQ(GetParam().out, fnva64(GetParam().in));
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
TEST_P(FNVTest, Fnva64Partial) {
|
|
708
|
+
size_t partialLen = GetParam().in.size() / 2;
|
|
709
|
+
auto data = GetParam().in.data();
|
|
710
|
+
auto partial = fnva64_buf(data, partialLen);
|
|
711
|
+
EXPECT_EQ(
|
|
712
|
+
GetParam().out,
|
|
713
|
+
fnva64_buf(
|
|
714
|
+
data + partialLen, GetParam().in.size() - partialLen, partial));
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
// Taken from http://www.isthe.com/chongo/src/fnv/test_fnv.c
|
|
718
|
+
INSTANTIATE_TEST_SUITE_P(
|
|
719
|
+
FNVTesting,
|
|
720
|
+
FNVTest,
|
|
721
|
+
::testing::Values(
|
|
722
|
+
FNVTestParam{
|
|
723
|
+
"foobar", // 11
|
|
724
|
+
0x85944171f73967e8},
|
|
725
|
+
FNVTestParam{
|
|
726
|
+
"chongo was here!\n", // 39
|
|
727
|
+
0x46810940eff5f915},
|
|
728
|
+
FNVTestParam{
|
|
729
|
+
"127.0.0.3", // 106,
|
|
730
|
+
0xaabafc7104d91158},
|
|
731
|
+
FNVTestParam{
|
|
732
|
+
"http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash", // 126
|
|
733
|
+
0xd9b957fb7fe794c5},
|
|
734
|
+
FNVTestParam{
|
|
735
|
+
"http://norvig.com/21-days.html", // 136
|
|
736
|
+
0x07aaa640476e0b9a}));
|
|
737
|
+
|
|
738
|
+
//////// static checks
|
|
739
|
+
|
|
740
|
+
static constexpr bool k32Bit = sizeof(std::size_t) == 4;
|
|
741
|
+
|
|
742
|
+
static_assert(!folly::IsAvalanchingHasher<std::hash<int>, int>::value, "");
|
|
743
|
+
static_assert(
|
|
744
|
+
!folly::IsAvalanchingHasher<std::hash<char const*>, char const*>::value,
|
|
745
|
+
"");
|
|
746
|
+
static_assert(!folly::IsAvalanchingHasher<std::hash<float>, float>::value, "");
|
|
747
|
+
static_assert(
|
|
748
|
+
!folly::IsAvalanchingHasher<std::hash<double>, double>::value, "");
|
|
749
|
+
static_assert(
|
|
750
|
+
!folly::IsAvalanchingHasher<std::hash<long double>, long double>::value,
|
|
751
|
+
"");
|
|
752
|
+
static_assert(
|
|
753
|
+
folly::IsAvalanchingHasher<std::hash<std::string>, std::string>::value, "");
|
|
754
|
+
static_assert(
|
|
755
|
+
!folly::IsAvalanchingHasher<std::hash<TestEnum>, TestEnum>::value, "");
|
|
756
|
+
static_assert(
|
|
757
|
+
!folly::IsAvalanchingHasher<std::hash<TestStruct>, TestStruct>::value, "");
|
|
758
|
+
|
|
759
|
+
static_assert(
|
|
760
|
+
!folly::IsAvalanchingHasher<folly::transparent<std::hash<int>>, int>::value,
|
|
761
|
+
"");
|
|
762
|
+
static_assert(
|
|
763
|
+
folly::IsAvalanchingHasher<
|
|
764
|
+
folly::transparent<std::hash<std::string>>,
|
|
765
|
+
std::string>::value,
|
|
766
|
+
"");
|
|
767
|
+
|
|
768
|
+
// these come from folly/hash/Hash.h
|
|
769
|
+
static_assert(
|
|
770
|
+
folly::IsAvalanchingHasher<
|
|
771
|
+
std::hash<std::pair<int, int>>,
|
|
772
|
+
std::pair<int, int>>::value,
|
|
773
|
+
"");
|
|
774
|
+
static_assert(
|
|
775
|
+
!folly::IsAvalanchingHasher<std::hash<std::tuple<int>>, std::tuple<int>>::
|
|
776
|
+
value,
|
|
777
|
+
"");
|
|
778
|
+
static_assert(
|
|
779
|
+
folly::IsAvalanchingHasher<
|
|
780
|
+
std::hash<std::tuple<std::string>>,
|
|
781
|
+
std::tuple<std::string>>::value,
|
|
782
|
+
"");
|
|
783
|
+
static_assert(
|
|
784
|
+
folly::IsAvalanchingHasher<
|
|
785
|
+
std::hash<std::tuple<int, int>>,
|
|
786
|
+
std::tuple<int, int>>::value,
|
|
787
|
+
"");
|
|
788
|
+
static_assert(
|
|
789
|
+
folly::IsAvalanchingHasher<
|
|
790
|
+
std::hash<std::tuple<int, int, int>>,
|
|
791
|
+
std::tuple<int, int, int>>::value,
|
|
792
|
+
"");
|
|
793
|
+
|
|
794
|
+
static_assert(
|
|
795
|
+
k32Bit == folly::IsAvalanchingHasher<folly::Hash, uint8_t>::value, "");
|
|
796
|
+
static_assert(
|
|
797
|
+
k32Bit == folly::IsAvalanchingHasher<folly::Hash, char>::value, "");
|
|
798
|
+
static_assert(
|
|
799
|
+
k32Bit == folly::IsAvalanchingHasher<folly::Hash, uint16_t>::value, "");
|
|
800
|
+
static_assert(
|
|
801
|
+
k32Bit == folly::IsAvalanchingHasher<folly::Hash, int16_t>::value, "");
|
|
802
|
+
static_assert(
|
|
803
|
+
k32Bit == folly::IsAvalanchingHasher<folly::Hash, uint32_t>::value, "");
|
|
804
|
+
static_assert(
|
|
805
|
+
k32Bit == folly::IsAvalanchingHasher<folly::Hash, int32_t>::value, "");
|
|
806
|
+
static_assert(folly::IsAvalanchingHasher<folly::Hash, uint64_t>::value, "");
|
|
807
|
+
static_assert(folly::IsAvalanchingHasher<folly::Hash, int64_t>::value, "");
|
|
808
|
+
static_assert(
|
|
809
|
+
folly::IsAvalanchingHasher<folly::Hash, folly::StringPiece>::value, "");
|
|
810
|
+
static_assert(folly::IsAvalanchingHasher<folly::Hash, std::string>::value, "");
|
|
811
|
+
static_assert(
|
|
812
|
+
k32Bit == folly::IsAvalanchingHasher<folly::Hash, TestEnum>::value, "");
|
|
813
|
+
static_assert(folly::IsAvalanchingHasher<folly::Hash, TestBigEnum>::value, "");
|
|
814
|
+
|
|
815
|
+
static_assert(
|
|
816
|
+
k32Bit ==
|
|
817
|
+
folly::IsAvalanchingHasher<folly::hasher<uint8_t>, uint8_t>::value,
|
|
818
|
+
"");
|
|
819
|
+
static_assert(
|
|
820
|
+
k32Bit == folly::IsAvalanchingHasher<folly::hasher<char>, char>::value, "");
|
|
821
|
+
static_assert(
|
|
822
|
+
k32Bit ==
|
|
823
|
+
folly::IsAvalanchingHasher<folly::hasher<uint16_t>, uint16_t>::value,
|
|
824
|
+
"");
|
|
825
|
+
static_assert(
|
|
826
|
+
k32Bit ==
|
|
827
|
+
folly::IsAvalanchingHasher<folly::hasher<int16_t>, int16_t>::value,
|
|
828
|
+
"");
|
|
829
|
+
static_assert(
|
|
830
|
+
k32Bit ==
|
|
831
|
+
folly::IsAvalanchingHasher<folly::hasher<uint32_t>, uint32_t>::value,
|
|
832
|
+
"");
|
|
833
|
+
static_assert(
|
|
834
|
+
k32Bit ==
|
|
835
|
+
folly::IsAvalanchingHasher<folly::hasher<int32_t>, int32_t>::value,
|
|
836
|
+
"");
|
|
837
|
+
static_assert(
|
|
838
|
+
folly::IsAvalanchingHasher<folly::hasher<uint64_t>, uint64_t>::value, "");
|
|
839
|
+
static_assert(
|
|
840
|
+
folly::IsAvalanchingHasher<folly::hasher<int64_t>, int64_t>::value, "");
|
|
841
|
+
static_assert(
|
|
842
|
+
folly::IsAvalanchingHasher<folly::hasher<float>, float>::value, "");
|
|
843
|
+
static_assert(
|
|
844
|
+
folly::IsAvalanchingHasher<folly::hasher<double>, double>::value, "");
|
|
845
|
+
static_assert(
|
|
846
|
+
folly::IsAvalanchingHasher<folly::hasher<std::string>, std::string>::value,
|
|
847
|
+
"");
|
|
848
|
+
static_assert(
|
|
849
|
+
folly::IsAvalanchingHasher<folly::hasher<folly::StringPiece>, std::string>::
|
|
850
|
+
value,
|
|
851
|
+
"");
|
|
852
|
+
static_assert(
|
|
853
|
+
folly::IsAvalanchingHasher<
|
|
854
|
+
folly::hasher<folly::StringPiece>,
|
|
855
|
+
folly::StringPiece>::value,
|
|
856
|
+
"");
|
|
857
|
+
static_assert(
|
|
858
|
+
folly::IsAvalanchingHasher<
|
|
859
|
+
folly::transparent<folly::hasher<folly::StringPiece>>,
|
|
860
|
+
folly::StringPiece>::value,
|
|
861
|
+
"");
|
|
862
|
+
|
|
863
|
+
static_assert(
|
|
864
|
+
folly::IsAvalanchingHasher<folly::hasher<std::string>, std::string>::value,
|
|
865
|
+
"");
|
|
866
|
+
static_assert(
|
|
867
|
+
folly::IsAvalanchingHasher<
|
|
868
|
+
folly::hasher<std::pair<int, int>>,
|
|
869
|
+
std::pair<int, int>>::value,
|
|
870
|
+
"");
|
|
871
|
+
static_assert(
|
|
872
|
+
k32Bit ==
|
|
873
|
+
folly::IsAvalanchingHasher<
|
|
874
|
+
folly::hasher<std::tuple<int>>,
|
|
875
|
+
std::tuple<int>>::value,
|
|
876
|
+
"");
|
|
877
|
+
static_assert(
|
|
878
|
+
folly::IsAvalanchingHasher<
|
|
879
|
+
folly::hasher<std::tuple<std::string>>,
|
|
880
|
+
std::tuple<std::string>>::value,
|
|
881
|
+
"");
|
|
882
|
+
static_assert(
|
|
883
|
+
folly::IsAvalanchingHasher<
|
|
884
|
+
folly::hasher<std::tuple<int, int>>,
|
|
885
|
+
std::tuple<int, int>>::value,
|
|
886
|
+
"");
|
|
887
|
+
static_assert(
|
|
888
|
+
folly::IsAvalanchingHasher<
|
|
889
|
+
folly::hasher<std::tuple<int, int, int>>,
|
|
890
|
+
std::tuple<int, int, int>>::value,
|
|
891
|
+
"");
|
|
892
|
+
static_assert(
|
|
893
|
+
k32Bit ==
|
|
894
|
+
folly::IsAvalanchingHasher<folly::hasher<TestEnum>, TestEnum>::value,
|
|
895
|
+
"");
|
|
896
|
+
static_assert(
|
|
897
|
+
folly::IsAvalanchingHasher<folly::hasher<TestBigEnum>, TestBigEnum>::value,
|
|
898
|
+
"");
|
|
899
|
+
|
|
900
|
+
//////// dynamic checks
|
|
901
|
+
|
|
902
|
+
namespace {
|
|
903
|
+
template <typename H, typename T, typename F>
|
|
904
|
+
void verifyAvalanching(T initialValue, F const& advance) {
|
|
905
|
+
// This doesn't check probabilities, but does verify that every bit
|
|
906
|
+
// changed independently of every other bit, in both directions, when
|
|
907
|
+
// traversing a sequence of dependent changes. Note that it is NOT
|
|
908
|
+
// sufficient to just use a random sequence here, because even the
|
|
909
|
+
// identity function will pass. As constructed this will require
|
|
910
|
+
// 2^63 steps to complete for an identity hash, because none of the
|
|
911
|
+
// transitions with on == 63 will occur until then.
|
|
912
|
+
H const hasher;
|
|
913
|
+
constexpr std::size_t N = sizeof(decltype(hasher(initialValue))) * 8;
|
|
914
|
+
|
|
915
|
+
// seen[i][j] if we have seen i flip on at the same time as j went off
|
|
916
|
+
bool seen[N][N] = {};
|
|
917
|
+
std::size_t unseenCount = N * (N - 1);
|
|
918
|
+
auto v = initialValue;
|
|
919
|
+
auto h = hasher(v);
|
|
920
|
+
std::size_t steps = 0;
|
|
921
|
+
// wait for 95% coverage
|
|
922
|
+
while (unseenCount > (N * (N - 1)) / 95) {
|
|
923
|
+
++steps;
|
|
924
|
+
auto hPrev = h;
|
|
925
|
+
advance(v);
|
|
926
|
+
h = hasher(v);
|
|
927
|
+
|
|
928
|
+
uint64_t delta = hPrev ^ h;
|
|
929
|
+
for (std::size_t i = 0; i < N - 1; ++i) {
|
|
930
|
+
if (((delta >> i) & 1) == 0) {
|
|
931
|
+
continue;
|
|
932
|
+
}
|
|
933
|
+
// we know i flipped
|
|
934
|
+
for (std::size_t j = i + 1; j < N; ++j) {
|
|
935
|
+
if (((delta >> j) & 1) == 0) {
|
|
936
|
+
continue;
|
|
937
|
+
}
|
|
938
|
+
// we know j flipped
|
|
939
|
+
bool iOn = ((hPrev >> i) & 1) == 0;
|
|
940
|
+
bool jOn = ((hPrev >> j) & 1) == 0;
|
|
941
|
+
if (iOn != jOn) {
|
|
942
|
+
auto on = iOn ? i : j;
|
|
943
|
+
auto off = iOn ? j : i;
|
|
944
|
+
if (!seen[on][off]) {
|
|
945
|
+
seen[on][off] = true;
|
|
946
|
+
--unseenCount;
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
// we should actually only need a couple hundred
|
|
953
|
+
ASSERT_LT(steps, 1000) << unseenCount << " of " << (N * (N - 1))
|
|
954
|
+
<< " pair transitions unseen";
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
} // namespace
|
|
958
|
+
|
|
959
|
+
TEST(Traits, stdHashPairAvalances) {
|
|
960
|
+
verifyAvalanching<std::hash<std::pair<int, int>>>(
|
|
961
|
+
std::make_pair(0, 0), [](std::pair<int, int>& v) { v.first++; });
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
TEST(Traits, stdHashTuple2Avalances) {
|
|
965
|
+
verifyAvalanching<std::hash<std::tuple<int, int>>>(
|
|
966
|
+
std::make_tuple(0, 0),
|
|
967
|
+
[](std::tuple<int, int>& v) { std::get<0>(v) += 1; });
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
TEST(Traits, stdHashStringAvalances) {
|
|
971
|
+
verifyAvalanching<std::hash<std::string>, std::string>(
|
|
972
|
+
"00000000000000000000000000000", [](std::string& str) {
|
|
973
|
+
std::size_t i = 0;
|
|
974
|
+
while (str[i] == '1') {
|
|
975
|
+
str[i] = '0';
|
|
976
|
+
++i;
|
|
977
|
+
}
|
|
978
|
+
str[i] = '1';
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
TEST(Traits, follyHashUint64Avalances) {
|
|
983
|
+
verifyAvalanching<folly::Hash>(uint64_t{0}, [](uint64_t& v) { v++; });
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
TEST(Traits, follyHasherInt64Avalances) {
|
|
987
|
+
verifyAvalanching<folly::hasher<int64_t>>(
|
|
988
|
+
int64_t{0}, [](int64_t& v) { v++; });
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
TEST(Traits, follyHasherFloatAvalanches) {
|
|
992
|
+
verifyAvalanching<folly::hasher<float>>(0.0f, [](float& v) { v += 1; });
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
TEST(Traits, follyHasherDoubleAvalanches) {
|
|
996
|
+
verifyAvalanching<folly::hasher<double>>(0.0, [](double& v) { v += 1; });
|
|
997
|
+
}
|