Skip to content

[reconfigurator] improvements to blueprint displays and tests#5248

Merged
sunshowers merged 2 commits into
mainfrom
sunshowers/spr/reconfigurator-improvements-to-blueprint-displays-and-tests
Mar 13, 2024
Merged

[reconfigurator] improvements to blueprint displays and tests#5248
sunshowers merged 2 commits into
mainfrom
sunshowers/spr/reconfigurator-improvements-to-blueprint-displays-and-tests

Conversation

@sunshowers

@sunshowers sunshowers commented Mar 13, 2024

Copy link
Copy Markdown
Contributor

Bundles up a few changes:

  1. Moves fmt::Debug for Blueprint to a display method. fmt::Debug output should ideally look close enough to standard fmt::Debug output, so moving this to some kind of fmt::Display is good.

    But why move this to its own struct? Two reasons:

    1. It can be somewhat surprising to get a massive multi-line output just by printing a fmt::Display impl. Using display makes this explicit.
    2. In the future, if we want more output customization (e.g. colorized output), the struct gives us a place to hang that customization off of.
  2. By the same logic as above, moves diff display to its own struct as well.

  3. Adds snapshot tests to ensure that changes to display output aren't surprising.

  4. To achieve this, adds determinism to each test by using a tree of RNGs. Initially these RNGs are seeded from entropy, but we can also choose to seed them from any fixed hashable value.

    This tree of RNG approach is pretty standard in things like roguelikes, where I first came across it. It works quite well.

Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
@sunshowers sunshowers merged commit 20b9b00 into main Mar 13, 2024
@sunshowers sunshowers deleted the sunshowers/spr/reconfigurator-improvements-to-blueprint-displays-and-tests branch March 13, 2024 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants