tests: Tidy the util functions #1491

issue real-or-random openend this issue on February 1, 2024
  1. real-or-random commented at 1:29 pm on February 1, 2024: contributor

    When I look at all the helper functions near the top of tests.c, there are still some things that could be improved:

    • A lot of these functions could be moved to testutil or testrand, also functions like random_fe, random_fe_magnitude. They’re currently only in tests.c but they’re utils in the end.
    • We have functions with group_element and field_element, but they should just be ge and fe.
    • The ones in testutil should probably also get a secp256k1_testutil prefix then. You could say it’s good that they stand out currently, but at least that’s inconsistent with the ones in testrand, which have a prefix. Or perhaps better: we use prefixes testutil_ and testrand_, dropping the additional secp256k1_ for test functions. Then they still stand out. (The main purpose of secp256k1_ is to avoid namespace collisions if someone uses the library by just including it, but that doesn’t matter in test-only code.)

    Noticed when looking into #1489.

  2. real-or-random added the label assurance on Feb 1, 2024
  3. real-or-random added the label refactor/smell on Feb 1, 2024
  4. real-or-random referenced this in commit 4392f0f717 on Jun 12, 2024
  5. fanquake commented at 3:10 pm on June 12, 2024: member
    What is left to do here post #1533 ?
  6. real-or-random commented at 3:17 pm on June 12, 2024: contributor

    What is left to do here post #1533 ?

    Nothing, thanks for the reminder.

  7. real-or-random closed this on Jun 12, 2024


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-03 17:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me