1
0
Fork 0
mirror of https://github.com/tailix/libkernaux.git synced 2024-10-30 11:54:01 -04:00
libkernaux/common/printf_orig.yml
Alex Kotov 0922a18e70
Maintenance (#98)
* Fix copyright
* Remove thanks
* Update CONTRIBUTING.md
* Remove bitfields from struct KernAux_Arch_I386_TSS
* Change description of package "mbr"
* Make generic file stable
* Rename printf examples
2022-06-25 20:28:28 +00:00

667 lines
16 KiB
YAML

# The code was taken from Marco Paland's printf.
# Copyright (c) 2014-2019 Marco Paland <info@paland.com>
# Copyright (c) 2021-2022 Alex Kotov
# TODO: add remaining tests from
# https://github.com/mpaland/printf/blob/master/test/test_suite.cpp
- result: ' 4232'
args: [['% d', 4232]]
- result: 'This is a test of 12EF'
args: [['This is a test of %X', 0x12ef]]
- result: '-1000'
args: [['%d', -1000]]
- result: '-1'
args: [['%d', -1]]
- result: '2345'
args: [['%d', 2345]]
- result: '3 -1000 test'
args: [['%d ', 3], ['%d', -1000], [' %s', 'test']]
- result: '3 -1000 test'
args: [['%d ', 3], ['%d ', -1000], ['%s', 'test']]
- result: '3 -1000 test'
args: [['%d', 3], [' %d', -1000], [' %s', 'test']]
- result: '3 -1000 test'
args: [['%d', 3], ' ', ['%d', -1000], ' ', ['%s', 'test']]
# space flag
- result: ' 42'
args: [['% d', 42]]
- result: '-42'
args: [['% d', -42]]
- result: ' 42'
args: [['% 5d', 42]]
- result: ' -42'
args: [['% 5d', -42]]
- result: ' 42'
args: [['% 15d', 42]]
- result: ' -42'
args: [['% 15d', -42]]
- result: ' -42.987'
args: [['% 15.3f', -42.987]]
float: true
- result: ' 42.987'
args: [['% 15.3f', 42.987]]
float: true
- result: 'Hello testing'
args: [['% s', 'Hello testing']]
- result: ' 1024'
args: [['% d', 1024]]
- result: '-1024'
args: [['% d', -1024]]
- result: ' 1024'
args: [['% i', 1024]]
- result: '-1024'
args: [['% i', -1024]]
- result: '1024'
args: [['% u', 1024]]
- result: '4294966272'
args: [['% u', 4294966272]]
- result: '777'
args: [['% o', 511]]
- result: '37777777001'
args: [['% o', 4294966785]]
- result: '1234abcd'
args: [['% x', 305441741]]
- result: 'edcb5433'
args: [['% x', 3989525555]]
- result: '1234ABCD'
args: [['% X', 305441741]]
- result: 'EDCB5433'
args: [['% X', 3989525555]]
- result: 'x'
args: [['% c', ['x']]]
# + flag
- result: '+42'
args: [['%+d', 42]]
- result: '-42'
args: [['%+d', -42]]
- result: ' +42'
args: [['%+5d', 42]]
- result: ' -42'
args: [['%+5d', -42]]
- result: ' +42'
args: [['%+15d', 42]]
- result: ' -42'
args: [['%+15d', -42]]
- result: 'Hello testing'
args: [['%+s', 'Hello testing']]
- result: '+1024'
args: [['%+d', 1024]]
- result: '-1024'
args: [['%+d', -1024]]
- result: '+1024'
args: [['%+i', 1024]]
- result: '-1024'
args: [['%+i', -1024]]
- result: '1024'
args: [['%+u', 1024]]
- result: '4294966272'
args: [['%+u', 4294966272]]
- result: '777'
args: [['%+o', 511]]
- result: '37777777001'
args: [['%+o', 4294966785]]
- result: '1234abcd'
args: [['%+x', 305441741]]
- result: 'edcb5433'
args: [['%+x', 3989525555]]
- result: '1234ABCD'
args: [['%+X', 305441741]]
- result: 'EDCB5433'
args: [['%+X', 3989525555]]
- result: 'x'
args: [['%+c', ['x']]]
- result: '+'
args: [['%+.0d', 0]]
# 0 flag
- result: '42'
args: [['%0d', 42]]
- result: '42'
args: [['%0ld', 42]]
- result: '-42'
args: [['%0d', -42]]
- result: '00042'
args: [['%05d', 42]]
- result: '-0042'
args: [['%05d', -42]]
- result: '000000000000042'
args: [['%015d', 42]]
- result: '-00000000000042'
args: [['%015d', -42]]
- result: '000000000042.12'
args: [['%015.2f', 42.1234]]
float: true
- result: '00000000042.988'
args: [['%015.3f', 42.9876]]
float: true
- result: '-00000042.98760'
args: [['%015.5f', -42.9876]]
float: true
# - flag
- result: '42'
args: [['%-d', 42]]
- result: '-42'
args: [['%-d', -42]]
- result: '42 '
args: [['%-5d', 42]]
- result: '-42 '
args: [['%-5d', -42]]
- result: '42 '
args: [['%-15d', 42]]
- result: '-42 '
args: [['%-15d', -42]]
- result: '42'
args: [['%-0d', 42]]
- result: '-42'
args: [['%-0d', -42]]
- result: '42 '
args: [['%-05d', 42]]
- result: '-42 '
args: [['%-05d', -42]]
- result: '42 '
args: [['%-015d', 42]]
- result: '-42 '
args: [['%-015d', -42]]
- result: '42'
args: [['%0-d', 42]]
- result: '-42'
args: [['%0-d', -42]]
- result: '42 '
args: [['%0-5d', 42]]
- result: '-42 '
args: [['%0-5d', -42]]
- result: '42 '
args: [['%0-15d', 42]]
- result: '-42 '
args: [['%0-15d', -42]]
- result: '-4.200e+01 '
args: [['%0-15.3e', -42.0]]
float: true
- result: '-42.0 '
args: [['%0-15.3g', -42.0]]
float: true
# # flag
- result: ''
args: [['%#.0x', 0]]
- result: '0'
args: [['%#.1x', 0]]
- result: ''
args: [['%#.0llx', ['long long', 0]]]
- result: '0x0000614e'
args: [['%#.8x', 0x614e]]
- result: '0b110'
args: [['%#b', 6]]
# specifier
- result: 'Hello testing'
args: ['Hello testing']
- result: 'Hello testing'
args: [['Hello testing%s', '']]
- result: 'Hello testing'
args: [['%s', 'Hello testing']]
- result: '1024'
args: [['%d', 1024]]
- result: '-1024'
args: [['%d', -1024]]
- result: '1024'
args: [['%i', 1024]]
- result: '-1024'
args: [['%i', -1024]]
- result: '1024'
args: [['%u', 1024]]
- result: '4294966272'
args: [['%u', 4294966272]]
- result: '777'
args: [['%o', 511]]
- result: '37777777001'
args: [['%o', 4294966785]]
- result: '1234abcd'
args: [['%x', 305441741]]
- result: 'edcb5433'
args: [['%x', 3989525555]]
- result: '1234ABCD'
args: [['%X', 305441741]]
- result: 'EDCB5433'
args: [['%X', 3989525555]]
- result: '%'
args: [['%%']]
# width
- result: 'Hello testing'
args: [['%1s', 'Hello testing']]
- result: '1024'
args: [['%1d', 1024]]
- result: '-1024'
args: [['%1d', -1024]]
- result: '1024'
args: [['%1i', 1024]]
- result: '-1024'
args: [['%1i', -1024]]
- result: '1024'
args: [['%1u', 1024]]
- result: '4294966272'
args: [['%1u', 4294966272]]
- result: '777'
args: [['%1o', 511]]
- result: '37777777001'
args: [['%1o', 4294966785]]
- result: '1234abcd'
args: [['%1x', 305441741]]
- result: 'edcb5433'
args: [['%1x', 3989525555]]
- result: '1234ABCD'
args: [['%1X', 305441741]]
- result: 'EDCB5433'
args: [['%1X', 3989525555]]
- result: 'x'
args: [['%1c', ['x']]]
# width 20
- result: ' Hello testing'
args: [['%20s', 'Hello testing']]
- result: ' 1024'
args: [['%20d', 1024]]
- result: ' -1024'
args: [['%20d', -1024]]
- result: ' 1024'
args: [['%20i', 1024]]
- result: ' -1024'
args: [['%20i', -1024]]
- result: ' 1024'
args: [['%20u', 1024]]
- result: ' 4294966272'
args: [['%20u', 4294966272]]
- result: ' 777'
args: [['%20o', 511]]
- result: ' 37777777001'
args: [['%20o', 4294966785]]
- result: ' 1234abcd'
args: [['%20x', 305441741]]
- result: ' edcb5433'
args: [['%20x', 3989525555]]
- result: ' 1234ABCD'
args: [['%20X', 305441741]]
- result: ' EDCB5433'
args: [['%20X', 3989525555]]
- result: ' x'
args: [['%20c', ['x']]]
# width *20
- result: ' Hello'
args: [['%*s', 20, 'Hello']]
- result: ' 1024'
args: [['%*d', 20, 1024]]
- result: ' -1024'
args: [['%*d', 20, -1024]]
- result: ' 1024'
args: [['%*i', 20, 1024]]
- result: ' -1024'
args: [['%*i', 20, -1024]]
- result: ' 1024'
args: [['%*u', 20, 1024]]
- result: ' 4294966272'
args: [['%*u', 20, 4294966272]]
- result: ' 777'
args: [['%*o', 20, 511]]
- result: ' 37777777001'
args: [['%*o', 20, 4294966785]]
- result: ' 1234abcd'
args: [['%*x', 20, 305441741]]
- result: ' edcb5433'
args: [['%*x', 20, 3989525555]]
- result: ' 1234ABCD'
args: [['%*X', 20, 305441741]]
- result: ' EDCB5433'
args: [['%*X', 20, 3989525555]]
- result: ' x'
args: [['%*c', 20, ['x']]]
# width -20
- result: 'Hello '
args: [['%-20s', 'Hello']]
- result: '1024 '
args: [['%-20d', 1024]]
- result: '-1024 '
args: [['%-20d', -1024]]
- result: '1024 '
args: [['%-20i', 1024]]
- result: '-1024 '
args: [['%-20i', -1024]]
- result: '1024 '
args: [['%-20u', 1024]]
- result: '1024.1234 '
args: [['%-20.4f', 1024.1234]]
float: true
- result: '4294966272 '
args: [['%-20u', 4294966272]]
- result: '777 '
args: [['%-20o', 511]]
- result: '37777777001 '
args: [['%-20o', 4294966785]]
- result: '1234abcd '
args: [['%-20x', 305441741]]
- result: 'edcb5433 '
args: [['%-20x', 3989525555]]
- result: '1234ABCD '
args: [['%-20X', 305441741]]
- result: 'EDCB5433 '
args: [['%-20X', 3989525555]]
- result: 'x '
args: [['%-20c', ['x']]]
- result: '| 9| |9 | | 9|'
args: [['|%5d| ', 9], ['|%-2d|', 9], [' |%5d|', 9]]
- result: '| 10| |10| | 10|'
args: [['|%5d| ', 10], ['|%-2d|', 10], [' |%5d|', 10]]
- result: '| 9| |9 | | 9|'
args: [['|%5d| ', 9], ['|%-12d|', 9], [' |%5d|', 9]]
- result: '| 10| |10 | | 10|'
args: [['|%5d| ', 10], ['|%-12d|', 10], [' |%5d|', 10]]
# width 0-20
- result: 'Hello '
args: [['%0-20s', 'Hello']]
- result: '1024 '
args: [['%0-20d', 1024]]
- result: '-1024 '
args: [['%0-20d', -1024]]
- result: '1024 '
args: [['%0-20i', 1024]]
- result: '-1024 '
args: [['%0-20i', -1024]]
- result: '1024 '
args: [['%0-20u', 1024]]
- result: '4294966272 '
args: [['%0-20u', 4294966272]]
- result: '777 '
args: [['%0-20o', 511]]
- result: '37777777001 '
args: [['%0-20o', 4294966785]]
- result: '1234abcd '
args: [['%0-20x', 305441741]]
- result: 'edcb5433 '
args: [['%0-20x', 3989525555]]
- result: '1234ABCD '
args: [['%0-20X', 305441741]]
- result: 'EDCB5433 '
args: [['%0-20X', 3989525555]]
- result: 'x '
args: [['%0-20c', ['x']]]
# padding 20
- result: '00000000000000001024'
args: [['%020d', 1024]]
- result: '-0000000000000001024'
args: [['%020d', -1024]]
- result: '00000000000000001024'
args: [['%020i', 1024]]
- result: '-0000000000000001024'
args: [['%020i', -1024]]
- result: '00000000000000001024'
args: [['%020u', 1024]]
- result: '00000000004294966272'
args: [['%020u', 4294966272]]
- result: '00000000000000000777'
args: [['%020o', 511]]
- result: '00000000037777777001'
args: [['%020o', 4294966785]]
- result: '0000000000001234abcd'
args: [['%020x', 305441741]]
- result: '000000000000edcb5433'
args: [['%020x', 3989525555]]
- result: '0000000000001234ABCD'
args: [['%020X', 305441741]]
- result: '000000000000EDCB5433'
args: [['%020X', 3989525555]]
# padding .20
- result: '00000000000000001024'
args: [['%.20d', 1024]]
- result: '-00000000000000001024'
args: [['%.20d', -1024]]
- result: '00000000000000001024'
args: [['%.20i', 1024]]
- result: '-00000000000000001024'
args: [['%.20i', -1024]]
- result: '00000000000000001024'
args: [['%.20u', 1024]]
- result: '00000000004294966272'
args: [['%.20u', 4294966272]]
- result: '00000000000000000777'
args: [['%.20o', 511]]
- result: '00000000037777777001'
args: [['%.20o', 4294966785]]
- result: '0000000000001234abcd'
args: [['%.20x', 305441741]]
- result: '000000000000edcb5433'
args: [['%.20x', 3989525555]]
- result: '0000000000001234ABCD'
args: [['%.20X', 305441741]]
- result: '000000000000EDCB5433'
args: [['%.20X', 3989525555]]
# padding #020
- result: '00000000000000001024'
args: [['%#020d', 1024]]
- result: '-0000000000000001024'
args: [['%#020d', -1024]]
- result: '00000000000000001024'
args: [['%#020i', 1024]]
- result: '-0000000000000001024'
args: [['%#020i', -1024]]
- result: '00000000000000001024'
args: [['%#020u', 1024]]
- result: '00000000004294966272'
args: [['%#020u', 4294966272]]
- result: '00000000000000000777'
args: [['%#020o', 511]]
- result: '00000000037777777001'
args: [['%#020o', 4294966785]]
- result: '0x00000000001234abcd'
args: [['%#020x', 305441741]]
- result: '0x0000000000edcb5433'
args: [['%#020x', 3989525555]]
- result: '0X00000000001234ABCD'
args: [['%#020X', 305441741]]
- result: '0X0000000000EDCB5433'
args: [['%#020X', 3989525555]]
# padding #20
- result: ' 1024'
args: [['%#20d', 1024]]
- result: ' -1024'
args: [['%#20d', -1024]]
- result: ' 1024'
args: [['%#20i', 1024]]
- result: ' -1024'
args: [['%#20i', -1024]]
- result: ' 1024'
args: [['%#20u', 1024]]
- result: ' 4294966272'
args: [['%#20u', 4294966272]]
- result: ' 0777'
args: [['%#20o', 511]]
- result: ' 037777777001'
args: [['%#20o', 4294966785]]
- result: ' 0x1234abcd'
args: [['%#20x', 305441741]]
- result: ' 0xedcb5433'
args: [['%#20x', 3989525555]]
- result: ' 0X1234ABCD'
args: [['%#20X', 305441741]]
- result: ' 0XEDCB5433'
args: [['%#20X', 3989525555]]
# padding 20.5
- result: ' 01024'
args: [['%20.5d', 1024]]
- result: ' -01024'
args: [['%20.5d', -1024]]
- result: ' 01024'
args: [['%20.5i', 1024]]
- result: ' -01024'
args: [['%20.5i', -1024]]
- result: ' 01024'
args: [['%20.5u', 1024]]
- result: ' 4294966272'
args: [['%20.5u', 4294966272]]
- result: ' 00777'
args: [['%20.5o', 511]]
- result: ' 37777777001'
args: [['%20.5o', 4294966785]]
- result: ' 1234abcd'
args: [['%20.5x', 305441741]]
- result: ' 00edcb5433'
args: [['%20.10x', 3989525555]]
- result: ' 1234ABCD'
args: [['%20.5X', 305441741]]
- result: ' 00EDCB5433'
args: [['%20.10X', 3989525555]]
# padding neg numbers
# space padding
- result: '-5'
args: [['% 1d', -5]]
- result: '-5'
args: [['% 2d', -5]]
- result: ' -5'
args: [['% 3d', -5]]
- result: ' -5'
args: [['% 4d', -5]]
# zero padding
- result: '-5'
args: [['%01d', -5]]
- result: '-5'
args: [['%02d', -5]]
- result: '-05'
args: [['%03d', -5]]
- result: '-005'
args: [['%04d', -5]]
# float padding neg numbers
# space padding
- result: '-5.0'
args: [['% 3.1f', -5.0]]
float: true
- result: '-5.0'
args: [['% 4.1f', -5.0]]
float: true
- result: ' -5.0'
args: [['% 5.1f', -5.0]]
float: true
- result: ' -5'
args: [['% 6.1g', -5.0]]
float: true
- result: '-5.0e+00'
args: [['% 6.1e', -5.0]]
float: true
- result: ' -5.0e+00'
args: [['% 10.1e', -5.0]]
float: true
# zero padding
- result: '-5.0'
args: [['%03.1f', -5.0]]
float: true
- result: '-5.0'
args: [['%04.1f', -5.0]]
float: true
- result: '-05.0'
args: [['%05.1f', -5.0]]
float: true
# zero padding no decimal point
- result: '-5'
args: [['%01.0f', -5.0]]
float: true
- result: '-5'
args: [['%02.0f', -5.0]]
float: true
- result: '-05'
args: [['%03.0f', -5.0]]
float: true
- result: '-005.0e+00'
args: [['%010.1e', -5.0]]
float: true
- result: '-05E+00'
args: [['%07.0E', -5.0]]
float: true
- result: '-05'
args: [['%03.0g', -5.0]]
float: true
# length
- result: ''
args: [['%.0s', 'Hello testing']]
- result: ' '
args: [['%20.0s', 'Hello testing']]
- result: ''
args: [['%.s', 'Hello testing']]
- result: ' '
args: [['%20.s', 'Hello testing']]
- result: ' 1024'
args: [['%20.0d', 1024]]
- result: ' -1024'
args: [['%20.0d', -1024]]
- result: ' '
args: [['%20.d', 0]]
- result: ' 1024'
args: [['%20.0i', 1024]]
- result: ' -1024'
args: [['%20.i', -1024]]
- result: ' '
args: [['%20.i', 0]]
- result: ' 1024'
args: [['%20.u', 1024]]
- result: ' 4294966272'
args: [['%20.0u', 4294966272]]
- result: ' '
args: [['%20.u', 0]]
- result: ' 777'
args: [['%20.o', 511]]
- result: ' 37777777001'
args: [['%20.0o', 4294966785]]
- result: ' '
args: [['%20.o', 0]]
- result: ' 1234abcd'
args: [['%20.x', 305441741]]
- result: ' 1234abcd'
args: [['%50.x', 305441741]]
- result: ' 1234abcd 12345'
args: [['%50.x', 305441741], ['%10.u', 12345]]
- result: ' edcb5433'
args: [['%20.0x', 3989525555]]
- result: ' '
args: [['%20.x', 0]]
- result: ' 1234ABCD'
args: [['%20.X', 305441741]]
- result: ' EDCB5433'
args: [['%20.0X', 3989525555]]
- result: ' '
args: [['%20.X', 0]]
- result: ' '
args: [['%02.0u', 0]]
- result: ' '
args: [['%02.0d', 0]]