Skip to content

Combine a parameterized test case's argument IDs into a single hashed ID#1799

Open
suzannaratcliff wants to merge 1 commit into
swiftlang:mainfrom
suzannaratcliff:suzysilver/hash-arg-ids-together
Open

Combine a parameterized test case's argument IDs into a single hashed ID#1799
suzannaratcliff wants to merge 1 commit into
swiftlang:mainfrom
suzannaratcliff:suzysilver/hash-arg-ids-together

Conversation

@suzannaratcliff

Copy link
Copy Markdown
Contributor

Combine a parameterized test case's argument IDs into a single hashed ID

Motivation:

Test.Case.ID.argumentIDs previously stored one Argument.ID per argument, in order. This meant the ID grew with the number of parameters. I want to simplify this to a single combined ID that identifies the whole combination of arguments.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

/// together, so that argument boundaries are preserved.
init(combining argumentIDs: some Sequence<Test.Case.Argument.ID>) {
var bytes = [UInt8]()
for argumentID in argumentIDs {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this list is only length 1 should I skip the hashing?

init(combining argumentIDs: some Sequence<Test.Case.Argument.ID>) {
var bytes = [UInt8]()
for argumentID in argumentIDs {
var count = UInt64(argumentID.bytes.count).littleEndian

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this ID to be stable across architectures? It may be sufficient to just encode the Int.

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