mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-16 15:57:00 +00:00
test all sorting options
Not perfect test, but atleast something. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
da4b7a783a
commit
01aa13cf43
3 changed files with 242 additions and 0 deletions
|
|
@ -20,6 +20,7 @@ TESTS = \
|
|||
tests/one-line \
|
||||
tests/same-twice \
|
||||
tests/simple \
|
||||
tests/sorts \
|
||||
tests/v6
|
||||
|
||||
EXTRA_DIST += \
|
||||
|
|
|
|||
168
tests/expected/sorts
Normal file
168
tests/expected/sorts
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
== name ==
|
||||
Ranges:
|
||||
shared net name first ip last ip max cur percent touch t+c t+c perc
|
||||
All networks 10.4.0.1 - 10.4.0.20 20 5 25.000 0 5 25.000
|
||||
example1 10.1.0.1 - 10.1.0.20 20 10 50.000 0 10 50.000
|
||||
example1 10.0.0.1 - 10.0.0.20 20 11 55.000 0 11 55.000
|
||||
example2 10.3.0.1 - 10.3.0.20 20 9 45.000 0 9 45.000
|
||||
example2 10.2.0.1 - 10.2.0.20 20 8 40.000 0 8 40.000
|
||||
|
||||
Shared networks:
|
||||
name max cur percent touch t+c t+c perc
|
||||
example1 40 21 52.500 0 21 52.500
|
||||
example2 40 17 42.500 0 17 42.500
|
||||
|
||||
Sum of all ranges:
|
||||
name max cur percent touch t+c t+c perc
|
||||
All networks 100 43 43.000 0 43 43.000
|
||||
0
|
||||
== ip ==
|
||||
Ranges:
|
||||
shared net name first ip last ip max cur percent touch t+c t+c perc
|
||||
example1 10.0.0.1 - 10.0.0.20 20 11 55.000 0 11 55.000
|
||||
example1 10.1.0.1 - 10.1.0.20 20 10 50.000 0 10 50.000
|
||||
example2 10.2.0.1 - 10.2.0.20 20 8 40.000 0 8 40.000
|
||||
example2 10.3.0.1 - 10.3.0.20 20 9 45.000 0 9 45.000
|
||||
All networks 10.4.0.1 - 10.4.0.20 20 5 25.000 0 5 25.000
|
||||
|
||||
Shared networks:
|
||||
name max cur percent touch t+c t+c perc
|
||||
example1 40 21 52.500 0 21 52.500
|
||||
example2 40 17 42.500 0 17 42.500
|
||||
|
||||
Sum of all ranges:
|
||||
name max cur percent touch t+c t+c perc
|
||||
All networks 100 43 43.000 0 43 43.000
|
||||
0
|
||||
== maxium ==
|
||||
Ranges:
|
||||
shared net name first ip last ip max cur percent touch t+c t+c perc
|
||||
All networks 10.4.0.1 - 10.4.0.20 20 5 25.000 0 5 25.000
|
||||
example2 10.3.0.1 - 10.3.0.20 20 9 45.000 0 9 45.000
|
||||
example2 10.2.0.1 - 10.2.0.20 20 8 40.000 0 8 40.000
|
||||
example1 10.1.0.1 - 10.1.0.20 20 10 50.000 0 10 50.000
|
||||
example1 10.0.0.1 - 10.0.0.20 20 11 55.000 0 11 55.000
|
||||
|
||||
Shared networks:
|
||||
name max cur percent touch t+c t+c perc
|
||||
example1 40 21 52.500 0 21 52.500
|
||||
example2 40 17 42.500 0 17 42.500
|
||||
|
||||
Sum of all ranges:
|
||||
name max cur percent touch t+c t+c perc
|
||||
All networks 100 43 43.000 0 43 43.000
|
||||
0
|
||||
== current ==
|
||||
Ranges:
|
||||
shared net name first ip last ip max cur percent touch t+c t+c perc
|
||||
All networks 10.4.0.1 - 10.4.0.20 20 5 25.000 0 5 25.000
|
||||
example2 10.3.0.1 - 10.3.0.20 20 9 45.000 0 9 45.000
|
||||
example2 10.2.0.1 - 10.2.0.20 20 8 40.000 0 8 40.000
|
||||
example1 10.1.0.1 - 10.1.0.20 20 10 50.000 0 10 50.000
|
||||
example1 10.0.0.1 - 10.0.0.20 20 11 55.000 0 11 55.000
|
||||
|
||||
Shared networks:
|
||||
name max cur percent touch t+c t+c perc
|
||||
example1 40 21 52.500 0 21 52.500
|
||||
example2 40 17 42.500 0 17 42.500
|
||||
|
||||
Sum of all ranges:
|
||||
name max cur percent touch t+c t+c perc
|
||||
All networks 100 43 43.000 0 43 43.000
|
||||
0
|
||||
1
|
||||
== percent ==
|
||||
Ranges:
|
||||
shared net name first ip last ip max cur percent touch t+c t+c perc
|
||||
All networks 10.4.0.1 - 10.4.0.20 20 5 25.000 0 5 25.000
|
||||
example2 10.3.0.1 - 10.3.0.20 20 9 45.000 0 9 45.000
|
||||
example2 10.2.0.1 - 10.2.0.20 20 8 40.000 0 8 40.000
|
||||
example1 10.1.0.1 - 10.1.0.20 20 10 50.000 0 10 50.000
|
||||
example1 10.0.0.1 - 10.0.0.20 20 11 55.000 0 11 55.000
|
||||
|
||||
Shared networks:
|
||||
name max cur percent touch t+c t+c perc
|
||||
example1 40 21 52.500 0 21 52.500
|
||||
example2 40 17 42.500 0 17 42.500
|
||||
|
||||
Sum of all ranges:
|
||||
name max cur percent touch t+c t+c perc
|
||||
All networks 100 43 43.000 0 43 43.000
|
||||
0
|
||||
1
|
||||
1
|
||||
== touched ==
|
||||
Ranges:
|
||||
shared net name first ip last ip max cur percent touch t+c t+c perc
|
||||
All networks 10.4.0.1 - 10.4.0.20 20 5 25.000 0 5 25.000
|
||||
example2 10.3.0.1 - 10.3.0.20 20 9 45.000 0 9 45.000
|
||||
example2 10.2.0.1 - 10.2.0.20 20 8 40.000 0 8 40.000
|
||||
example1 10.1.0.1 - 10.1.0.20 20 10 50.000 0 10 50.000
|
||||
example1 10.0.0.1 - 10.0.0.20 20 11 55.000 0 11 55.000
|
||||
|
||||
Shared networks:
|
||||
name max cur percent touch t+c t+c perc
|
||||
example1 40 21 52.500 0 21 52.500
|
||||
example2 40 17 42.500 0 17 42.500
|
||||
|
||||
Sum of all ranges:
|
||||
name max cur percent touch t+c t+c perc
|
||||
All networks 100 43 43.000 0 43 43.000
|
||||
0
|
||||
== t+c ==
|
||||
Ranges:
|
||||
shared net name first ip last ip max cur percent touch t+c t+c perc
|
||||
All networks 10.4.0.1 - 10.4.0.20 20 5 25.000 0 5 25.000
|
||||
example2 10.2.0.1 - 10.2.0.20 20 8 40.000 0 8 40.000
|
||||
example2 10.3.0.1 - 10.3.0.20 20 9 45.000 0 9 45.000
|
||||
example1 10.1.0.1 - 10.1.0.20 20 10 50.000 0 10 50.000
|
||||
example1 10.0.0.1 - 10.0.0.20 20 11 55.000 0 11 55.000
|
||||
|
||||
Shared networks:
|
||||
name max cur percent touch t+c t+c perc
|
||||
example1 40 21 52.500 0 21 52.500
|
||||
example2 40 17 42.500 0 17 42.500
|
||||
|
||||
Sum of all ranges:
|
||||
name max cur percent touch t+c t+c perc
|
||||
All networks 100 43 43.000 0 43 43.000
|
||||
0
|
||||
== t+c perc ==
|
||||
Ranges:
|
||||
shared net name first ip last ip max cur percent touch t+c t+c perc
|
||||
All networks 10.4.0.1 - 10.4.0.20 20 5 25.000 0 5 25.000
|
||||
example2 10.2.0.1 - 10.2.0.20 20 8 40.000 0 8 40.000
|
||||
example2 10.3.0.1 - 10.3.0.20 20 9 45.000 0 9 45.000
|
||||
example1 10.1.0.1 - 10.1.0.20 20 10 50.000 0 10 50.000
|
||||
example1 10.0.0.1 - 10.0.0.20 20 11 55.000 0 11 55.000
|
||||
|
||||
Shared networks:
|
||||
name max cur percent touch t+c t+c perc
|
||||
example1 40 21 52.500 0 21 52.500
|
||||
example2 40 17 42.500 0 17 42.500
|
||||
|
||||
Sum of all ranges:
|
||||
name max cur percent touch t+c t+c perc
|
||||
All networks 100 43 43.000 0 43 43.000
|
||||
0
|
||||
== reverse ==
|
||||
Ranges:
|
||||
shared net name first ip last ip max cur percent touch t+c t+c perc
|
||||
All networks 10.4.0.1 - 10.4.0.20 20 5 25.000 0 5 25.000
|
||||
example2 10.3.0.1 - 10.3.0.20 20 9 45.000 0 9 45.000
|
||||
example2 10.2.0.1 - 10.2.0.20 20 8 40.000 0 8 40.000
|
||||
example1 10.1.0.1 - 10.1.0.20 20 10 50.000 0 10 50.000
|
||||
example1 10.0.0.1 - 10.0.0.20 20 11 55.000 0 11 55.000
|
||||
|
||||
Shared networks:
|
||||
name max cur percent touch t+c t+c perc
|
||||
example1 40 21 52.500 0 21 52.500
|
||||
example2 40 17 42.500 0 17 42.500
|
||||
|
||||
Sum of all ranges:
|
||||
name max cur percent touch t+c t+c perc
|
||||
All networks 100 43 43.000 0 43 43.000
|
||||
0
|
||||
== broken ==
|
||||
dhcpd-pools: field_selector: unknown sort order: 'x'
|
||||
1
|
||||
73
tests/sorts
Executable file
73
tests/sorts
Executable file
|
|
@ -0,0 +1,73 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Alarm warning both ranges and shared networks.
|
||||
|
||||
IAM=$(basename $0)
|
||||
|
||||
if [ ! -d tests/outputs ]; then
|
||||
mkdir tests/outputs
|
||||
fi
|
||||
|
||||
echo '== name ==' > tests/outputs/$IAM
|
||||
dhcpd-pools --config tests/confs/complete --leases tests/leases/complete \
|
||||
--sort=n --output=tests/outputs/$IAM-too
|
||||
echo $? >> tests/outputs/$IAM-too
|
||||
cat tests/outputs/$IAM-too >> tests/outputs/$IAM
|
||||
|
||||
echo '== ip ==' >> tests/outputs/$IAM
|
||||
dhcpd-pools --config tests/confs/complete --leases tests/leases/complete \
|
||||
--sort=i --output=tests/outputs/$IAM-too
|
||||
echo $? >> tests/outputs/$IAM-too
|
||||
cat tests/outputs/$IAM-too >> tests/outputs/$IAM
|
||||
|
||||
echo '== maxium ==' >> tests/outputs/$IAM
|
||||
dhcpd-pools --config tests/confs/complete --leases tests/leases/complete \
|
||||
--sort=m --output=tests/outputs/$IAM-too
|
||||
echo $? >> tests/outputs/$IAM-too
|
||||
cat tests/outputs/$IAM-too >> tests/outputs/$IAM
|
||||
|
||||
echo '== current ==' >> tests/outputs/$IAM
|
||||
dhcpd-pools --config tests/confs/complete --leases tests/leases/complete \
|
||||
--sort=current --output=tests/outputs/$IAM-too
|
||||
echo $? >> tests/outputs/$IAM-too
|
||||
cat tests/outputs/$IAM-too >> tests/outputs/$IAM
|
||||
|
||||
echo '== percent ==' >> tests/outputs/$IAM
|
||||
dhcpd-pools --config tests/confs/complete --leases tests/leases/complete \
|
||||
-s peeeeeeeeeeercent --output=tests/outputs/$IAM-too
|
||||
echo $? >> tests/outputs/$IAM-too
|
||||
cat tests/outputs/$IAM-too >> tests/outputs/$IAM
|
||||
|
||||
echo '== touched ==' >> tests/outputs/$IAM
|
||||
dhcpd-pools --config tests/confs/complete --leases tests/leases/complete \
|
||||
--sort=t --output=tests/outputs/$IAM-too
|
||||
echo $? >> tests/outputs/$IAM-too
|
||||
cat tests/outputs/$IAM-too >> tests/outputs/$IAM
|
||||
|
||||
echo '== t+c ==' >> tests/outputs/$IAM
|
||||
dhcpd-pools --config tests/confs/complete --leases tests/leases/complete \
|
||||
--sort=T --output=tests/outputs/$IAM-too
|
||||
echo $? >> tests/outputs/$IAM-too
|
||||
cat tests/outputs/$IAM-too >> tests/outputs/$IAM
|
||||
|
||||
echo '== t+c perc ==' >> tests/outputs/$IAM
|
||||
dhcpd-pools --config tests/confs/complete --leases tests/leases/complete \
|
||||
--sort=e --output=tests/outputs/$IAM-too
|
||||
echo $? >> tests/outputs/$IAM-too
|
||||
cat tests/outputs/$IAM-too >> tests/outputs/$IAM
|
||||
|
||||
echo '== reverse ==' >> tests/outputs/$IAM
|
||||
dhcpd-pools --config tests/confs/complete --leases tests/leases/complete \
|
||||
--reverse --output=tests/outputs/$IAM-too
|
||||
echo $? >> tests/outputs/$IAM-too
|
||||
cat tests/outputs/$IAM-too >> tests/outputs/$IAM
|
||||
|
||||
echo '== broken ==' >> tests/outputs/$IAM
|
||||
dhcpd-pools --config tests/confs/complete --leases tests/leases/complete \
|
||||
--sort=x 2>tests/outputs/$IAM-too
|
||||
echo $? >> tests/outputs/$IAM-too
|
||||
cat tests/outputs/$IAM-too >> tests/outputs/$IAM
|
||||
|
||||
rm -f tests/outputs/$IAM-too
|
||||
diff -u $top_srcdir/tests/expected/$IAM tests/outputs/$IAM
|
||||
exit $?
|
||||
Loading…
Add table
Add a link
Reference in a new issue