Skip to content

feat: map testing/quick - #213

Merged
conr2d merged 3 commits into
mainfrom
feat/testing-quick
Dec 4, 2026
Merged

conr2d merged 3 commits into
mainfrom
feat/testing-quick

Conversation

@4lmighty

@4lmighty 4lmighty commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Builds on #212 (seeded math/rand), which is now on main.

  • <eo/testing/quick.h> ports Go 1.26's quick.go:
    • Value makes Go's sizedValue values through Eo's reflect: booleans, integers, floats, strings, maps, pointers, slices, arrays, and structs.
    • Generator types make their own values, through their value or pointer type.
    • Config has MaxCount, MaxCountScale, Rand, and Values.
    • SetupError, CheckError, and CheckEqualError are Go's.
  • Eo's reflect cannot call a function, so Check and CheckEqual are templates that read the parameter and result types from the lambda or fn type.
    • Each generated value is passed as Value.Call does, converted when it is assignable to the parameter's type. For example, a Generate returning []T can feed a parameter of a defined type over []T.
    • Wrong result types and mismatched function types give Go's SetupErrors at run time.
  • Not covered: complex numbers, coroutine functions, and the -quickchecks flag (the default stays 100).

etcd raft's quorum/quick_test.go, confchange/quick_test.go, and confchange/restore_test.go need this.

Test plan

  • New parity case testing_quick matches Go. With a seeded Rand, it covers:
    • Value for every kind, including nested containers;
    • Generators through both a value and a pointer receiver;
    • Check and CheckEqual, passing and failing, with their error text and fields;
    • Values and MaxCountScale;
    • the setup errors.
  • Mutations: all 19 are killed. They cover each kind's generation, size hints, signs, Generate's size, counts, DeepEqual, Values, and the setup checks.
  • The full Eo suite passes locally (388/388).

🤖 Generated with Claude Code

https://claude.ai/code/session_01WKhFr4YH1YUGTnN1iSi9bQ

4lmighty and others added 3 commits December 4, 2026 08:11
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
@4lmighty 4lmighty added the ci:run label Dec 4, 2026
@conr2d
conr2d merged commit 14c48e7 into main Dec 4, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants