logo

utils

~/.local/bin tools and git-hooks git clone https://hacktivis.me/git/utils.git
commit: fe48242ff77886cf073567ce0c83d31a52a7f056
parent 792c66d2246fffe3bc2f43e6b07ef64904f430c9
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sat, 21 Aug 2021 00:17:31 +0200

test-bin/humanize: New

Diffstat:

Mtest-bin/Kyuafile1+
Atest-bin/humanize64++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 65 insertions(+), 0 deletions(-)

diff --git a/test-bin/Kyuafile b/test-bin/Kyuafile @@ -8,6 +8,7 @@ atf_test_program{name="cat"} atf_test_program{name="tee"} atf_test_program{name="basename"} atf_test_program{name="dirname"} +atf_test_program{name="humanize"} atf_test_program{name="sname"} atf_test_program{name="true"} atf_test_program{name="false"} diff --git a/test-bin/humanize b/test-bin/humanize @@ -0,0 +1,64 @@ +#!/usr/bin/env atf-sh +atf_test_case one +one_body() { + atf_check -o "inline:1 \n" ../bin/humanize 1 + atf_check -o "inline:1 \n" ../bin/humanize -d 1 + atf_check -o "inline:1B \n" ../bin/humanize -b 1 +} + +atf_test_case two +two_body() { + atf_check -o "inline:12 \n" ../bin/humanize 12 + atf_check -o "inline:12 \n" ../bin/humanize -d 12 + atf_check -o "inline:12B \n" ../bin/humanize -b 12 +} + +atf_test_case three +three_body() { + atf_check -o "inline:123 \n" ../bin/humanize 123 + atf_check -o "inline:123 \n" ../bin/humanize -d 123 + atf_check -o "inline:123B \n" ../bin/humanize -b 123 +} + +# 1 234 +atf_test_case four +four_body() { + atf_check -o "inline:1234 \n" ../bin/humanize 1234 + atf_check -o "inline:1234 \n" ../bin/humanize -d 1234 + atf_check -o "inline:1234B \n" ../bin/humanize -b 1234 +} + +# 12 345 +atf_test_case five +five_body() { + atf_check -o "inline:12k \n" ../bin/humanize 12345 + atf_check -o "inline:12k \n" ../bin/humanize -d 12345 + atf_check -o "inline:12Ki \n" ../bin/humanize -b 12345 +} + +# 123 456 +atf_test_case six +six_body() { + atf_check -o "inline:123k \n" ../bin/humanize 123456 + atf_check -o "inline:123k \n" ../bin/humanize -d 123456 + atf_check -o "inline:121Ki \n" ../bin/humanize -b 123456 +} + +# 1234 4567 +atf_test_case seven +seven_body() { + atf_check -o "inline:1235k \n" ../bin/humanize 1234567 + atf_check -o "inline:1235k \n" ../bin/humanize -d 1234567 + atf_check -o "inline:1206Ki \n" ../bin/humanize -b 1234567 +} + +atf_init_test_cases() { + cd "$(atf_get_srcdir)" + atf_add_test_case one + atf_add_test_case two + atf_add_test_case three + atf_add_test_case four + atf_add_test_case five + atf_add_test_case six + atf_add_test_case seven +}