From 8baa7088db7054876fe006e22cb2f4d1ced09b1d Mon Sep 17 00:00:00 2001 From: Andrea Zoppi Date: Sun, 25 Feb 2024 23:38:27 +0100 Subject: [PATCH] Added `hexdump` command Signed-off-by: Andrea Zoppi --- src/hexrec/cli.py | 285 +++++++++ src/hexrec/hexdump.py | 568 ++++++++++++++++++ src/hexrec/xxd.py | 4 +- tests/test_cli.py | 46 +- tests/test_hexdump.py | 163 +++++ tests/test_hexdump/bytes.bin | Bin 0 -> 253 bytes tests/test_hexdump/genfiles.sh | 30 + tests/test_hexdump/test_hd_-U_bytes.bin.hd | 17 + tests/test_hexdump/test_hd_-X__bytes.bin.hd | 33 + tests/test_hexdump/test_hd_-b_bytes.bin.hd | 33 + tests/test_hexdump/test_hd_-c_bytes.bin.hd | 33 + tests/test_hexdump/test_hd_-d_bytes.bin.hd | 33 + .../test_hexdump/test_hd_-n_128_bytes.bin.hd | 9 + tests/test_hexdump/test_hd_-o_bytes.bin.hd | 33 + .../test_hd_-s_128_-n_64_bytes.bin.hd | 5 + tests/test_hexdump/test_hd_-s_32_bytes.bin.hd | 15 + tests/test_hexdump/test_hd_-v_wildcard.bin.hd | 21 + tests/test_hexdump/test_hd_-x_bytes.bin.hd | 33 + tests/test_hexdump/test_hd_bytes.bin.hd | 17 + tests/test_hexdump/test_hd_wildcard.bin.hd | 19 + .../test_hexdump_-C__bytes.bin.hexdump | 17 + .../test_hexdump_-U_bytes.bin.hexdump | 17 + .../test_hexdump_-X__bytes.bin.hexdump | 17 + .../test_hexdump_-b_bytes.bin.hexdump | 17 + .../test_hexdump_-c_bytes.bin.hexdump | 17 + .../test_hexdump_-d_bytes.bin.hexdump | 17 + .../test_hexdump_-n_128_bytes.bin.hexdump | 9 + .../test_hexdump_-o_bytes.bin.hexdump | 17 + ...est_hexdump_-s_128_-n_64_bytes.bin.hexdump | 5 + .../test_hexdump_-s_32_bytes.bin.hexdump | 15 + .../test_hexdump_-v_wildcard.bin.hexdump | 21 + .../test_hexdump_-x_bytes.bin.hexdump | 17 + .../test_hexdump_bytes.bin.hexdump | 17 + .../test_hexdump_wildcard.bin.hexdump | 19 + tests/test_hexdump/wildcard.bin | Bin 0 -> 307 bytes 35 files changed, 1604 insertions(+), 15 deletions(-) create mode 100644 src/hexrec/hexdump.py create mode 100644 tests/test_hexdump.py create mode 100644 tests/test_hexdump/bytes.bin create mode 100644 tests/test_hexdump/genfiles.sh create mode 100644 tests/test_hexdump/test_hd_-U_bytes.bin.hd create mode 100644 tests/test_hexdump/test_hd_-X__bytes.bin.hd create mode 100644 tests/test_hexdump/test_hd_-b_bytes.bin.hd create mode 100644 tests/test_hexdump/test_hd_-c_bytes.bin.hd create mode 100644 tests/test_hexdump/test_hd_-d_bytes.bin.hd create mode 100644 tests/test_hexdump/test_hd_-n_128_bytes.bin.hd create mode 100644 tests/test_hexdump/test_hd_-o_bytes.bin.hd create mode 100644 tests/test_hexdump/test_hd_-s_128_-n_64_bytes.bin.hd create mode 100644 tests/test_hexdump/test_hd_-s_32_bytes.bin.hd create mode 100644 tests/test_hexdump/test_hd_-v_wildcard.bin.hd create mode 100644 tests/test_hexdump/test_hd_-x_bytes.bin.hd create mode 100644 tests/test_hexdump/test_hd_bytes.bin.hd create mode 100644 tests/test_hexdump/test_hd_wildcard.bin.hd create mode 100644 tests/test_hexdump/test_hexdump_-C__bytes.bin.hexdump create mode 100644 tests/test_hexdump/test_hexdump_-U_bytes.bin.hexdump create mode 100644 tests/test_hexdump/test_hexdump_-X__bytes.bin.hexdump create mode 100644 tests/test_hexdump/test_hexdump_-b_bytes.bin.hexdump create mode 100644 tests/test_hexdump/test_hexdump_-c_bytes.bin.hexdump create mode 100644 tests/test_hexdump/test_hexdump_-d_bytes.bin.hexdump create mode 100644 tests/test_hexdump/test_hexdump_-n_128_bytes.bin.hexdump create mode 100644 tests/test_hexdump/test_hexdump_-o_bytes.bin.hexdump create mode 100644 tests/test_hexdump/test_hexdump_-s_128_-n_64_bytes.bin.hexdump create mode 100644 tests/test_hexdump/test_hexdump_-s_32_bytes.bin.hexdump create mode 100644 tests/test_hexdump/test_hexdump_-v_wildcard.bin.hexdump create mode 100644 tests/test_hexdump/test_hexdump_-x_bytes.bin.hexdump create mode 100644 tests/test_hexdump/test_hexdump_bytes.bin.hexdump create mode 100644 tests/test_hexdump/test_hexdump_wildcard.bin.hexdump create mode 100644 tests/test_hexdump/wildcard.bin diff --git a/src/hexrec/cli.py b/src/hexrec/cli.py index 11fb7d1..b84137e 100644 --- a/src/hexrec/cli.py +++ b/src/hexrec/cli.py @@ -56,6 +56,7 @@ from .base import guess_format_name from .formats.srec import SrecFile from .formats.srec import SrecRecord +from .hexdump import hexdump as hexdump_core from .utils import hexlify from .utils import parse_int from .utils import unhexlify @@ -85,6 +86,17 @@ def convert(self, value, param, ctx): self.fail(f'invalid byte: {value!r}', param, ctx) +class OrderedOptionsCommand(click.Command): + + def parse_args(self, ctx, args): + + parser = self.make_parser(ctx) + opts, _, order = parser.parse_args(args=list(args)) + ordered_options = [(param, opts[param.name]) for param in order] + setattr(self, 'ordered_options', ordered_options) + return super().parse_args(ctx, args) + + BASED_INT = BasedIntParamType() BYTE_INT = ByteIntParamType() @@ -170,6 +182,15 @@ def print_version(ctx, _, value): ctx.exit() +def print_hexdump_version(ctx, _, value): + + if not value or ctx.resilient_parsing: + return + + click.echo(f'hexdump from Python hexrec {__version__!s}') + ctx.exit() + + # ---------------------------------------------------------------------------- class SingleFileInOutCtxMgr: @@ -584,6 +605,270 @@ def flood( ctx.output_file.flood(start=start, endex=endex, pattern=value) +# ---------------------------------------------------------------------------- + +# noinspection PyShadowingBuiltins +@main.command(cls=OrderedOptionsCommand, + context_settings=dict(help_option_names=['-h', '--help'])) +@click.option('-b', '--one-byte-octal', 'one_byte_octal', is_flag=True, + multiple=True, help=""" + One-byte octal display. Display the input offset in + hexadecimal, followed by sixteen space-separated, + three-column, zero-filled bytes of input data, in octal, per + line. +""") +@click.option('-X', '--one-byte-hex', 'one_byte_hex', is_flag=True, + multiple=True, help=""" + One-byte hexadecimal display. Display the input offset in + hexadecimal, followed by sixteen space-separated, two-column, + zero-filled bytes of input data, in hexadecimal, per line. +""") +@click.option('-c', '--one-byte-char', 'one_byte_char', is_flag=True, + multiple=True, help=""" + One-byte character display. Display the input offset in + hexadecimal, followed by sixteen space-separated, + three-column, space-filled characters of input data per line. +""") +@click.option('-C', '--canonical', 'canonical', is_flag=True, + multiple=True, help=""" + Canonical hex+ASCII display. Display the input offset in + hexadecimal, followed by sixteen space-separated, two-column, + hexadecimal bytes, followed by the same sixteen bytes in %_p + format enclosed in | characters. Invoking the program as hd + implies this option. +""") +@click.option('-d', '--two-bytes-decimal', 'two_bytes_decimal', is_flag=True, + multiple=True, help=""" + Two-byte decimal display. Display the input offset in + hexadecimal, followed by eight space-separated, five-column, + zero-filled, two-byte units of input data, in unsigned + decimal, per line. +""") +@click.option('-o', '--two-bytes-octal', 'two_bytes_octal', is_flag=True, + multiple=True, help=""" + Two-byte octal display. Display the input offset in + hexadecimal, followed by eight space-separated, six-column, + zero-filled, two-byte quantities of input data, in octal, per + line. +""") +@click.option('-x', '--two-bytes-hex', 'two_bytes_hex', is_flag=True, + multiple=True, help=""" + Two-byte hexadecimal display. Display the input offset in + hexadecimal, followed by eight space-separated, four-column, + zero-filled, two-byte quantities of input data, in + hexadecimal, per line. +""") +@click.option('-n', '--length', 'length', type=BASED_INT, help=""" + Interpret only length bytes of input. +""") # FIXME: SUFFIXED_INT for hexdump compatible integers +@click.option('-s', '--skip', 'skip', type=BASED_INT, help=""" + Skip offset bytes from the beginning of the input. +""") # FIXME: SUFFIXED_INT for hexdump compatible integers +@click.option('-v', '--no_squeezing', 'no_squeezing', is_flag=True, help=""" + The -v option causes hexdump to display all input data. + Without the -v option, any number of groups of output lines + which would be identical to the immediately preceding group + of output lines (except for the input offsets), are replaced + with a line comprised of a single asterisk. +""") +@click.option('-U', '--upper', 'upper', is_flag=True, help=""" + Uses upper case hex letters on address and data. +""") +@click.option('-I', '--input-format', type=RECORD_FORMAT_CHOICE, help=""" + Forces the input file format. + Required for the standard input. +""") +@click.option('-V', '--version', is_flag=True, is_eager=True, expose_value=False, + callback=print_hexdump_version, help=""" + Print version and exit. +""") +@click.argument('infile', type=FILE_PATH_IN) +def hexdump( + infile: str, + one_byte_octal: Sequence[bool], + one_byte_hex: Sequence[bool], + one_byte_char: Sequence[bool], + canonical: Sequence[bool], + two_bytes_decimal: Sequence[bool], + two_bytes_octal: Sequence[bool], + two_bytes_hex: Sequence[bool], + length: Optional[int], + skip: Optional[int], + no_squeezing: bool, + upper: bool, + input_format: Optional[str], # TODO: +) -> None: + # TODO: __doc__ + r"""Display file contents in hexadecimal, decimal, octal, or ascii. + + The hexdump utility is a filter which displays the specified + files, or standard input if no files are specified, in a + user-specified format. + + Below, the length and offset arguments may be followed by the + multiplicative suffixes KiB (=1024), MiB (=1024*1024), and so on + for GiB, TiB, PiB, EiB, ZiB and YiB (the "iB" is optional, e.g., + "K" has the same meaning as "KiB"), or the suffixes KB (=1000), + MB (=1000*1000), and so on for GB, TB, PB, EB, ZB and YB. + + For each input file, hexdump sequentially copies the input to + standard output, transforming the data according to the format + strings specified by the -e and -f options, in the order that + they were specified. + """ + + kwargs = { + 'one_byte_octal': any(one_byte_octal), + 'one_byte_hex': any(one_byte_hex), + 'one_byte_char': any(one_byte_char), + 'canonical': any(canonical), + 'two_bytes_decimal': any(two_bytes_decimal), + 'two_bytes_octal': any(two_bytes_octal), + 'two_bytes_hex': any(two_bytes_hex), + } + format_order = [param.name + for param, value in hexdump.ordered_options + if (param.name in kwargs) and value] + + hexdump_core( + infile=infile, + length=length, + skip=skip, + no_squeezing=no_squeezing, + upper=upper, + format_order=format_order, + **kwargs, + ) + + +# ---------------------------------------------------------------------------- + +# noinspection PyShadowingBuiltins +@main.command(cls=OrderedOptionsCommand, + context_settings=dict(help_option_names=['-h', '--help'])) +@click.option('-b', '--one-byte-octal', 'one_byte_octal', is_flag=True, + multiple=True, help=""" + One-byte octal display. Display the input offset in + hexadecimal, followed by sixteen space-separated, + three-column, zero-filled bytes of input data, in octal, per + line. +""") +@click.option('-X', '--one-byte-hex', 'one_byte_hex', is_flag=True, + multiple=True, help=""" + One-byte hexadecimal display. Display the input offset in + hexadecimal, followed by sixteen space-separated, two-column, + zero-filled bytes of input data, in hexadecimal, per line. +""") +@click.option('-c', '--one-byte-char', 'one_byte_char', is_flag=True, + multiple=True, help=""" + One-byte character display. Display the input offset in + hexadecimal, followed by sixteen space-separated, + three-column, space-filled characters of input data per line. +""") +@click.option('-d', '--two-bytes-decimal', 'two_bytes_decimal', is_flag=True, + multiple=True, help=""" + Two-byte decimal display. Display the input offset in + hexadecimal, followed by eight space-separated, five-column, + zero-filled, two-byte units of input data, in unsigned + decimal, per line. +""") +@click.option('-o', '--two-bytes-octal', 'two_bytes_octal', is_flag=True, + multiple=True, help=""" + Two-byte octal display. Display the input offset in + hexadecimal, followed by eight space-separated, six-column, + zero-filled, two-byte quantities of input data, in octal, per + line. +""") +@click.option('-x', '--two-bytes-hex', 'two_bytes_hex', is_flag=True, + multiple=True, help=""" + Two-byte hexadecimal display. Display the input offset in + hexadecimal, followed by eight space-separated, four-column, + zero-filled, two-byte quantities of input data, in + hexadecimal, per line. +""") +@click.option('-n', '--length', 'length', type=BASED_INT, help=""" + Interpret only length bytes of input. +""") # FIXME: SUFFIXED_INT for hexdump compatible integers +@click.option('-s', '--skip', 'skip', type=BASED_INT, help=""" + Skip offset bytes from the beginning of the input. +""") # FIXME: SUFFIXED_INT for hexdump compatible integers +@click.option('-v', '--no_squeezing', 'no_squeezing', is_flag=True, help=""" + The -v option causes hexdump to display all input data. + Without the -v option, any number of groups of output lines + which would be identical to the immediately preceding group + of output lines (except for the input offsets), are replaced + with a line comprised of a single asterisk. +""") +@click.option('-U', '--upper', 'upper', is_flag=True, help=""" + Uses upper case hex letters on address and data. +""") +@click.option('-I', '--input-format', type=RECORD_FORMAT_CHOICE, help=""" + Forces the input file format. + Required for the standard input. +""") +@click.option('-V', '--version', is_flag=True, is_eager=True, expose_value=False, + callback=print_hexdump_version, help=""" + Print version and exit. +""") +@click.argument('infile', type=FILE_PATH_IN) +def hd( + infile: str, + one_byte_octal: Sequence[bool], + one_byte_hex: Sequence[bool], + one_byte_char: Sequence[bool], + two_bytes_decimal: Sequence[bool], + two_bytes_octal: Sequence[bool], + two_bytes_hex: Sequence[bool], + length: Optional[int], + skip: Optional[int], + no_squeezing: bool, + upper: bool, + input_format: Optional[str], # TODO: +) -> None: + # TODO: __doc__ + r"""Display file contents in hexadecimal, decimal, octal, or ascii. + + The hexdump utility is a filter which displays the specified + files, or standard input if no files are specified, in a + user-specified format. + + Below, the length and offset arguments may be followed by the + multiplicative suffixes KiB (=1024), MiB (=1024*1024), and so on + for GiB, TiB, PiB, EiB, ZiB and YiB (the "iB" is optional, e.g., + "K" has the same meaning as "KiB"), or the suffixes KB (=1000), + MB (=1000*1000), and so on for GB, TB, PB, EB, ZB and YB. + + For each input file, hexdump sequentially copies the input to + standard output, transforming the data according to the format + strings specified by the -e and -f options, in the order that + they were specified. + """ + + kwargs = { + 'one_byte_octal': any(one_byte_octal), + 'one_byte_hex': any(one_byte_hex), + 'one_byte_char': any(one_byte_char), + 'two_bytes_decimal': any(two_bytes_decimal), + 'two_bytes_octal': any(two_bytes_octal), + 'two_bytes_hex': any(two_bytes_hex), + } + format_order = [param.name + for param, value in hd.ordered_options + if (param.name in kwargs) and value] + format_order.insert(0, 'canonical') + kwargs['canonical'] = True + + hexdump_core( + infile=infile, + length=length, + skip=skip, + no_squeezing=no_squeezing, + upper=upper, + format_order=format_order, + **kwargs, + ) + + # ---------------------------------------------------------------------------- @main.command() diff --git a/src/hexrec/hexdump.py b/src/hexrec/hexdump.py new file mode 100644 index 0000000..6ad09bb --- /dev/null +++ b/src/hexrec/hexdump.py @@ -0,0 +1,568 @@ +# Copyright (c) 2013-2024, Andrea Zoppi +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +r"""Emulation of the hexdump utility.""" + +import io +import os +import sys +from typing import IO +from typing import Callable +from typing import List +from typing import Mapping +from typing import Optional +from typing import Sequence +from typing import Union + +from .base import AnyBytes + +CHAR_PRINTABLE: Sequence[bytes] = [b.to_bytes(1, 'big') for b in ( + b'................' + b'................' + b' !"#$%&\'()*+,-./' + b'0123456789:;<=>?' + b'@ABCDEFGHIJKLMNO' + b'PQRSTUVWXYZ[\\]^_' + b'`abcdefghijklmno' + b'pqrstuvwxyz{|}~.' + b'................' + b'................' + b'................' + b'................' + b'................' + b'................' + b'................' + b'................' + b' ><' +)] +r"""Printable characters lookup table.""" + +CHAR_TOKENS: Sequence[bytes] = [ + b' \\0', b' 001', b' 002', b' 003', b' 004', b' 005', b' 006', b' \\a', + b' \\b', b' \\t', b' \\n', b' \\v', b' \\f', b' \\r', b' 016', b' 017', + b' 020', b' 021', b' 022', b' 023', b' 024', b' 025', b' 026', b' 027', + b' 030', b' 031', b' 032', b' 033', b' 034', b' 035', b' 036', b' 037', + b' ', b' !', b' "', b' #', b' $', b' %', b' &', b" '", + b' (', b' )', b' *', b' +', b' ,', b' -', b' .', b' /', + b' 0', b' 1', b' 2', b' 3', b' 4', b' 5', b' 6', b' 7', + b' 8', b' 9', b' :', b' ;', b' <', b' =', b' >', b' ?', + b' @', b' A', b' B', b' C', b' D', b' E', b' F', b' G', + b' H', b' I', b' J', b' K', b' L', b' M', b' N', b' O', + b' P', b' Q', b' R', b' S', b' T', b' U', b' V', b' W', + b' X', b' Y', b' Z', b' [', b' \\', b' ]', b' ^', b' _', + b' `', b' a', b' b', b' c', b' d', b' e', b' f', b' g', + b' h', b' i', b' j', b' k', b' l', b' m', b' n', b' o', + b' p', b' q', b' r', b' s', b' t', b' u', b' v', b' w', + b' x', b' y', b' z', b' {', b' |', b' }', b' ~', b' 177', + b' 200', b' 201', b' 202', b' 203', b' 204', b' 205', b' 206', b' 207', + b' 210', b' 211', b' 212', b' 213', b' 214', b' 215', b' 216', b' 217', + b' 220', b' 221', b' 222', b' 223', b' 224', b' 225', b' 226', b' 227', + b' 230', b' 231', b' 232', b' 233', b' 234', b' 235', b' 236', b' 237', + b' 240', b' 241', b' 242', b' 243', b' 244', b' 245', b' 246', b' 247', + b' 250', b' 251', b' 252', b' 253', b' 254', b' 255', b' 256', b' 257', + b' 260', b' 261', b' 262', b' 263', b' 264', b' 265', b' 266', b' 267', + b' 270', b' 271', b' 272', b' 273', b' 274', b' 275', b' 276', b' 277', + b' 300', b' 301', b' 302', b' 303', b' 304', b' 305', b' 306', b' 307', + b' 310', b' 311', b' 312', b' 313', b' 314', b' 315', b' 316', b' 317', + b' 320', b' 321', b' 322', b' 323', b' 324', b' 325', b' 326', b' 327', + b' 330', b' 331', b' 332', b' 333', b' 334', b' 335', b' 336', b' 337', + b' 340', b' 341', b' 342', b' 343', b' 344', b' 345', b' 346', b' 347', + b' 350', b' 351', b' 352', b' 353', b' 354', b' 355', b' 356', b' 357', + b' 360', b' 361', b' 362', b' 363', b' 364', b' 365', b' 366', b' 367', + b' 370', b' 371', b' 372', b' 373', b' 374', b' 375', b' 376', b' 377', +] +r"""Character tokens lookup table.""" + +_HEX_LOWER_SINGLE_TOKENS = [b' %02x' % b for b in range(256)] +_HEX_UPPER_SINGLE_TOKENS = [b' %02X' % b for b in range(256)] + +_OCTAL_SINGLE_TOKENS = [b' %03o' % b for b in range(256)] + +DEFAULT_FORMAT_ORDER: Sequence[str] = [ + 'one_byte_octal', + 'one_byte_hex', + 'one_byte_char', + 'canonical', + 'two_bytes_decimal', + 'two_bytes_octal', + 'two_bytes_hex', +] +r"""Default order of display options.""" + + +def _format_default( + address: int, + chunk: AnyBytes, + width: int, + upper: bool, +) -> List[bytes]: + + address_fmt = b'%07X' if upper else b'%07x' + tokens = [address_fmt % address] + + size = len(chunk) + token_fmt = b' %04X' if upper else b' %04x' + tokens.extend(token_fmt % (chunk[offset] | (chunk[offset+1] << 8)) + for offset in range(0, size-1, 2)) + + if size & 1: + tokens.append(token_fmt % chunk[size-1]) + + if size < width: + tokens.extend(b' ' for _ in range(1, width - size, 2)) + + return tokens + + +def _format_one_byte_octal( + address: int, + chunk: AnyBytes, + width: int, + upper: bool, +) -> List[bytes]: + + address_fmt = b'%07X' if upper else b'%07x' + tokens = [address_fmt % address] + + table = _OCTAL_SINGLE_TOKENS + tokens.extend(table[b] for b in chunk) + + size = len(chunk) + if size < width: + tokens.extend(b' ' for _ in range(width - size)) + + return tokens + + +def _format_one_byte_hex( + address: int, + chunk: AnyBytes, + width: int, + upper: bool, +) -> List[bytes]: + + address_fmt = b'%08X' if upper else b'%08x' + tokens = [address_fmt % address] + + table = _HEX_UPPER_SINGLE_TOKENS if upper else _HEX_LOWER_SINGLE_TOKENS + tokens.extend(table[b] for b in chunk) + + size = len(chunk) + if size < width: + tokens.extend(b' ' for _ in range(width - size)) + + return tokens + + +def _format_one_byte_char( + address: int, + chunk: AnyBytes, + width: int, + upper: bool, +) -> List[bytes]: + + address_fmt = b'%07X' if upper else b'%07x' + tokens = [address_fmt % address] + + table = CHAR_TOKENS + tokens.extend(table[b] for b in chunk) + + size = len(chunk) + if size < width: + tokens.extend(b' ' for _ in range(width - size)) + + return tokens + + +def _format_canonical( + address: int, + chunk: AnyBytes, + width: int, + upper: bool, +) -> List[bytes]: + + address_fmt = b'%08X' if upper else b'%08x' + tokens = [address_fmt % address] + + table = _HEX_UPPER_SINGLE_TOKENS if upper else _HEX_LOWER_SINGLE_TOKENS + size = len(chunk) + offset = 0 + append = tokens.append + + for offset in range(size): + if (offset & 7) == 0: + append(b' ') + append(table[chunk[offset]]) + + for offset in range(offset + 1, width): + if (offset & 7) == 0: + append(b' ') + append(b' ') + + table = CHAR_PRINTABLE + append(b' |') + tokens.extend(table[b] for b in chunk) + append(b'|') + + return tokens + + +def _format_two_bytes_decimal( + address: int, + chunk: AnyBytes, + width: int, + upper: bool, +) -> List[bytes]: + + address_fmt = b'%07X' if upper else b'%07x' + tokens = [address_fmt % address] + + size = len(chunk) + tokens.extend(b' %05d' % (chunk[offset] | (chunk[offset+1] << 8)) + for offset in range(0, size-1, 2)) + + if size & 1: + tokens.append(b' %05d' % chunk[size-1]) + + if size < width: + tokens.extend(b' ' for _ in range(1, width - size, 2)) + + return tokens + + +def _format_two_bytes_octal( + address: int, + chunk: AnyBytes, + width: int, + upper: bool, +) -> List[bytes]: + + address_fmt = b'%07X' if upper else b'%07x' + tokens = [address_fmt % address] + + del upper + size = len(chunk) + tokens.extend(b' %06o' % (chunk[offset] | (chunk[offset+1] << 8)) + for offset in range(0, size-1, 2)) + + if size & 1: + tokens.append(b' %06o' % chunk[size-1]) + + if size < width: + tokens.extend(b' ' for _ in range(1, width - size, 2)) + + return tokens + + +def _format_two_bytes_hex( + address: int, + chunk: AnyBytes, + width: int, + upper: bool, +) -> List[bytes]: + + address_fmt = b'%07X' if upper else b'%07x' + tokens = [address_fmt % address] + + size = len(chunk) + token_fmt = b' %04X' if upper else b' %04x' + tokens.extend(token_fmt % (chunk[offset] | (chunk[offset+1] << 8)) + for offset in range(0, size-1, 2)) + + if size & 1: + tokens.append(token_fmt % chunk[size-1]) + + if size < width: + tokens.extend(b' ' for _ in range(1, width - size, 2)) + + return tokens + + +_FormatHandler = Callable[[int, AnyBytes, int, bool], List[bytes]] + +_FORMAT_HANDLERS: Mapping[str, _FormatHandler] = { + 'default': _format_default, + 'one_byte_octal': _format_one_byte_octal, + 'one_byte_hex': _format_one_byte_hex, + 'one_byte_char': _format_one_byte_char, + 'canonical': _format_canonical, + 'two_bytes_decimal': _format_two_bytes_decimal, + 'two_bytes_octal': _format_two_bytes_octal, + 'two_bytes_hex': _format_two_bytes_hex, +} + +_ADDRESS_FMT: Mapping[str, bytes] = { + 'default': b'%07x', + 'one_byte_octal': b'%07x', + 'one_byte_hex': b'%08x', + 'one_byte_char': b'%07x', + 'canonical': b'%08x', + 'two_bytes_decimal': b'%07x', + 'two_bytes_octal': b'%07x', + 'two_bytes_hex': b'%07x', +} + + +# noinspection PyShadowingBuiltins +def hexdump( + infile: Optional[Union[str, AnyBytes, IO]] = None, + outfile: Optional[Union[str, AnyBytes, IO]] = None, + one_byte_octal: bool = False, + one_byte_hex: bool = False, + one_byte_char: bool = False, + canonical: bool = False, + two_bytes_decimal: bool = False, + two_bytes_octal: bool = False, + two_bytes_hex: bool = False, + color: Optional[str] = None, + format: Optional[str] = None, + format_file: Optional[str] = None, + length: Optional[int] = None, + skip: Optional[int] = None, + no_squeezing: bool = False, + upper: bool = False, + width: int = 16, + linesep: Optional[AnyBytes] = None, + format_order: Optional[Sequence[str]] = None, +) -> IO: + r"""Emulation of the `hexdump` utility core. + + Args: + infile (str or bytes): + Input data. + If :obj:`str`, it is considered as the input file path. + If :obj:`bytes`, it is the input byte chunk. + If ``None`` or ``'-'``, it reads from the standard input. + + outfile (str or bytes): + Output data. + If :obj:`str`, it is considered as the output file path. + If :obj:`bytes`, it is the output byte chunk. + If ``None`` or ``'-'``, it writes to the standard output. + + one_byte_octal (bool): + One-byte octal display. Display the input offset in + hexadecimal, followed by sixteen space-separated, + three-column, zero-filled bytes of input data, in octal, per + line. + + one_byte_hex (bool): + One-byte hexadecimal display. Display the input offset in + hexadecimal, followed by sixteen space-separated, two-column, + zero-filled bytes of input data, in hexadecimal, per line. + + one_byte_char (bool): + One-byte character display. Display the input offset in + hexadecimal, followed by sixteen space-separated, + three-column, space-filled characters of input data per line. + + canonical (bool): + Canonical hex+ASCII display. Display the input offset in + hexadecimal, followed by sixteen space-separated, two-column, + hexadecimal bytes, followed by the same sixteen bytes in %_p + format enclosed in | characters. Invoking the program as hd + implies this option. + + two_bytes_decimal (bool): + Two-byte decimal display. Display the input offset in + hexadecimal, followed by eight space-separated, five-column, + zero-filled, two-byte units of input data, in unsigned + decimal, per line. + + two_bytes_octal (bool): + Two-byte octal display. Display the input offset in + hexadecimal, followed by eight space-separated, six-column, + zero-filled, two-byte quantities of input data, in octal, per + line. + + two_bytes_hex (bool): + Two-byte hexadecimal display. Display the input offset in + hexadecimal, followed by eight space-separated, four-column, + zero-filled, two-byte quantities of input data, in + hexadecimal, per line. + + color (str): + *CURRENTLY NOT SUPPORTED*. Please provide ``None``. + + format (str): + *CURRENTLY NOT SUPPORTED*. Please provide ``None``. + + format_file (str): + *CURRENTLY NOT SUPPORTED*. Please provide ``None``. + + length (int): + Interpret only length bytes of input. + + skip (int): + Skip offset bytes from the beginning of the input. + + no_squeezing (bool): + The -v option causes hexdump to display all input data. + Without the -v option, any number of groups of output lines + which would be identical to the immediately preceding group + of output lines (except for the input offsets), are replaced + with a line comprised of a single asterisk. + + upper (bool): + Uses upper case hex letters on address and data. + + width (int): + Number of bytes per line. + + linesep (bytes): + Line separator bytes. + + format_order (list of str): + If not ``None``, it indicates the order of display options + (``one_byte_octal``, ``one_byte_hex``, ``one_byte_char``, + ``canonical``, ``two_bytes_decimal``, ``two_bytes_octal``, + ``two_bytes_hex``). + Duplicates are allowed. + Only those with the corresponding boolean argument true are used. + + Returns: + stream: The handle to the output stream. + """ + + if color is not None: + raise NotImplementedError('"color" option is not supported') + if format is not None: + raise NotImplementedError('"format" option is not supported') + if format_file is not None: + raise NotImplementedError('"format_file" option is not supported') + + skip = 0 if skip is None else skip.__index__() + if skip < 0: + raise ValueError('negative skip') + + if length is not None: + length = length.__index__() + if length < 0: + raise ValueError('negative length') + + width = width.__index__() + width_min = 2 if two_bytes_decimal or two_bytes_octal or two_bytes_hex else 1 + if width < width_min: + raise ValueError('invalid width') + + if linesep is None: + linesep = os.linesep.encode() + + format_flags = { + 'one_byte_octal': one_byte_octal, + 'one_byte_hex': one_byte_hex, + 'one_byte_char': one_byte_char, + 'canonical': canonical, + 'two_bytes_decimal': two_bytes_decimal, + 'two_bytes_octal': two_bytes_octal, + 'two_bytes_hex': two_bytes_hex, + } + if format_order is None: + format_order = DEFAULT_FORMAT_ORDER + else: + for format_name in format_order: + if format_name not in format_flags: + raise ValueError(f'unknown format option: {format_name!r}') + + format_handlers = [_FORMAT_HANDLERS[format_name] + for format_name in format_order + if format_flags[format_name]] + if not format_handlers: + format_order = ['default'] + format_handlers = [_format_default] + + do_squeezing = not no_squeezing + instream: Optional[IO] = None + outstream: Optional[IO] = None + try: + # Input stream binding + if infile is None or infile == '-': + infile = None + instream = sys.stdin.buffer + elif isinstance(infile, str): + instream = open(infile, 'rb') + elif isinstance(infile, (bytes, bytearray, memoryview)): + instream = io.BytesIO(infile) + else: + instream = infile + + # Output stream binding + if outfile is None or outfile == '-': + outfile = None + outstream = sys.stdout.buffer + elif isinstance(outfile, str): + outstream = open(outfile, 'wb') + else: + outstream = outfile + + if skip: + instream.seek(skip, io.SEEK_CUR) + + offset = 0 + last_chunk = None + squeezing = False + write = outstream.write + + while True: + if length is None: + chunk = instream.read(width) + else: + chunk = instream.read(min(width, length - offset)) + + if not chunk: + break + + if do_squeezing and chunk == last_chunk: + if not squeezing: + write(b'*') + write(linesep) + squeezing = True + else: + squeezing = False + address = skip + offset + + for format_handler in format_handlers: + tokens = format_handler(address, chunk, width, upper) + tokens.append(linesep) + line = b''.join(tokens) + write(line) + + last_chunk = chunk + offset += len(chunk) + + address_fmt = _ADDRESS_FMT[format_order[-1]] + if upper: + address_fmt = address_fmt.upper() + write(address_fmt % (skip + offset)) + write(linesep) + + finally: + if instream is not None and isinstance(infile, str): + instream.close() + + if outstream is not None and isinstance(outfile, str): + outstream.close() + + return outstream diff --git a/src/hexrec/xxd.py b/src/hexrec/xxd.py index 5348926..830d065 100644 --- a/src/hexrec/xxd.py +++ b/src/hexrec/xxd.py @@ -152,9 +152,9 @@ def xxd( upper_all: bool = False, upper: bool = False, ) -> IO: - r"""Emulation of the xxd utility core. + r"""Emulation of the `xxd` utility core. - Arguments: + Args: infile (str or bytes): Input data. If :obj:`str`, it is considered as the input file path. diff --git a/tests/test_cli.py b/tests/test_cli.py index 54a4cce..d6b33ac 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -151,7 +151,6 @@ def test_by_filename(tmppath, datapath): def test_fill_parse_byte_fail(): runner = CliRunner() result = runner.invoke(main, 'fill -v 256 - -'.split()) - assert result.exit_code == 2 assert "invalid byte: '256'" in result.output @@ -159,7 +158,6 @@ def test_fill_parse_byte_fail(): def test_merge_nothing(): runner = CliRunner() result = runner.invoke(main, 'merge -i raw -'.split()) - assert result.exit_code == 0 assert result.output == '' @@ -171,7 +169,6 @@ def test_merge_multi(datapath, tmppath): path_out = str(tmppath / 'test_merge_multi.hex') args = ['merge'] + path_ins + [path_out] result = runner.invoke(main, args) - assert result.exit_code == 0 assert result.output == '' @@ -185,7 +182,6 @@ def test_validate(datapath): runner = CliRunner() path_in = str(datapath / 'bytes.mot') result = runner.invoke(main, f'validate {path_in}'.split()) - assert result.exit_code == 0 assert result.output == '' @@ -200,7 +196,6 @@ def test_srec_get_header_headless(datapath): runner = CliRunner() path_in = str(datapath / 'headless.mot') result = runner.invoke(main, f'srec get-header {path_in}'.split()) - assert result.exit_code == 0 assert result.output == '' @@ -209,7 +204,6 @@ def test_srec_get_header_empty(datapath): runner = CliRunner() path_in = str(datapath / 'bytes.mot') result = runner.invoke(main, f'srec get-header {path_in}'.split()) - assert result.exit_code == 0 assert result.output == '\n' @@ -218,7 +212,6 @@ def test_srec_get_header_ascii(datapath): runner = CliRunner() path_in = str(datapath / 'header.mot') result = runner.invoke(main, f'srec get-header -f ascii {path_in}'.split()) - assert result.exit_code == 0 assert result.output == 'ABC\n' @@ -227,23 +220,52 @@ def test_srec_get_header_hex(datapath): runner = CliRunner() path_in = str(datapath / 'header.mot') result = runner.invoke(main, f'srec get-header -f hex {path_in}'.split()) - assert result.exit_code == 0 assert result.output == '414243\n' +def test_hexdump_version(): + expected = f'hexdump from Python hexrec {_version!s}' + runner = CliRunner() + result = runner.invoke(main, 'hexdump --version'.split()) + assert result.exit_code == 0 + assert result.output.strip() == expected + + runner = CliRunner() + result = runner.invoke(main, 'hexdump -V'.split()) + assert result.exit_code == 0 + assert result.output.strip() == expected + + +def test_hd_version(): + expected = f'hexdump from Python hexrec {_version!s}' + runner = CliRunner() + result = runner.invoke(main, 'hd --version'.split()) + assert result.exit_code == 0 + assert result.output.strip() == expected + + runner = CliRunner() + result = runner.invoke(main, 'hd -V'.split()) + assert result.exit_code == 0 + assert result.output.strip() == expected + + def test_xxd_version(): + expected = f'{_version!s}' runner = CliRunner() - result = runner.invoke(main, 'xxd -v'.split()) + result = runner.invoke(main, 'xxd --version'.split()) + assert result.exit_code == 0 + assert result.output.strip() == expected + runner = CliRunner() + result = runner.invoke(main, 'xxd -v'.split()) assert result.exit_code == 0 - assert result.output.strip() == str(_version) + assert result.output.strip() == expected def test_xxd_empty(): runner = CliRunner() result = runner.invoke(main, 'xxd - -'.split()) - assert result.exit_code == 0 assert result.output == '' @@ -251,7 +273,6 @@ def test_xxd_empty(): def test_xxd_parse_int_pass(): runner = CliRunner() result = runner.invoke(main, 'xxd -c 0x10 - -'.split()) - assert result.exit_code == 0 assert result.output == '' @@ -259,6 +280,5 @@ def test_xxd_parse_int_pass(): def test_xxd_parse_int_fail(): runner = CliRunner() result = runner.invoke(main, 'xxd -c ? - -'.split()) - assert result.exit_code == 2 assert "invalid integer: '?'" in result.output diff --git a/tests/test_hexdump.py b/tests/test_hexdump.py new file mode 100644 index 0000000..20621c8 --- /dev/null +++ b/tests/test_hexdump.py @@ -0,0 +1,163 @@ +import glob +from pathlib import Path +from typing import Any +from typing import cast as _cast + +import pytest +from click.testing import CliRunner +from test_base import replace_stdin +from test_base import replace_stdout + +from hexrec.cli import main as cli_main +from hexrec.hexdump import * + + +@pytest.fixture +def tmppath(tmpdir): + return Path(str(tmpdir)) + + +@pytest.fixture(scope='module') +def datadir(request): + dir_path, _ = os.path.splitext(request.module.__file__) + assert os.path.isdir(str(dir_path)) + return dir_path + + +@pytest.fixture +def datapath(datadir): + return Path(str(datadir)) + + +def read_text(path): + path = str(path) + with open(path, 'rt') as file: + data = file.read() + data = data.replace('\r\n', '\n').replace('\r', '\n') # normalize + return data + + +def test_by_filename_hexdump(tmppath, datapath): + prefix = 'test_hexdump_' + test_filenames = glob.glob(str(datapath / (prefix + '*.hexdump'))) + + for filename in test_filenames: + _of = filename + filename = os.path.basename(filename) + path_out = tmppath / filename + path_ref = datapath / filename + + cmdline = filename[len(prefix):].replace('_', ' ') + args = cmdline.split() + path_in = datapath / os.path.splitext(args[-1])[0] + args = ['hexdump'] + args[:-1] + [str(path_in)] + + runner = CliRunner() + result = runner.invoke(_cast(Any, cli_main), args) + + ans_out = result.output + with open(str(path_out), 'wt') as f: + f.write(ans_out) + ans_ref = read_text(path_ref) + # if ans_out != ans_ref: raise AssertionError(str(path_ref)) + assert ans_out == ans_ref + + +def test_by_filename_hd(tmppath, datapath): + prefix = 'test_hd_' + test_filenames = glob.glob(str(datapath / (prefix + '*.hd'))) + + for filename in test_filenames: + filename = os.path.basename(filename) + path_out = tmppath / filename + path_ref = datapath / filename + + cmdline = filename[len(prefix):].replace('_', ' ') + args = cmdline.split() + path_in = datapath / os.path.splitext(args[-1])[0] + args = ['hd'] + args[:-1] + [str(path_in)] + + runner = CliRunner() + result = runner.invoke(_cast(Any, cli_main), args) + + ans_out = result.output + with open(str(path_out), 'wt') as f: + f.write(ans_out) + ans_ref = read_text(path_ref) + # if ans_out != ans_ref: raise AssertionError(str(path_ref)) + assert ans_out == ans_ref + + +def test_hexdump_io(datapath): + with open(str(datapath / 'bytes.bin'), 'rb') as stream: + data_in = stream.read() + text_out = io.BytesIO() + + hexdump(data_in, text_out) + + text_out = text_out.getvalue().replace(b'\r\n', b'\n').decode() + text_ref = read_text(str(datapath / 'test_hexdump_bytes.bin.hexdump')) + assert text_out == text_ref + + +def test_hexdump_raises(datapath, tmppath): + with open(str(datapath / 'bytes.bin'), 'rb') as stream: + data_in = memoryview(stream.read()) + + with pytest.raises(NotImplementedError, match='"color" option is not supported'): + hexdump(data_in, color='') + + with pytest.raises(NotImplementedError, match='"format" option is not supported'): + hexdump(data_in, format='') + + with pytest.raises(NotImplementedError, match='"format_file" option is not supported'): + hexdump(data_in, format_file='') + + with pytest.raises(ValueError, match='negative skip'): + hexdump(data_in, skip=-1) + + with pytest.raises(ValueError, match='negative length'): + hexdump(data_in, length=-1) + + with pytest.raises(ValueError, match='invalid width'): + hexdump(data_in, width=0) + + with pytest.raises(ValueError, match='unknown format option'): + hexdump(data_in, format_order=['(this is a non-existing format)']) + + +def test_hexdump_stdin_stdout(datapath): + with open(str(datapath / 'bytes.bin'), 'rb') as stream: + data_in = stream.read() + fake_stdin = io.BytesIO(data_in) + fake_stdout = io.BytesIO() + + with replace_stdin(fake_stdin), replace_stdout(fake_stdout): + hexdump(linesep=b'\n') + + text_out = fake_stdout.getvalue().decode() + text_ref = read_text(str(datapath / 'test_hexdump_bytes.bin.hexdump')) + assert text_out == text_ref + + +def test_hexdump_str(datapath, tmppath): + with open(str(datapath / 'bytes.bin'), 'rb') as stream: + data_in = stream.read() + path_out = str(tmppath / 'test_hexdump_str.hexdump') + + hexdump(data_in, path_out) + + text_out = read_text(path_out) + text_ref = read_text(str(datapath / 'test_hexdump_bytes.bin.hexdump')) + assert text_out == text_ref + + +def test_hexdump_stream(datapath): + fake_stdout = io.BytesIO() + with replace_stdout(fake_stdout): + with open(str(datapath / 'bytes.bin'), 'rb') as stream_in: + hexdump(stream_in, linesep=b'\n') + + text_out = fake_stdout.getvalue().decode() + text_ref = read_text(str(datapath / 'test_hexdump_bytes.bin.hexdump')) + assert text_out == text_ref diff --git a/tests/test_hexdump/bytes.bin b/tests/test_hexdump/bytes.bin new file mode 100644 index 0000000000000000000000000000000000000000..b7295799023f5ac52626e334fb3ff1bf8885442c GIT binary patch literal 253 zcmVRaRG6Sz23MU0z>c zVPa!sWoBn+X=-b1ZEkOHadLBXb#`}nd3t+%eSUv{fr5jCg@%WSiHeJijgF6yk&=^? zm6n&7nVOrNot~edp`xRtrKYE-sj922t*)=Iv9hzYwYImoxw^Z&y}rM|!NSAD#m2|T z$;!*j&Cbuz(bCh@)z;V8+1lIO-QM5e;o{@u<>u$;>FVq3?e6dJ@$&QZ_4fDp`TG0( DGGKg% literal 0 HcmV?d00001 diff --git a/tests/test_hexdump/genfiles.sh b/tests/test_hexdump/genfiles.sh new file mode 100644 index 0000000..aa20996 --- /dev/null +++ b/tests/test_hexdump/genfiles.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +hexdump -c bytes.bin > test_hexdump_-c_bytes.bin.hexdump +hexdump -C bytes.bin > test_hexdump_-C__bytes.bin.hexdump +hexdump -d bytes.bin > test_hexdump_-d_bytes.bin.hexdump +hexdump -n 128 bytes.bin > test_hexdump_-n_128_bytes.bin.hexdump +hexdump -o bytes.bin > test_hexdump_-o_bytes.bin.hexdump +hexdump -s 128 -n 64 bytes.bin > test_hexdump_-s_128_-n_64_bytes.bin.hexdump +hexdump -s 32 bytes.bin > test_hexdump_-s_32_bytes.bin.hexdump +# hexdump -U bytes.bin > test_hexdump_-U_bytes.bin.hexdump +hexdump -v wildcard.bin > test_hexdump_-v_wildcard.bin.hexdump +hexdump -x bytes.bin > test_hexdump_-x_bytes.bin.hexdump +# hexdump -X bytes.bin > test_hexdump_-X__bytes.bin.hexdump +hexdump bytes.bin > test_hexdump_bytes.bin.hexdump +hexdump wildcard.bin > test_hexdump_wildcard.bin.hexdump + +alias hd="hexdump -C" +hd -b bytes.bin > test_hd_-b_bytes.bin.hd +hd -c bytes.bin > test_hd_-c_bytes.bin.hd +hd -d bytes.bin > test_hd_-d_bytes.bin.hd +hd -n 128 bytes.bin > test_hd_-n_128_bytes.bin.hd +hd -o bytes.bin > test_hd_-o_bytes.bin.hd +hd -s 128 -n 64 bytes.bin > test_hd_-s_128_-n_64_bytes.bin.hd +hd -s 32 bytes.bin > test_hd_-s_32_bytes.bin.hd +# hd -U bytes.bin > test_hd_-U_bytes.bin.hd +hd -v wildcard.bin > test_hd_-v_wildcard.bin.hd +hd -x bytes.bin > test_hd_-x_bytes.bin.hd +# hd -X bytes.bin > test_hd_-X__bytes.bin.hd +hd bytes.bin > test_hd_bytes.bin.hd +hd wildcard.bin > test_hd_wildcard.bin.hd diff --git a/tests/test_hexdump/test_hd_-U_bytes.bin.hd b/tests/test_hexdump/test_hd_-U_bytes.bin.hd new file mode 100644 index 0000000..b5b8630 --- /dev/null +++ b/tests/test_hexdump/test_hd_-U_bytes.bin.hd @@ -0,0 +1,17 @@ +00000000 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F |................| +00000010 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F |................| +00000020 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F | !"#$%&'()*+,-./| +00000030 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F |0123456789:;<=>?| +00000040 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F |@ABCDEFGHIJKLMNO| +00000050 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F |PQRSTUVWXYZ[\]^_| +00000060 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F |`abcdefghijklmno| +00000070 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F |pqrstuvwxyz{|}~.| +00000080 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F |................| +00000090 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F |................| +000000A0 A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF |................| +000000B0 B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF |................| +000000C0 C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF |................| +000000D0 D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF |................| +000000E0 E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF |................| +000000F0 F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC |.............| +000000FD diff --git a/tests/test_hexdump/test_hd_-X__bytes.bin.hd b/tests/test_hexdump/test_hd_-X__bytes.bin.hd new file mode 100644 index 0000000..a9ffde7 --- /dev/null +++ b/tests/test_hexdump/test_hd_-X__bytes.bin.hd @@ -0,0 +1,33 @@ +00000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f |................| +00000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f +00000010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f |................| +00000010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f +00000020 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f | !"#$%&'()*+,-./| +00000020 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f +00000030 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f |0123456789:;<=>?| +00000030 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f +00000040 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f |@ABCDEFGHIJKLMNO| +00000040 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f +00000050 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f |PQRSTUVWXYZ[\]^_| +00000050 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f +00000060 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f |`abcdefghijklmno| +00000060 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f +00000070 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f |pqrstuvwxyz{|}~.| +00000070 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f +00000080 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f |................| +00000080 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f +00000090 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f |................| +00000090 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f +000000a0 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af |................| +000000a0 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af +000000b0 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf |................| +000000b0 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf +000000c0 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf |................| +000000c0 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf +000000d0 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df |................| +000000d0 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df +000000e0 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef |................| +000000e0 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef +000000f0 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc |.............| +000000f0 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc +000000fd diff --git a/tests/test_hexdump/test_hd_-b_bytes.bin.hd b/tests/test_hexdump/test_hd_-b_bytes.bin.hd new file mode 100644 index 0000000..4699f1d --- /dev/null +++ b/tests/test_hexdump/test_hd_-b_bytes.bin.hd @@ -0,0 +1,33 @@ +00000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f |................| +0000000 000 001 002 003 004 005 006 007 010 011 012 013 014 015 016 017 +00000010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f |................| +0000010 020 021 022 023 024 025 026 027 030 031 032 033 034 035 036 037 +00000020 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f | !"#$%&'()*+,-./| +0000020 040 041 042 043 044 045 046 047 050 051 052 053 054 055 056 057 +00000030 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f |0123456789:;<=>?| +0000030 060 061 062 063 064 065 066 067 070 071 072 073 074 075 076 077 +00000040 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f |@ABCDEFGHIJKLMNO| +0000040 100 101 102 103 104 105 106 107 110 111 112 113 114 115 116 117 +00000050 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f |PQRSTUVWXYZ[\]^_| +0000050 120 121 122 123 124 125 126 127 130 131 132 133 134 135 136 137 +00000060 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f |`abcdefghijklmno| +0000060 140 141 142 143 144 145 146 147 150 151 152 153 154 155 156 157 +00000070 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f |pqrstuvwxyz{|}~.| +0000070 160 161 162 163 164 165 166 167 170 171 172 173 174 175 176 177 +00000080 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f |................| +0000080 200 201 202 203 204 205 206 207 210 211 212 213 214 215 216 217 +00000090 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f |................| +0000090 220 221 222 223 224 225 226 227 230 231 232 233 234 235 236 237 +000000a0 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af |................| +00000a0 240 241 242 243 244 245 246 247 250 251 252 253 254 255 256 257 +000000b0 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf |................| +00000b0 260 261 262 263 264 265 266 267 270 271 272 273 274 275 276 277 +000000c0 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf |................| +00000c0 300 301 302 303 304 305 306 307 310 311 312 313 314 315 316 317 +000000d0 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df |................| +00000d0 320 321 322 323 324 325 326 327 330 331 332 333 334 335 336 337 +000000e0 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef |................| +00000e0 340 341 342 343 344 345 346 347 350 351 352 353 354 355 356 357 +000000f0 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc |.............| +00000f0 360 361 362 363 364 365 366 367 370 371 372 373 374 +00000fd diff --git a/tests/test_hexdump/test_hd_-c_bytes.bin.hd b/tests/test_hexdump/test_hd_-c_bytes.bin.hd new file mode 100644 index 0000000..0f347f0 --- /dev/null +++ b/tests/test_hexdump/test_hd_-c_bytes.bin.hd @@ -0,0 +1,33 @@ +00000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f |................| +0000000 \0 001 002 003 004 005 006 \a \b \t \n \v \f \r 016 017 +00000010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f |................| +0000010 020 021 022 023 024 025 026 027 030 031 032 033 034 035 036 037 +00000020 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f | !"#$%&'()*+,-./| +0000020 ! " # $ % & ' ( ) * + , - . / +00000030 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f |0123456789:;<=>?| +0000030 0 1 2 3 4 5 6 7 8 9 : ; < = > ? +00000040 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f |@ABCDEFGHIJKLMNO| +0000040 @ A B C D E F G H I J K L M N O +00000050 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f |PQRSTUVWXYZ[\]^_| +0000050 P Q R S T U V W X Y Z [ \ ] ^ _ +00000060 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f |`abcdefghijklmno| +0000060 ` a b c d e f g h i j k l m n o +00000070 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f |pqrstuvwxyz{|}~.| +0000070 p q r s t u v w x y z { | } ~ 177 +00000080 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f |................| +0000080 200 201 202 203 204 205 206 207 210 211 212 213 214 215 216 217 +00000090 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f |................| +0000090 220 221 222 223 224 225 226 227 230 231 232 233 234 235 236 237 +000000a0 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af |................| +00000a0 240 241 242 243 244 245 246 247 250 251 252 253 254 255 256 257 +000000b0 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf |................| +00000b0 260 261 262 263 264 265 266 267 270 271 272 273 274 275 276 277 +000000c0 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf |................| +00000c0 300 301 302 303 304 305 306 307 310 311 312 313 314 315 316 317 +000000d0 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df |................| +00000d0 320 321 322 323 324 325 326 327 330 331 332 333 334 335 336 337 +000000e0 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef |................| +00000e0 340 341 342 343 344 345 346 347 350 351 352 353 354 355 356 357 +000000f0 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc |.............| +00000f0 360 361 362 363 364 365 366 367 370 371 372 373 374 +00000fd diff --git a/tests/test_hexdump/test_hd_-d_bytes.bin.hd b/tests/test_hexdump/test_hd_-d_bytes.bin.hd new file mode 100644 index 0000000..81963ca --- /dev/null +++ b/tests/test_hexdump/test_hd_-d_bytes.bin.hd @@ -0,0 +1,33 @@ +00000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f |................| +0000000 00256 00770 01284 01798 02312 02826 03340 03854 +00000010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f |................| +0000010 04368 04882 05396 05910 06424 06938 07452 07966 +00000020 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f | !"#$%&'()*+,-./| +0000020 08480 08994 09508 10022 10536 11050 11564 12078 +00000030 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f |0123456789:;<=>?| +0000030 12592 13106 13620 14134 14648 15162 15676 16190 +00000040 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f |@ABCDEFGHIJKLMNO| +0000040 16704 17218 17732 18246 18760 19274 19788 20302 +00000050 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f |PQRSTUVWXYZ[\]^_| +0000050 20816 21330 21844 22358 22872 23386 23900 24414 +00000060 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f |`abcdefghijklmno| +0000060 24928 25442 25956 26470 26984 27498 28012 28526 +00000070 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f |pqrstuvwxyz{|}~.| +0000070 29040 29554 30068 30582 31096 31610 32124 32638 +00000080 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f |................| +0000080 33152 33666 34180 34694 35208 35722 36236 36750 +00000090 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f |................| +0000090 37264 37778 38292 38806 39320 39834 40348 40862 +000000a0 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af |................| +00000a0 41376 41890 42404 42918 43432 43946 44460 44974 +000000b0 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf |................| +00000b0 45488 46002 46516 47030 47544 48058 48572 49086 +000000c0 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf |................| +00000c0 49600 50114 50628 51142 51656 52170 52684 53198 +000000d0 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df |................| +00000d0 53712 54226 54740 55254 55768 56282 56796 57310 +000000e0 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef |................| +00000e0 57824 58338 58852 59366 59880 60394 60908 61422 +000000f0 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc |.............| +00000f0 61936 62450 62964 63478 63992 64506 00252 +00000fd diff --git a/tests/test_hexdump/test_hd_-n_128_bytes.bin.hd b/tests/test_hexdump/test_hd_-n_128_bytes.bin.hd new file mode 100644 index 0000000..11b737b --- /dev/null +++ b/tests/test_hexdump/test_hd_-n_128_bytes.bin.hd @@ -0,0 +1,9 @@ +00000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f |................| +00000010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f |................| +00000020 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f | !"#$%&'()*+,-./| +00000030 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f |0123456789:;<=>?| +00000040 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f |@ABCDEFGHIJKLMNO| +00000050 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f |PQRSTUVWXYZ[\]^_| +00000060 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f |`abcdefghijklmno| +00000070 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f |pqrstuvwxyz{|}~.| +00000080 diff --git a/tests/test_hexdump/test_hd_-o_bytes.bin.hd b/tests/test_hexdump/test_hd_-o_bytes.bin.hd new file mode 100644 index 0000000..123ac42 --- /dev/null +++ b/tests/test_hexdump/test_hd_-o_bytes.bin.hd @@ -0,0 +1,33 @@ +00000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f |................| +0000000 000400 001402 002404 003406 004410 005412 006414 007416 +00000010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f |................| +0000010 010420 011422 012424 013426 014430 015432 016434 017436 +00000020 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f | !"#$%&'()*+,-./| +0000020 020440 021442 022444 023446 024450 025452 026454 027456 +00000030 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f |0123456789:;<=>?| +0000030 030460 031462 032464 033466 034470 035472 036474 037476 +00000040 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f |@ABCDEFGHIJKLMNO| +0000040 040500 041502 042504 043506 044510 045512 046514 047516 +00000050 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f |PQRSTUVWXYZ[\]^_| +0000050 050520 051522 052524 053526 054530 055532 056534 057536 +00000060 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f |`abcdefghijklmno| +0000060 060540 061542 062544 063546 064550 065552 066554 067556 +00000070 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f |pqrstuvwxyz{|}~.| +0000070 070560 071562 072564 073566 074570 075572 076574 077576 +00000080 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f |................| +0000080 100600 101602 102604 103606 104610 105612 106614 107616 +00000090 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f |................| +0000090 110620 111622 112624 113626 114630 115632 116634 117636 +000000a0 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af |................| +00000a0 120640 121642 122644 123646 124650 125652 126654 127656 +000000b0 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf |................| +00000b0 130660 131662 132664 133666 134670 135672 136674 137676 +000000c0 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf |................| +00000c0 140700 141702 142704 143706 144710 145712 146714 147716 +000000d0 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df |................| +00000d0 150720 151722 152724 153726 154730 155732 156734 157736 +000000e0 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef |................| +00000e0 160740 161742 162744 163746 164750 165752 166754 167756 +000000f0 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc |.............| +00000f0 170760 171762 172764 173766 174770 175772 000374 +00000fd diff --git a/tests/test_hexdump/test_hd_-s_128_-n_64_bytes.bin.hd b/tests/test_hexdump/test_hd_-s_128_-n_64_bytes.bin.hd new file mode 100644 index 0000000..c1e1c32 --- /dev/null +++ b/tests/test_hexdump/test_hd_-s_128_-n_64_bytes.bin.hd @@ -0,0 +1,5 @@ +00000080 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f |................| +00000090 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f |................| +000000a0 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af |................| +000000b0 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf |................| +000000c0 diff --git a/tests/test_hexdump/test_hd_-s_32_bytes.bin.hd b/tests/test_hexdump/test_hd_-s_32_bytes.bin.hd new file mode 100644 index 0000000..e5e6198 --- /dev/null +++ b/tests/test_hexdump/test_hd_-s_32_bytes.bin.hd @@ -0,0 +1,15 @@ +00000020 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f | !"#$%&'()*+,-./| +00000030 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f |0123456789:;<=>?| +00000040 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f |@ABCDEFGHIJKLMNO| +00000050 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f |PQRSTUVWXYZ[\]^_| +00000060 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f |`abcdefghijklmno| +00000070 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f |pqrstuvwxyz{|}~.| +00000080 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f |................| +00000090 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f |................| +000000a0 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af |................| +000000b0 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf |................| +000000c0 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf |................| +000000d0 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df |................| +000000e0 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef |................| +000000f0 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc |.............| +000000fd diff --git a/tests/test_hexdump/test_hd_-v_wildcard.bin.hd b/tests/test_hexdump/test_hd_-v_wildcard.bin.hd new file mode 100644 index 0000000..12ef172 --- /dev/null +++ b/tests/test_hexdump/test_hd_-v_wildcard.bin.hd @@ -0,0 +1,21 @@ +00000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f |................| +00000010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f |................| +00000020 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f | !"#$%&'()*+,-./| +00000030 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f |0123456789:;<=>?| +00000040 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f |@ABCDEFGHIJKLMNO| +00000050 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f |PQRSTUVWXYZ[\]^_| +00000060 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f |`abcdefghijklmno| +00000070 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f |pqrstuvwxyz{|}~.| +00000080 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| +00000090 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| +000000a0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| +000000b0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| +000000c0 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f |................| +000000d0 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f |................| +000000e0 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af |................| +000000f0 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf |................| +00000100 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf |................| +00000110 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df |................| +00000120 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef |................| +00000130 f0 f1 f2 |...| +00000133 diff --git a/tests/test_hexdump/test_hd_-x_bytes.bin.hd b/tests/test_hexdump/test_hd_-x_bytes.bin.hd new file mode 100644 index 0000000..c42eae0 --- /dev/null +++ b/tests/test_hexdump/test_hd_-x_bytes.bin.hd @@ -0,0 +1,33 @@ +00000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f |................| +0000000 0100 0302 0504 0706 0908 0b0a 0d0c 0f0e +00000010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f |................| +0000010 1110 1312 1514 1716 1918 1b1a 1d1c 1f1e +00000020 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f | !"#$%&'()*+,-./| +0000020 2120 2322 2524 2726 2928 2b2a 2d2c 2f2e +00000030 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f |0123456789:;<=>?| +0000030 3130 3332 3534 3736 3938 3b3a 3d3c 3f3e +00000040 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f |@ABCDEFGHIJKLMNO| +0000040 4140 4342 4544 4746 4948 4b4a 4d4c 4f4e +00000050 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f |PQRSTUVWXYZ[\]^_| +0000050 5150 5352 5554 5756 5958 5b5a 5d5c 5f5e +00000060 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f |`abcdefghijklmno| +0000060 6160 6362 6564 6766 6968 6b6a 6d6c 6f6e +00000070 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f |pqrstuvwxyz{|}~.| +0000070 7170 7372 7574 7776 7978 7b7a 7d7c 7f7e +00000080 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f |................| +0000080 8180 8382 8584 8786 8988 8b8a 8d8c 8f8e +00000090 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f |................| +0000090 9190 9392 9594 9796 9998 9b9a 9d9c 9f9e +000000a0 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af |................| +00000a0 a1a0 a3a2 a5a4 a7a6 a9a8 abaa adac afae +000000b0 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf |................| +00000b0 b1b0 b3b2 b5b4 b7b6 b9b8 bbba bdbc bfbe +000000c0 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf |................| +00000c0 c1c0 c3c2 c5c4 c7c6 c9c8 cbca cdcc cfce +000000d0 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df |................| +00000d0 d1d0 d3d2 d5d4 d7d6 d9d8 dbda dddc dfde +000000e0 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef |................| +00000e0 e1e0 e3e2 e5e4 e7e6 e9e8 ebea edec efee +000000f0 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc |.............| +00000f0 f1f0 f3f2 f5f4 f7f6 f9f8 fbfa 00fc +00000fd diff --git a/tests/test_hexdump/test_hd_bytes.bin.hd b/tests/test_hexdump/test_hd_bytes.bin.hd new file mode 100644 index 0000000..87f7d37 --- /dev/null +++ b/tests/test_hexdump/test_hd_bytes.bin.hd @@ -0,0 +1,17 @@ +00000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f |................| +00000010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f |................| +00000020 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f | !"#$%&'()*+,-./| +00000030 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f |0123456789:;<=>?| +00000040 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f |@ABCDEFGHIJKLMNO| +00000050 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f |PQRSTUVWXYZ[\]^_| +00000060 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f |`abcdefghijklmno| +00000070 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f |pqrstuvwxyz{|}~.| +00000080 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f |................| +00000090 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f |................| +000000a0 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af |................| +000000b0 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf |................| +000000c0 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf |................| +000000d0 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df |................| +000000e0 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef |................| +000000f0 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc |.............| +000000fd diff --git a/tests/test_hexdump/test_hd_wildcard.bin.hd b/tests/test_hexdump/test_hd_wildcard.bin.hd new file mode 100644 index 0000000..8664ab8 --- /dev/null +++ b/tests/test_hexdump/test_hd_wildcard.bin.hd @@ -0,0 +1,19 @@ +00000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f |................| +00000010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f |................| +00000020 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f | !"#$%&'()*+,-./| +00000030 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f |0123456789:;<=>?| +00000040 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f |@ABCDEFGHIJKLMNO| +00000050 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f |PQRSTUVWXYZ[\]^_| +00000060 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f |`abcdefghijklmno| +00000070 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f |pqrstuvwxyz{|}~.| +00000080 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| +* +000000c0 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f |................| +000000d0 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f |................| +000000e0 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af |................| +000000f0 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf |................| +00000100 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf |................| +00000110 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df |................| +00000120 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef |................| +00000130 f0 f1 f2 |...| +00000133 diff --git a/tests/test_hexdump/test_hexdump_-C__bytes.bin.hexdump b/tests/test_hexdump/test_hexdump_-C__bytes.bin.hexdump new file mode 100644 index 0000000..87f7d37 --- /dev/null +++ b/tests/test_hexdump/test_hexdump_-C__bytes.bin.hexdump @@ -0,0 +1,17 @@ +00000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f |................| +00000010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f |................| +00000020 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f | !"#$%&'()*+,-./| +00000030 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f |0123456789:;<=>?| +00000040 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f |@ABCDEFGHIJKLMNO| +00000050 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f |PQRSTUVWXYZ[\]^_| +00000060 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f |`abcdefghijklmno| +00000070 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f |pqrstuvwxyz{|}~.| +00000080 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f |................| +00000090 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f |................| +000000a0 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af |................| +000000b0 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf |................| +000000c0 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf |................| +000000d0 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df |................| +000000e0 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef |................| +000000f0 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc |.............| +000000fd diff --git a/tests/test_hexdump/test_hexdump_-U_bytes.bin.hexdump b/tests/test_hexdump/test_hexdump_-U_bytes.bin.hexdump new file mode 100644 index 0000000..8d437b5 --- /dev/null +++ b/tests/test_hexdump/test_hexdump_-U_bytes.bin.hexdump @@ -0,0 +1,17 @@ +0000000 0100 0302 0504 0706 0908 0B0A 0D0C 0F0E +0000010 1110 1312 1514 1716 1918 1B1A 1D1C 1F1E +0000020 2120 2322 2524 2726 2928 2B2A 2D2C 2F2E +0000030 3130 3332 3534 3736 3938 3B3A 3D3C 3F3E +0000040 4140 4342 4544 4746 4948 4B4A 4D4C 4F4E +0000050 5150 5352 5554 5756 5958 5B5A 5D5C 5F5E +0000060 6160 6362 6564 6766 6968 6B6A 6D6C 6F6E +0000070 7170 7372 7574 7776 7978 7B7A 7D7C 7F7E +0000080 8180 8382 8584 8786 8988 8B8A 8D8C 8F8E +0000090 9190 9392 9594 9796 9998 9B9A 9D9C 9F9E +00000A0 A1A0 A3A2 A5A4 A7A6 A9A8 ABAA ADAC AFAE +00000B0 B1B0 B3B2 B5B4 B7B6 B9B8 BBBA BDBC BFBE +00000C0 C1C0 C3C2 C5C4 C7C6 C9C8 CBCA CDCC CFCE +00000D0 D1D0 D3D2 D5D4 D7D6 D9D8 DBDA DDDC DFDE +00000E0 E1E0 E3E2 E5E4 E7E6 E9E8 EBEA EDEC EFEE +00000F0 F1F0 F3F2 F5F4 F7F6 F9F8 FBFA 00FC +00000FD diff --git a/tests/test_hexdump/test_hexdump_-X__bytes.bin.hexdump b/tests/test_hexdump/test_hexdump_-X__bytes.bin.hexdump new file mode 100644 index 0000000..7a32c1a --- /dev/null +++ b/tests/test_hexdump/test_hexdump_-X__bytes.bin.hexdump @@ -0,0 +1,17 @@ +00000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f +00000010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f +00000020 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f +00000030 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f +00000040 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f +00000050 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f +00000060 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f +00000070 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f +00000080 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f +00000090 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f +000000a0 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af +000000b0 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf +000000c0 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf +000000d0 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df +000000e0 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef +000000f0 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc +000000fd diff --git a/tests/test_hexdump/test_hexdump_-b_bytes.bin.hexdump b/tests/test_hexdump/test_hexdump_-b_bytes.bin.hexdump new file mode 100644 index 0000000..2f2b1e0 --- /dev/null +++ b/tests/test_hexdump/test_hexdump_-b_bytes.bin.hexdump @@ -0,0 +1,17 @@ +0000000 000 001 002 003 004 005 006 007 010 011 012 013 014 015 016 017 +0000010 020 021 022 023 024 025 026 027 030 031 032 033 034 035 036 037 +0000020 040 041 042 043 044 045 046 047 050 051 052 053 054 055 056 057 +0000030 060 061 062 063 064 065 066 067 070 071 072 073 074 075 076 077 +0000040 100 101 102 103 104 105 106 107 110 111 112 113 114 115 116 117 +0000050 120 121 122 123 124 125 126 127 130 131 132 133 134 135 136 137 +0000060 140 141 142 143 144 145 146 147 150 151 152 153 154 155 156 157 +0000070 160 161 162 163 164 165 166 167 170 171 172 173 174 175 176 177 +0000080 200 201 202 203 204 205 206 207 210 211 212 213 214 215 216 217 +0000090 220 221 222 223 224 225 226 227 230 231 232 233 234 235 236 237 +00000a0 240 241 242 243 244 245 246 247 250 251 252 253 254 255 256 257 +00000b0 260 261 262 263 264 265 266 267 270 271 272 273 274 275 276 277 +00000c0 300 301 302 303 304 305 306 307 310 311 312 313 314 315 316 317 +00000d0 320 321 322 323 324 325 326 327 330 331 332 333 334 335 336 337 +00000e0 340 341 342 343 344 345 346 347 350 351 352 353 354 355 356 357 +00000f0 360 361 362 363 364 365 366 367 370 371 372 373 374 +00000fd diff --git a/tests/test_hexdump/test_hexdump_-c_bytes.bin.hexdump b/tests/test_hexdump/test_hexdump_-c_bytes.bin.hexdump new file mode 100644 index 0000000..0f52b58 --- /dev/null +++ b/tests/test_hexdump/test_hexdump_-c_bytes.bin.hexdump @@ -0,0 +1,17 @@ +0000000 \0 001 002 003 004 005 006 \a \b \t \n \v \f \r 016 017 +0000010 020 021 022 023 024 025 026 027 030 031 032 033 034 035 036 037 +0000020 ! " # $ % & ' ( ) * + , - . / +0000030 0 1 2 3 4 5 6 7 8 9 : ; < = > ? +0000040 @ A B C D E F G H I J K L M N O +0000050 P Q R S T U V W X Y Z [ \ ] ^ _ +0000060 ` a b c d e f g h i j k l m n o +0000070 p q r s t u v w x y z { | } ~ 177 +0000080 200 201 202 203 204 205 206 207 210 211 212 213 214 215 216 217 +0000090 220 221 222 223 224 225 226 227 230 231 232 233 234 235 236 237 +00000a0 240 241 242 243 244 245 246 247 250 251 252 253 254 255 256 257 +00000b0 260 261 262 263 264 265 266 267 270 271 272 273 274 275 276 277 +00000c0 300 301 302 303 304 305 306 307 310 311 312 313 314 315 316 317 +00000d0 320 321 322 323 324 325 326 327 330 331 332 333 334 335 336 337 +00000e0 340 341 342 343 344 345 346 347 350 351 352 353 354 355 356 357 +00000f0 360 361 362 363 364 365 366 367 370 371 372 373 374 +00000fd diff --git a/tests/test_hexdump/test_hexdump_-d_bytes.bin.hexdump b/tests/test_hexdump/test_hexdump_-d_bytes.bin.hexdump new file mode 100644 index 0000000..deac532 --- /dev/null +++ b/tests/test_hexdump/test_hexdump_-d_bytes.bin.hexdump @@ -0,0 +1,17 @@ +0000000 00256 00770 01284 01798 02312 02826 03340 03854 +0000010 04368 04882 05396 05910 06424 06938 07452 07966 +0000020 08480 08994 09508 10022 10536 11050 11564 12078 +0000030 12592 13106 13620 14134 14648 15162 15676 16190 +0000040 16704 17218 17732 18246 18760 19274 19788 20302 +0000050 20816 21330 21844 22358 22872 23386 23900 24414 +0000060 24928 25442 25956 26470 26984 27498 28012 28526 +0000070 29040 29554 30068 30582 31096 31610 32124 32638 +0000080 33152 33666 34180 34694 35208 35722 36236 36750 +0000090 37264 37778 38292 38806 39320 39834 40348 40862 +00000a0 41376 41890 42404 42918 43432 43946 44460 44974 +00000b0 45488 46002 46516 47030 47544 48058 48572 49086 +00000c0 49600 50114 50628 51142 51656 52170 52684 53198 +00000d0 53712 54226 54740 55254 55768 56282 56796 57310 +00000e0 57824 58338 58852 59366 59880 60394 60908 61422 +00000f0 61936 62450 62964 63478 63992 64506 00252 +00000fd diff --git a/tests/test_hexdump/test_hexdump_-n_128_bytes.bin.hexdump b/tests/test_hexdump/test_hexdump_-n_128_bytes.bin.hexdump new file mode 100644 index 0000000..73e34dd --- /dev/null +++ b/tests/test_hexdump/test_hexdump_-n_128_bytes.bin.hexdump @@ -0,0 +1,9 @@ +0000000 0100 0302 0504 0706 0908 0b0a 0d0c 0f0e +0000010 1110 1312 1514 1716 1918 1b1a 1d1c 1f1e +0000020 2120 2322 2524 2726 2928 2b2a 2d2c 2f2e +0000030 3130 3332 3534 3736 3938 3b3a 3d3c 3f3e +0000040 4140 4342 4544 4746 4948 4b4a 4d4c 4f4e +0000050 5150 5352 5554 5756 5958 5b5a 5d5c 5f5e +0000060 6160 6362 6564 6766 6968 6b6a 6d6c 6f6e +0000070 7170 7372 7574 7776 7978 7b7a 7d7c 7f7e +0000080 diff --git a/tests/test_hexdump/test_hexdump_-o_bytes.bin.hexdump b/tests/test_hexdump/test_hexdump_-o_bytes.bin.hexdump new file mode 100644 index 0000000..deb51ec --- /dev/null +++ b/tests/test_hexdump/test_hexdump_-o_bytes.bin.hexdump @@ -0,0 +1,17 @@ +0000000 000400 001402 002404 003406 004410 005412 006414 007416 +0000010 010420 011422 012424 013426 014430 015432 016434 017436 +0000020 020440 021442 022444 023446 024450 025452 026454 027456 +0000030 030460 031462 032464 033466 034470 035472 036474 037476 +0000040 040500 041502 042504 043506 044510 045512 046514 047516 +0000050 050520 051522 052524 053526 054530 055532 056534 057536 +0000060 060540 061542 062544 063546 064550 065552 066554 067556 +0000070 070560 071562 072564 073566 074570 075572 076574 077576 +0000080 100600 101602 102604 103606 104610 105612 106614 107616 +0000090 110620 111622 112624 113626 114630 115632 116634 117636 +00000a0 120640 121642 122644 123646 124650 125652 126654 127656 +00000b0 130660 131662 132664 133666 134670 135672 136674 137676 +00000c0 140700 141702 142704 143706 144710 145712 146714 147716 +00000d0 150720 151722 152724 153726 154730 155732 156734 157736 +00000e0 160740 161742 162744 163746 164750 165752 166754 167756 +00000f0 170760 171762 172764 173766 174770 175772 000374 +00000fd diff --git a/tests/test_hexdump/test_hexdump_-s_128_-n_64_bytes.bin.hexdump b/tests/test_hexdump/test_hexdump_-s_128_-n_64_bytes.bin.hexdump new file mode 100644 index 0000000..9e7e1b4 --- /dev/null +++ b/tests/test_hexdump/test_hexdump_-s_128_-n_64_bytes.bin.hexdump @@ -0,0 +1,5 @@ +0000080 8180 8382 8584 8786 8988 8b8a 8d8c 8f8e +0000090 9190 9392 9594 9796 9998 9b9a 9d9c 9f9e +00000a0 a1a0 a3a2 a5a4 a7a6 a9a8 abaa adac afae +00000b0 b1b0 b3b2 b5b4 b7b6 b9b8 bbba bdbc bfbe +00000c0 diff --git a/tests/test_hexdump/test_hexdump_-s_32_bytes.bin.hexdump b/tests/test_hexdump/test_hexdump_-s_32_bytes.bin.hexdump new file mode 100644 index 0000000..af8bd4d --- /dev/null +++ b/tests/test_hexdump/test_hexdump_-s_32_bytes.bin.hexdump @@ -0,0 +1,15 @@ +0000020 2120 2322 2524 2726 2928 2b2a 2d2c 2f2e +0000030 3130 3332 3534 3736 3938 3b3a 3d3c 3f3e +0000040 4140 4342 4544 4746 4948 4b4a 4d4c 4f4e +0000050 5150 5352 5554 5756 5958 5b5a 5d5c 5f5e +0000060 6160 6362 6564 6766 6968 6b6a 6d6c 6f6e +0000070 7170 7372 7574 7776 7978 7b7a 7d7c 7f7e +0000080 8180 8382 8584 8786 8988 8b8a 8d8c 8f8e +0000090 9190 9392 9594 9796 9998 9b9a 9d9c 9f9e +00000a0 a1a0 a3a2 a5a4 a7a6 a9a8 abaa adac afae +00000b0 b1b0 b3b2 b5b4 b7b6 b9b8 bbba bdbc bfbe +00000c0 c1c0 c3c2 c5c4 c7c6 c9c8 cbca cdcc cfce +00000d0 d1d0 d3d2 d5d4 d7d6 d9d8 dbda dddc dfde +00000e0 e1e0 e3e2 e5e4 e7e6 e9e8 ebea edec efee +00000f0 f1f0 f3f2 f5f4 f7f6 f9f8 fbfa 00fc +00000fd diff --git a/tests/test_hexdump/test_hexdump_-v_wildcard.bin.hexdump b/tests/test_hexdump/test_hexdump_-v_wildcard.bin.hexdump new file mode 100644 index 0000000..f7dca4f --- /dev/null +++ b/tests/test_hexdump/test_hexdump_-v_wildcard.bin.hexdump @@ -0,0 +1,21 @@ +0000000 0100 0302 0504 0706 0908 0b0a 0d0c 0f0e +0000010 1110 1312 1514 1716 1918 1b1a 1d1c 1f1e +0000020 2120 2322 2524 2726 2928 2b2a 2d2c 2f2e +0000030 3130 3332 3534 3736 3938 3b3a 3d3c 3f3e +0000040 4140 4342 4544 4746 4948 4b4a 4d4c 4f4e +0000050 5150 5352 5554 5756 5958 5b5a 5d5c 5f5e +0000060 6160 6362 6564 6766 6968 6b6a 6d6c 6f6e +0000070 7170 7372 7574 7776 7978 7b7a 7d7c 7f7e +0000080 ffff ffff ffff ffff ffff ffff ffff ffff +0000090 ffff ffff ffff ffff ffff ffff ffff ffff +00000a0 ffff ffff ffff ffff ffff ffff ffff ffff +00000b0 ffff ffff ffff ffff ffff ffff ffff ffff +00000c0 8180 8382 8584 8786 8988 8b8a 8d8c 8f8e +00000d0 9190 9392 9594 9796 9998 9b9a 9d9c 9f9e +00000e0 a1a0 a3a2 a5a4 a7a6 a9a8 abaa adac afae +00000f0 b1b0 b3b2 b5b4 b7b6 b9b8 bbba bdbc bfbe +0000100 c1c0 c3c2 c5c4 c7c6 c9c8 cbca cdcc cfce +0000110 d1d0 d3d2 d5d4 d7d6 d9d8 dbda dddc dfde +0000120 e1e0 e3e2 e5e4 e7e6 e9e8 ebea edec efee +0000130 f1f0 00f2 +0000133 diff --git a/tests/test_hexdump/test_hexdump_-x_bytes.bin.hexdump b/tests/test_hexdump/test_hexdump_-x_bytes.bin.hexdump new file mode 100644 index 0000000..4107ae7 --- /dev/null +++ b/tests/test_hexdump/test_hexdump_-x_bytes.bin.hexdump @@ -0,0 +1,17 @@ +0000000 0100 0302 0504 0706 0908 0b0a 0d0c 0f0e +0000010 1110 1312 1514 1716 1918 1b1a 1d1c 1f1e +0000020 2120 2322 2524 2726 2928 2b2a 2d2c 2f2e +0000030 3130 3332 3534 3736 3938 3b3a 3d3c 3f3e +0000040 4140 4342 4544 4746 4948 4b4a 4d4c 4f4e +0000050 5150 5352 5554 5756 5958 5b5a 5d5c 5f5e +0000060 6160 6362 6564 6766 6968 6b6a 6d6c 6f6e +0000070 7170 7372 7574 7776 7978 7b7a 7d7c 7f7e +0000080 8180 8382 8584 8786 8988 8b8a 8d8c 8f8e +0000090 9190 9392 9594 9796 9998 9b9a 9d9c 9f9e +00000a0 a1a0 a3a2 a5a4 a7a6 a9a8 abaa adac afae +00000b0 b1b0 b3b2 b5b4 b7b6 b9b8 bbba bdbc bfbe +00000c0 c1c0 c3c2 c5c4 c7c6 c9c8 cbca cdcc cfce +00000d0 d1d0 d3d2 d5d4 d7d6 d9d8 dbda dddc dfde +00000e0 e1e0 e3e2 e5e4 e7e6 e9e8 ebea edec efee +00000f0 f1f0 f3f2 f5f4 f7f6 f9f8 fbfa 00fc +00000fd diff --git a/tests/test_hexdump/test_hexdump_bytes.bin.hexdump b/tests/test_hexdump/test_hexdump_bytes.bin.hexdump new file mode 100644 index 0000000..d534cec --- /dev/null +++ b/tests/test_hexdump/test_hexdump_bytes.bin.hexdump @@ -0,0 +1,17 @@ +0000000 0100 0302 0504 0706 0908 0b0a 0d0c 0f0e +0000010 1110 1312 1514 1716 1918 1b1a 1d1c 1f1e +0000020 2120 2322 2524 2726 2928 2b2a 2d2c 2f2e +0000030 3130 3332 3534 3736 3938 3b3a 3d3c 3f3e +0000040 4140 4342 4544 4746 4948 4b4a 4d4c 4f4e +0000050 5150 5352 5554 5756 5958 5b5a 5d5c 5f5e +0000060 6160 6362 6564 6766 6968 6b6a 6d6c 6f6e +0000070 7170 7372 7574 7776 7978 7b7a 7d7c 7f7e +0000080 8180 8382 8584 8786 8988 8b8a 8d8c 8f8e +0000090 9190 9392 9594 9796 9998 9b9a 9d9c 9f9e +00000a0 a1a0 a3a2 a5a4 a7a6 a9a8 abaa adac afae +00000b0 b1b0 b3b2 b5b4 b7b6 b9b8 bbba bdbc bfbe +00000c0 c1c0 c3c2 c5c4 c7c6 c9c8 cbca cdcc cfce +00000d0 d1d0 d3d2 d5d4 d7d6 d9d8 dbda dddc dfde +00000e0 e1e0 e3e2 e5e4 e7e6 e9e8 ebea edec efee +00000f0 f1f0 f3f2 f5f4 f7f6 f9f8 fbfa 00fc +00000fd diff --git a/tests/test_hexdump/test_hexdump_wildcard.bin.hexdump b/tests/test_hexdump/test_hexdump_wildcard.bin.hexdump new file mode 100644 index 0000000..a009c18 --- /dev/null +++ b/tests/test_hexdump/test_hexdump_wildcard.bin.hexdump @@ -0,0 +1,19 @@ +0000000 0100 0302 0504 0706 0908 0b0a 0d0c 0f0e +0000010 1110 1312 1514 1716 1918 1b1a 1d1c 1f1e +0000020 2120 2322 2524 2726 2928 2b2a 2d2c 2f2e +0000030 3130 3332 3534 3736 3938 3b3a 3d3c 3f3e +0000040 4140 4342 4544 4746 4948 4b4a 4d4c 4f4e +0000050 5150 5352 5554 5756 5958 5b5a 5d5c 5f5e +0000060 6160 6362 6564 6766 6968 6b6a 6d6c 6f6e +0000070 7170 7372 7574 7776 7978 7b7a 7d7c 7f7e +0000080 ffff ffff ffff ffff ffff ffff ffff ffff +* +00000c0 8180 8382 8584 8786 8988 8b8a 8d8c 8f8e +00000d0 9190 9392 9594 9796 9998 9b9a 9d9c 9f9e +00000e0 a1a0 a3a2 a5a4 a7a6 a9a8 abaa adac afae +00000f0 b1b0 b3b2 b5b4 b7b6 b9b8 bbba bdbc bfbe +0000100 c1c0 c3c2 c5c4 c7c6 c9c8 cbca cdcc cfce +0000110 d1d0 d3d2 d5d4 d7d6 d9d8 dbda dddc dfde +0000120 e1e0 e3e2 e5e4 e7e6 e9e8 ebea edec efee +0000130 f1f0 00f2 +0000133 diff --git a/tests/test_hexdump/wildcard.bin b/tests/test_hexdump/wildcard.bin new file mode 100644 index 0000000000000000000000000000000000000000..2c74dc242dcc76b0e7ca382e2c3d0e40228a17d7 GIT binary patch literal 307 zcmZQzWMXDvWn<^yMC+6cQE@6%&_`l#-T_m6KOcR8m$^Ra4i{)Y8_`)zddH zG%_|ZH8Z!cw6eCbwX=6{baHlab#wRd^z!!c_45x13h9_7>z^=j(&Q;q zr%j(RbJpxRbLY)puyE1hB}NRWEt>3V5)8;K(w{73CbJy-Yd-v@>aPZLK zBS()NKXLNZ=`&}~oxgDL(&Z~xuU)@!^VaPo;%Tz5np> F696uzvYY?_ literal 0 HcmV?d00001