mirror of
https://github.com/tailix/libkernaux.git
synced 2025-04-14 17:32:55 -04:00
Ruby: add original tests for KernAux.sprintf
This commit is contained in:
parent
9a1a932e7e
commit
9995d986ac
1 changed files with 13 additions and 0 deletions
|
@ -204,6 +204,19 @@ RSpec.describe KernAux, '.sprintf' do
|
|||
['1234ABCD ', ['%0-20X', 305_441_741]],
|
||||
['EDCB5433 ', ['%0-20X', 3_989_525_555]],
|
||||
['x ', ['%0-20c', 'x']],
|
||||
# padding 20
|
||||
['00000000000000001024', ['%020d', 1024]],
|
||||
['-0000000000000001024', ['%020d', -1024]],
|
||||
['00000000000000001024', ['%020i', 1024]],
|
||||
['-0000000000000001024', ['%020i', -1024]],
|
||||
['00000000000000001024', ['%020u', 1024]],
|
||||
['00000000004294966272', ['%020u', 4_294_966_272]],
|
||||
['00000000000000000777', ['%020o', 511]],
|
||||
['00000000037777777001', ['%020o', 4_294_966_785]],
|
||||
['0000000000001234abcd', ['%020x', 305_441_741]],
|
||||
['000000000000edcb5433', ['%020x', 3_989_525_555]],
|
||||
['0000000000001234ABCD', ['%020X', 305_441_741]],
|
||||
['000000000000EDCB5433', ['%020X', 3_989_525_555]],
|
||||
].each do |expected, *args|
|
||||
it "transforms #{args.inspect} to #{expected.inspect}" do
|
||||
expect(described_class.sprintf(*args)).to eq expected
|
||||
|
|
Loading…
Add table
Reference in a new issue