Repository navigation
feat: map testing/quick - #213
Merged
Merged
Conversation
rand.NewSource and rand.New give Go's sequence for every seed: rngSource is a literal port of Go 1.26's rng.go, with its rngCooked table, and Rand's methods are ports of rand.go's. Source and Source64 are interfaces, so a translated type with Int63 and Seed is a source too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WKhFr4YH1YUGTnN1iSi9bQ
A port of Go 1.26's quick.go. Value generates Go's arbitrary values through reflect, from a seeded Rand, and honors Generator types. Check and CheckEqual are templates that read the function's parameter and result types from its C++ type, since Eo's reflect cannot call a function, and pass each generated value as Value.Call does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WKhFr4YH1YUGTnN1iSi9bQ
# Conflicts: # tests/parity/CMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Builds on #212 (seeded
math/rand), which is now on main.<eo/testing/quick.h>ports Go 1.26'squick.go:Valuemakes Go'ssizedValuevalues through Eo'sreflect: booleans, integers, floats, strings, maps, pointers, slices, arrays, and structs.Generatortypes make their own values, through their value or pointer type.ConfighasMaxCount,MaxCountScale,Rand, andValues.SetupError,CheckError, andCheckEqualErrorare Go's.reflectcannot call a function, soCheckandCheckEqualare templates that read the parameter and result types from the lambda orfntype.Value.Calldoes, converted when it is assignable to the parameter's type. For example, aGeneratereturning[]Tcan feed a parameter of a defined type over[]T.SetupErrors at run time.-quickchecksflag (the default stays 100).etcd raft's
quorum/quick_test.go,confchange/quick_test.go, andconfchange/restore_test.goneed this.Test plan
testing_quickmatches Go. With a seededRand, it covers:Valuefor every kind, including nested containers;Generators through both a value and a pointer receiver;CheckandCheckEqual, passing and failing, with their error text and fields;ValuesandMaxCountScale;Generate's size, counts,DeepEqual,Values, and the setup checks.🤖 Generated with Claude Code
https://claude.ai/code/session_01WKhFr4YH1YUGTnN1iSi9bQ