File: bits

package info (click to toggle)
util-linux 2.41.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 92,844 kB
  • sloc: ansic: 179,146; sh: 22,716; yacc: 1,284; makefile: 525; xml: 422; python: 316; lex: 89; ruby: 75; csh: 37; exp: 19; sed: 16; perl: 15; sql: 9
file content (89 lines) | stat: -rwxr-xr-x 2,266 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash

#
# SPDX-License-Identifier: GPL-2.0-or-later
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Copyright (c) 2024 Robin Jarry
#
TS_TOPDIR="${0%/*}/../.."
TS_DESC="bits"

. "$TS_TOPDIR"/functions.sh
ts_init "$*"

ts_check_test_command "$TS_CMD_BITS"
ts_cd "$TS_OUTDIR"

ts_init_subtest "default"
$TS_CMD_BITS 11,22,33,44 >> $TS_OUTPUT 2>> $TS_ERRLOG
ts_finalize_subtest

ts_init_subtest "mask"
$TS_CMD_BITS --mask 11,22,33,44 >> $TS_OUTPUT 2>> $TS_ERRLOG
ts_finalize_subtest

ts_init_subtest "grouped-mask"
$TS_CMD_BITS --grouped-mask 11,22,33,44 >> $TS_OUTPUT 2>> $TS_ERRLOG
ts_finalize_subtest

ts_init_subtest "list"
$TS_CMD_BITS --list 11,22,33,44 >> $TS_OUTPUT 2>> $TS_ERRLOG
ts_finalize_subtest

ts_init_subtest "binary"
$TS_CMD_BITS --binary 11,22,33,44 >> $TS_OUTPUT 2>> $TS_ERRLOG
ts_finalize_subtest

ts_init_subtest "truncate"
$TS_CMD_BITS -l 1,10000 >> $TS_OUTPUT 2>> $TS_ERRLOG
ts_finalize_subtest

ts_init_subtest "width"
$TS_CMD_BITS -w 16384 -l 10000  >> $TS_OUTPUT 2>> $TS_ERRLOG
ts_finalize_subtest

ts_init_subtest "width-truncate"
$TS_CMD_BITS -w 32 -l 11,22,33,44 >> $TS_OUTPUT 2>> $TS_ERRLOG
ts_finalize_subtest

ts_init_subtest "parse-mask"
$TS_CMD_BITS -l 0x0badcaca >> $TS_OUTPUT 2>> $TS_ERRLOG
ts_finalize_subtest

ts_init_subtest "parse-range"
$TS_CMD_BITS -g 50-100 75-150 >> $TS_OUTPUT 2>> $TS_ERRLOG
ts_finalize_subtest

ts_init_subtest "parse-grouped-mask"
$TS_CMD_BITS -l ,9000000,00000000,0c000000,00000000 >> $TS_OUTPUT 2>> $TS_ERRLOG
ts_finalize_subtest

ts_init_subtest "or"
$TS_CMD_BITS -l 50-100 '|75-150' >> $TS_OUTPUT 2>> $TS_ERRLOG
ts_finalize_subtest

ts_init_subtest "and"
$TS_CMD_BITS -l 50-100 '&75-150' >> $TS_OUTPUT 2>> $TS_ERRLOG
ts_finalize_subtest

ts_init_subtest "xor"
$TS_CMD_BITS -l 50-100 '^75-150' >> $TS_OUTPUT 2>> $TS_ERRLOG
ts_finalize_subtest

ts_init_subtest "not"
$TS_CMD_BITS -l 50-100 '~75-150' >> $TS_OUTPUT 2>> $TS_ERRLOG
ts_finalize_subtest

ts_init_subtest "stdin"
{
	echo 11,22,33,44
	echo ^22
} | $TS_CMD_BITS --list >> $TS_OUTPUT 2>> $TS_ERRLOG
ts_finalize_subtest

ts_finalize