You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
source_cell: replace #define private public with named friend grants in four tests (#7949)
`magnetism_test`, `atom_pseudo_test`, `pseudo_nc_test` and `read_pp_test` each
switched off access control for their whole translation unit in order to call a
handful of private *methods* -- the format readers and helpers the tests exist
to exercise. No private data member is involved, and none of these files touches
PARAM, so the macro had exactly one cause.
Replace it with an explicit `friend class <fixture>;` on the class under test,
following the existing precedent in source_pw/module_pwdft/dftu_base.h
(`friend class DFTUTest;`) and parameter.h (`friend class TestParameters;`).
This is the fix AGENTS.md rule 10 names, and it narrows a whole-TU override --
which also reinterprets access control inside every standard library header the
TU pulls in -- down to one named, reviewable grant per fixture.
Friendship is not inherited, and a TEST_F body lives in a class derived from the
fixture, so each fixture gains thin forwarding wrappers and the TEST_F bodies
call those. dftu_lcao_test.cpp already documents and uses this arrangement.
- Magnetism: friend MagnetismTest, 1 wrapper (judge_parallel), 2 call sites.
- Pseudopot_upf: friend AtomPseudoTest / NCPPTest / ReadPPTest; 1 + 3 + 8
wrappers for read_pseudo_upf{,201,_vwr,_blps}, set_pseudo_type, setqfnew,
trim, trimend, complete_default_{h,atom}; 36 call sites in total.
Public members and public methods the tests already used -- Pseudopot_upf's
complete_default, init_pseudo_reader, average_p, set_upf_q, set_empty_element,
print_pseudo_upf and its public data, and Magnetism's tot_mag/abs_mag/start_mag
-- are untouched and still accessed directly.
No test expectation changed: every wrapper forwards its arguments unmodified and
returns what the private method returns. Macro occurrences in these four files
go 4 -> 0; no `#undef private` is introduced anywhere, and no file whose macro
survives is touched.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
0 commit comments