summaryrefslogtreecommitdiff
path: root/absl/flags/parse_test.cc
Commit message (Collapse)AuthorAge
* Migrate most RAW_LOGs and RAW_CHECKs in tests to regular LOG and CHECK.Gravatar Andy Getzendanner2023-05-23
| | | | | | | | | | | The non-RAW_ versions provide better output but weren't available when most of these tests were written. There are just a couple spots where RAW_ is actually needed, e.g. signal handlers and malloc hooks. Also fix a couple warnings in layout_test.cc newly surfaced because the optimizer understands CHECK_XX differently than INTERNAL_CHECK. PiperOrigin-RevId: 534584435 Change-Id: I8d36fa809ffdaae5a3813064bd602cb8611c1613
* Use stdout for help output even in case of errors.Gravatar Gennadiy Rozental2023-04-06
| | | | | PiperOrigin-RevId: 522393331 Change-Id: Ia5f4ad6a2d16c033ea97f3c7e27e8eb7ee429242
* Add a call to handle usage flags in case of unrecognized flagsGravatar Gennadiy Rozental2023-03-24
| | | | | PiperOrigin-RevId: 519090305 Change-Id: Ic97a36da33e1e0681765a913f3c54c3d818eebdc
* Change ParseAbseilFlagsOnly function to include handling of usage flags and ↵Gravatar Gennadiy Rozental2023-03-21
| | | | | | | exit on syntax errors. PiperOrigin-RevId: 518198160 Change-Id: Ib4fe53e0b0b371472b6b9473aeb84779953b6a38
* Introduce two new public APIs for parsing command line flags.Gravatar Gennadiy Rozental2023-03-08
| | | | | | | | | | | ParseAbseilFlagsOnly To be used to parse Abseil Flags only and classify the rest of the arguments. ReportUnrecognizedFlags To be used to report unrecognized flags. PiperOrigin-RevId: 515082682 Change-Id: I73271b56cc512a5e78b5fcd035564b3672d62ca8
* Eliminate internal ArgvListAction enum.Gravatar Gennadiy Rozental2023-02-27
| | | | | PiperOrigin-RevId: 512697257 Change-Id: I828ac7a4ada482d60beba767ef9da6e2c0077c33
* Suggest similar flags in case of undefined flags.Gravatar Abseil Team2023-01-04
| | | | | | | Using Damerau-Levenshtein distance to calculate potential candidates to suggest. PiperOrigin-RevId: 499449034 Change-Id: I805aafefcd0f4f85585ac33a041c15360619c96a
* Export of internal Abseil changesGravatar Abseil Team2021-06-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -- b1fc72630aaa81c8395c3b22ba267d938fe29a2e by Derek Mauro <dmauro@google.com>: Fix -Wdeprecated-copy warnings from Clang 13. Example: error: definition of implicit copy assignment operator for 'UDT' is deprecated because it has a user-declared copy constructor [-Werror,-Wdeprecated-copy] PiperOrigin-RevId: 380058303 -- 0422744812b1a2010d9eea5b17fbe89f3441b66b by Evan Brown <ezb@google.com>: Change the "full table!" asserts in raw_hash_set to use `<= capacity` instead of `< capacity`. If we add support for non-power-of-two-minus-one capacities, this is the correct thing to assert. For example, consider: Group::kWidth = 8, capacity_ = 8, ctrl_ = {kEmpty, 1, 2, 3, 4, 5, 6, 7, kSentinel, kEmpty, 1, 2, 3, 4, 5, 6}. In this case, if we do an unsuccessful lookup with H2 mapping to slot 1, then the first Group will contain {1, 2, 3, 4, 5, 6, 7, kSentinel} so we need to continue to the second Group (at which point seq.index() == 8 == capacity_) to find a kEmpty. Note: this is a no-op change for now since we never have `capacity % Group::kWidth == 0`. PiperOrigin-RevId: 380033480 -- 40628c34d540356de65fabb16c1439c0ec7a0764 by Abseil Team <absl-team@google.com>: Drop out-of-date documentation about `absl::FixedArray`'s allocator support PiperOrigin-RevId: 379811653 -- e7ad047863ae55c9b7aec0753cfc527a4ea614bc by Evan Brown <ezb@google.com>: Fix a bug in ConvertDeletedToEmptyAndFullToDeleted in which we were copying 1 more cloned control byte than actually exists. When alignof(slot_type)>1, this wouldn't cause a problem because the extra byte is padding. Also change loop bounds to not rely on the fact that capacity_+1 is a multiple of Group::kWidth. PiperOrigin-RevId: 379311830 -- 1a3ba500fb2c33205854eb9258cd6e0fb1061bca by Martijn Vels <mvels@google.com>: Change Ring, EXTERNAL and FLAT tag values to be consecutive values The purpose of this change is to have FLAT = EXTERNAL + 1. Especially in the ring and btree alternative code, there is a common check if a node is a 'plain' edge (EXTERNAL or FLAT), or 'something else'. This change can make that check a single branch, i.e., instead of 'tag == EXTERNAL || tag >= FLAT', we can simply check for 'tag >= EXTERNAL'. Likewise we have some cases where we check for RING, EXTERNAL or FLAT, so we align RING + 1 with EXTERNAL. PiperOrigin-RevId: 379291576 -- 0c78e65ca4d85244b106c3f8e24cf268e09e72a3 by Benjamin Barenblat <bbaren@google.com>: Round a double multiplication before casting it to integer The code static_cast<int>(x * y) (for double x and y) performs a double multiplication into a temporary that, by standard, may have excess precision. The subsequent cast to int discards the excess precision. However, the cast may examine the excess precision during conversion, producing surprising results like static_cast<int>(1.7 * 10) == 16 on certain systems. Correct this case by explicitly rounding 1.7 * 10 before casting it. PiperOrigin-RevId: 378922064 GitOrigin-RevId: b1fc72630aaa81c8395c3b22ba267d938fe29a2e Change-Id: Ica708a006921118673e78d5fd2d61fe0fb0894d1
* Export of internal Abseil changesGravatar Abseil Team2020-11-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -- 03700706d80f0939e2b5b8c02a326f045b643730 by Abseil Team <absl-team@google.com>: Reduced latency and code-size of some InlinedVector methods: 1. Simpler fast path for push_back/emplace_back. 2. Do not inline slow path of push-back/emplace_back. 3. Simplify resize implementation. Performance: A simple benchmark that does the following per iteration: ``` push_back on an InlinedVector<int64> push_back on an InlinedVector<bool> ``` Sees iteration time go from 4.3ns to 2.8ns and code size shrink from 1129 bytes to 175 bytes. PiperOrigin-RevId: 343335635 -- 16f74277a9e8bf228c164b053da8b8098f76de62 by Derek Mauro <dmauro@google.com>: Internal change PiperOrigin-RevId: 343332753 -- 886b6d5d0244783d309e34f03c21710f411e3cb3 by Abseil Team <absl-team@google.com>: Optimize `Status::Status`: When creating a status, we currently create an empty struct first, then assign fields. This is suboptimal: https://screenshot.googleplex.com/5HqDuFBKUEqrVgy. Relevant Benchmarks: ``` BM_StatusCopyError_Deep/threads:1 26.9ns ±13% 21.2ns ±16% -21.46% (p=0.000 n=15+15) BM_StatusCopyError_Deep/threads:2 32.0ns ±30% 25.6ns ±37% -20.17% (p=0.004 n=15+14) BM_StatusCopyError_Deep/threads:4 37.4ns ±84% 30.6ns ±58% -18.26% (p=0.029 n=15+15) BM_StatusCopyError_Deep/threads:8 47.2ns ±33% 33.5ns ±56% -28.91% (p=0.000 n=15+14) ``` PiperOrigin-RevId: 343303312 -- 2f9d945654292e8e52cad410fa41dae794cff42c by Abseil Team <absl-team@google.com>: Set SOVERSION for the installed libraries PiperOrigin-RevId: 343287682 -- 600bbfffe91cfbdc60b43cdad5619258298d0b0d by Abseil Team <absl-team@google.com>: Fix a typo in a comment (than -> that) PiperOrigin-RevId: 343187724 -- 310c82cd97b3f1f0d1ee93a0ee2b0aee828b2a93 by Abseil Team <absl-team@google.com>: Simplify unaligned memory access functions. The #ifdef to produce calls to __sanitizer_unaligned_load16 etc were needed in past versions of this code, when we were lying to the compiler about the alignment of the loads/stores, by using a reinterpret_cast. However, a year ago, absl switched to simply use memcpy. Sanitizers support this correctly by default, nothing extra is required. PiperOrigin-RevId: 343159883 -- bdf6fcf99180c371fda6ba8af82fd44656e372fa by Gennadiy Rozental <rogeeff@google.com>: Migrate usage flags to global variables instead of modeling them as Abseil Flags. Also introduce new semantic for --help=substring command line argument. PiperOrigin-RevId: 343019883 GitOrigin-RevId: 03700706d80f0939e2b5b8c02a326f045b643730 Change-Id: I4ad40dfa9606f8b8bfb2d91fd09e327105311bfb
* Export of internal Abseil changesGravatar Abseil Team2020-06-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -- baf626d27ff1547776745f3b601cc42f703d4bdf by Greg Falcon <gfalcon@google.com>: Import of CCTZ from GitHub. PiperOrigin-RevId: 315486679 -- 39d4e7f9214c5a74e4ee4b8a7f4af26479925029 by Gennadiy Rozental <rogeeff@google.com>: Avoid order dependant test cases. PiperOrigin-RevId: 315327948 -- 8feb187703a28bb0c5cfc5dd6091e3faa90a8e61 by Gennadiy Rozental <rogeeff@google.com>: Avoid order dependant test cases. PiperOrigin-RevId: 315317018 -- cffd8fddad15908ec9de7f21f65b20528972e3fa by Gennadiy Rozental <rogeeff@google.com>: Avoid order dependant test cases. PiperOrigin-RevId: 315311587 -- 48997a0ceb231b75c14eb4b1eb3b66af69e49f42 by Tom Manshreck <shreck@google.com>: Nit: remove extra "the" PiperOrigin-RevId: 314959763 -- 9516f44a4b5d3055427c95e80c8c04a6321e4221 by Gennadiy Rozental <rogeeff@google.com>: Import of CCTZ from GitHub. PiperOrigin-RevId: 314925147 -- 4f8691d74a4eb42ed03ef29c9588a01b78829941 by Abseil Team <absl-team@google.com>: Uninclude util/bits/bits.h PiperOrigin-RevId: 314858384 -- 02b42a8ec5e5561b29b4e5f93cc1482c3c72ef2d by Abseil Team <absl-team@google.com>: Google-internal changes only. PiperOrigin-RevId: 314855667 -- 146013d69dabafbe2030e23ced7b741d9e8d417c by Gennadiy Rozental <rogeeff@google.com>: Uninclude util/bits/bits.h PiperOrigin-RevId: 314838927 GitOrigin-RevId: baf626d27ff1547776745f3b601cc42f703d4bdf Change-Id: I2602286fb13cf35a88bdd80fe0b44974d4388d46
* Export of internal Abseil changesGravatar Abseil Team2020-06-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -- 5b9d5ce21074c0541432555d383d1b9c5898b553 by Gennadiy Rozental <rogeeff@google.com>: Convert FlagSaver into public API PiperOrigin-RevId: 314799739 -- 5f796c9862b1177f161f4b10fe1a84698ebbb5cf by Abseil Team <absl-team@google.com>: Google-internal changes only. PiperOrigin-RevId: 314786474 -- 67f2ae0ac5ae73bcd9d57a058ac4fea8fc1243ba by Gennadiy Rozental <rogeeff@google.com>: Makes sure stacktrace_generic is only used with glibc. Fixes #701 PiperOrigin-RevId: 314726944 -- efb1ef3636b0698b79d3ee3590f12c4dff32a3cb by Samuel Benzaquen <sbenza@google.com>: Take the bits into account when reserving the space for the operation, not just the exponent. PiperOrigin-RevId: 314622744 GitOrigin-RevId: 5b9d5ce21074c0541432555d383d1b9c5898b553 Change-Id: I080a5e333e2dc1545b5aa0417882f7ac7116a20c
* Export of internal Abseil changesGravatar Abseil Team2020-06-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -- 9e8b4a286d70df9487bff080816bd07ae38af5f8 by Evan Brown <ezb@google.com>: Add btree_node::transfer_n/transfer_n_backward and replace usage of uninitialized_move_n and value_destroy_n. PiperOrigin-RevId: 314600027 -- 6c452aa1ee7e46ab941ba7d1fa636da8ea3d7370 by Laramie Leavitt <lar@google.com>: Remove the MockingBitGenBase base class in favor of type-erasure in BitGenRef. In Abseil random, mocking was split across two different classes, MockingBitGenBase and MockingBitGen. This split existed because Google Mock is a test-only library that we don't link into production, so MockingBitGenBase provided a low-overhead scaffold used to lookup mocks when in test code, but which is unused in production code. That has been replaced by type-erasure which looks for a method named CallImpl with the correct signature. Weaken the coupling between MockingBitGen, DistributionCaller, and MockOverloadSet. Rename CallImpl to InvokeMock() Previously, the implementation of DistributionCaller was also split across different files using explicit instantiation of the DistributionCaller struct and some details in the Mocking classes. Now Distribution caller uses the presence of the InvokeMock() method to choose whether to use the mockable call path or the default call path. PiperOrigin-RevId: 314584095 -- 07853c47dc98698d67d65a3b9b662a65ab9def0a by Abseil Team <absl-team@google.com>: Add PC / backtrace / symbolization support for Apple platforms. Full backtrace support requires iOS 9+ PiperOrigin-RevId: 314415072 -- 43889f17a132b31f6558c6482721cbbc776128fd by Gennadiy Rozental <rogeeff@google.com>: Consolidate all reflection interface in the new module 'reflection' and expose interface to locate reflection handle by name. PiperOrigin-RevId: 314390358 GitOrigin-RevId: 9e8b4a286d70df9487bff080816bd07ae38af5f8 Change-Id: I8e0910437740cf9ea9da5000adddfcef127e1158
* Export of internal Abseil changesGravatar Abseil Team2020-05-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -- 7d0468a6610ed85586d5c87fd65de8dac5118923 by Derek Mauro <dmauro@google.com>: Import of CCTZ from GitHub. PiperOrigin-RevId: 313226473 -- 1131ef6d116f5ce7d46537a82f300ea06dcaaa53 by Gennadiy Rozental <rogeeff@google.com>: Migrate internal interface to use mutable references. PiperOrigin-RevId: 312931131 -- 96225212a9f5fbd0b38c71fe65539164992c7c3b by Laramie Leavitt <lar@google.com>: Remove random/internal/distributions.h This file was something of an historical artifact. All of the related code has either been removed or migraged, and so the only remaining type belongs with uniform_helper.h, as it is used to infer the return type of the absl::Uniform method in a few cases. PiperOrigin-RevId: 312878173 -- 6dcbd5be58ad425e08740ff64088373ee7fe4a72 by Mark Barolak <mbar@google.com>: Release the StrFormat test case for Cords to open source. PiperOrigin-RevId: 312707974 -- 34484d18dfb63a0a7ad6e2aaeb570e33592968be by Abseil Team <absl-team@google.com>: Let Cord::Cord(string&&), Cord::operator=(string&&), Cord::Append(string&&), and Cord::Prepend(string&&) steal string data and embed it into the Cord as a single external chunk, instead of copying it into flat chunks (at most 4083-byte each). Stealing string data is faster, but it creates a long chunk, which leads to a higher more memory usage if its subcords are created and outlive the whole Cord. These functions revert to copying the data if any of the following conditions holds: - string size is at most kMaxBytesToCopy (511), to avoid the overhead of an external chunk for short strings; - less than half of string capacity is used, to avoid pinning to much unused memory. PiperOrigin-RevId: 312683785 GitOrigin-RevId: 7d0468a6610ed85586d5c87fd65de8dac5118923 Change-Id: If79b5a1dfe6d53a8ddddbc7da84338f11fc4cfa3
* Export of internal Abseil changesGravatar Abseil Team2020-05-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | -- 47f13ea42ae272c995b1cd5073a45e046fa325eb by Matthew Brown <matthewbr@google.com>: absl::StrFormat: Centralize FormatConversionCharSet vs FormatConversionSpec checking - Move it into a central location, rather than requiring individual overloads to validate. PiperOrigin-RevId: 310583805 -- a567c8fc8032031d551d6b457755851f442e65ad by Gennadiy Rozental <rogeeff@google.com>: Internal change PiperOrigin-RevId: 310427635 -- 49848f7fab9b0f528d33f60cbccf688e2ea68afa by Gennadiy Rozental <rogeeff@google.com>: Make Get/Set private methods of absl::Flag<T>. PiperOrigin-RevId: 310413908 GitOrigin-RevId: 47f13ea42ae272c995b1cd5073a45e046fa325eb Change-Id: I6530c754731c1a9463877561fa61786460ed60af
* Export of internal Abseil changesGravatar Abseil Team2020-04-22
| | | | | | | | | | | | | | | | | | | | -- 692d3df279e7592d01c1008cb85f2a010c3d17da by Abseil Team <absl-team@google.com>: Use EXPECT_DEATH_IF_SUPPORTED instead of raw EXPECT_DEATH. PiperOrigin-RevId: 307802196 -- ebc40936b677b79cad9f87f944794c35946f9dbd by Gennadiy Rozental <rogeeff@google.com>: Eliminate SetCallback from absl::Flag<T> public interface. We also make SetCallback on FlagRegistrar to return rvalue, so that we can add more tail calls after it. PiperOrigin-RevId: 307745935 GitOrigin-RevId: 15f69a9dae9c70c884ce85ca1a4bf359a2609db0 Change-Id: Ibec13463e44e4071c48fb12389f47e716cee7a9d
* Export of internal Abseil changesGravatar Abseil Team2020-01-10
| | | | | | | | | | | | | | | | | | | | | | | | | -- 5448463d79c8473d29b6aae62359eaec09e517b0 by Greg Falcon <gfalcon@google.com>: Rename absl_types_options.h to absl_alternate_options.h, to reflect that we are testing more than just types with this file. PiperOrigin-RevId: 289099882 -- 8008a5662d1b27c4ea442575405eb0538f63a636 by Abseil Team <absl-team@google.com>: Internal change PiperOrigin-RevId: 289097666 -- 0e9398fae540bdb7dd752245b83456f3784c50ca by Abseil Team <absl-team@google.com>: Internal change PiperOrigin-RevId: 288985613 GitOrigin-RevId: 5448463d79c8473d29b6aae62359eaec09e517b0 Change-Id: I5bc1ee156294793cacf3acbc447c0ea27ce8af4f
* Export of internal Abseil changesGravatar Abseil Team2019-12-05
| | | | | | | | | | | | | | | | | | | | | | | | | | -- c385118b3ef0528d150bfe7aeeb63e77f9e463cd by Matt Calabrese <calabrese@google.com>: Internal-only Archetype generation for testing generic code with user-defined types of various properties. PiperOrigin-RevId: 283833099 -- 4ccf340d3b295aa5b796ee5c97128b61d38899ea by Derek Mauro <dmauro@google.com>: Fixes the flags parse_test. Windows doesn't like consecutive path separators. PiperOrigin-RevId: 283614649 -- 5df6d83acb1e49cd1da785cfaf7551f05149f3c9 by Andy Getzendanner <durandal@google.com>: ABSL_INTERNAL_LOG: forward complete __FILE__ to internal_log_function; not just basename. PiperOrigin-RevId: 283406080 GitOrigin-RevId: c385118b3ef0528d150bfe7aeeb63e77f9e463cd Change-Id: Ib0782354691a73fc40185c3262cfd507085b3393
* Export of internal Abseil changes.Gravatar Abseil Team2019-05-07
-- 78293ba4eb4981991ae7e6edd25eb9245fcd7515 by Andy Soffer <asoffer@google.com>: internal changes PiperOrigin-RevId: 247073879 -- 7bd97e3aad0c3012b89a39392a6ad3f254e9f3c3 by Derek Mauro <dmauro@google.com>: Release commandline flags PiperOrigin-RevId: 247065920 -- 2a991849fd7b140a43b073076d194b61533fd199 by Tom Manshreck <shreck@google.com>: Add documentation for built-in usage flags PiperOrigin-RevId: 247058863 -- 14157b0de45841706bbd631284191fd94c313db9 by Derek Mauro <dmauro@google.com>: Internal change PiperOrigin-RevId: 247058292 -- ed67e0a80468596e30540b367727a250fa415b68 by Abseil Team <absl-team@google.com>: Internal Change. PiperOrigin-RevId: 246828655 -- e1bc8c2aa3f90b3d56c55c5b7244e718c919265d by Abseil Team <absl-team@google.com>: Internal change PiperOrigin-RevId: 246822325 -- 907a68f287199f749cb9bdb48571b50bc34731e1 by Eric Fiselier <ericwf@google.com>: Accept vector<bool>::reference in StrCat and friends. Converting vector<bool>::reference to alphanum requires two user defined conversions, which isn't allowed. In order to accept this, we need a special constructor that is only enabled for the bool proxy types. PiperOrigin-RevId: 246626732 -- fe4295fa95cc65dee8c881ba12dd8f516e68c40d by Abseil Team <absl-team@google.com>: Clarify the proper way to define AbslHashValue, and fix confusing indentation. PiperOrigin-RevId: 246406528 -- d7174681a72d4a25c8fd2b4d9f515a0763eff87c by Gennadiy Rozental <rogeeff@google.com>: Internal change PiperOrigin-RevId: 246358214 -- a7fdc19683cf1a5885e9e1af52fcdb2db1eda53b by Abseil Team <absl-team@google.com>: Fix sample template instantiation. PiperOrigin-RevId: 246354617 -- 29a23c6835f872948d09b24d890385bf195bc995 by Abseil Team <absl-team@google.com>: Fix incorrectly copy-pasted static_assert in absl::optional::value_or The static_assert for a move-constructible type previously said the type must be copy-constructible. PiperOrigin-RevId: 246313827 -- 41884d5872d4ea2c67875b00144b8c8a5859a295 by Greg Falcon <gfalcon@google.com>: Import of CCTZ from GitHub. PiperOrigin-RevId: 245418790 -- 7f90a7f94cdd5e21232c749efe952a750b5c43a2 by Abseil Team <absl-team@google.com>: Internal change PiperOrigin-RevId: 245412658 -- 730a329cf047d54b46971fce1781edd857208c2a by Greg Falcon <gfalcon@google.com>: internal change PiperOrigin-RevId: 245293234 -- cf0216be6338200cbb18167d3f3b2e98e372be77 by Greg Falcon <gfalcon@google.com>: Internal change PiperOrigin-RevId: 245288164 GitOrigin-RevId: 78293ba4eb4981991ae7e6edd25eb9245fcd7515 Change-Id: I5ea9a852c36c722bae2d6be65fb7f72473d94ab6