forked from bonsai/harakit
tests: bonsai: hru.sh: adds test
This commit is contained in:
parent
1aa2b596d0
commit
0113cf793d
26
tests/bonsai/hru.sh
Executable file
26
tests/bonsai/hru.sh
Executable file
@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media>
|
||||||
|
# SPDX-License-Identifier: FSFAP
|
||||||
|
#
|
||||||
|
# Copying and distribution of this file, with or without modification, are
|
||||||
|
# permitted in any medium without royalty provided the copyright notice and this
|
||||||
|
# notice are preserved. This file is offered as-is, without any warranty.
|
||||||
|
|
||||||
|
. tests/bonsai/aliases
|
||||||
|
|
||||||
|
alias strcmp="$BIN/strcmp"
|
||||||
|
alias rpn="$BIN/rpn"
|
||||||
|
|
||||||
|
strcmp "$(printf '1234\n' | hru)" '1.2 kB'
|
||||||
|
strcmp "$(printf '0\n' | hru)" '0 B'
|
||||||
|
|
||||||
|
# doesn’t currently work but would be useful for testing for regressions
|
||||||
|
#n=1
|
||||||
|
#while "$BIN/true"; do
|
||||||
|
# n="$(rpn "$n" 10 ×)"
|
||||||
|
#
|
||||||
|
# printf '%s\n' "$n" | hru || break
|
||||||
|
#done
|
||||||
|
#printf 'integer limit: ~%s\n' "$(rpn "$n" 10 ÷)"
|
||||||
|
|
||||||
|
! printf '%s\n' '-1' | hru
|
Loading…
Reference in New Issue
Block a user