Commit b77b1513
b77b151344b6Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 7 months ago · 2 files · +1 added · ~1 modified
Description
test: cover float_array shuffle and String#% str_array form
Extend bm_shuffle.rb with FloatArray cases plus empty/single-element edges (the latter two regression-test the loop bounds in sp_*_shuffle_bang). New bm_str_format_arr.rb covers sp_str_format_strarr on the cases the runtime supports cleanly: single placeholder, multiple placeholders, %% literal, surrounding text, extra-args-ignored, and no-placeholders-args-ignored. Strict CRuby semantics (ArgumentError on too-few args) are intentionally not tested — the helper currently fills missing slots with the empty string, and matching CRuby's error would be a separate behavioural change.
Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]
Details
- Commit
- b77b151344b6
- Parent
- c0c0d0b0a12c
test/bm_shuffle.rbmodifiedView file
nums.shuffle!puts nums.lengthputs nums.sort.join(",")# FloatArrayfloats = [1.5, 2.5, 3.5, 4.5]fs = floats.shuffleputs fs.length # 4puts floats.length # 4 (original unchanged)floats.shuffle!puts floats.length # 4 (in-place, length stable)# Empty / single-element edge cases stay stable.empty = []empty.shuffle!puts empty.length # 0one = [42]one.shuffle!puts one[0] # 42test/bm_str_format_arr.rbaddedView file
Loading diff…