bonsix/tests/bonsai/hru.mk

36 lines
909 B
Makefile
Raw Normal View History

2024-08-02 17:29:30 -06:00
# 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.
NAME = hru
TARGET = $(NAME)_tests
BINARY = $(BIN)/$(NAME)
.PHONY: hru_tests
hru_tests: $(BIN)/hru
.PHONY: hru_functionality
hru_functionality: $(BIN)/hru
test "$(printf '1234\n' | $(BIN)/hru)" = '1.2 kB'
test "$(printf '0\n' | $(BIN)/hru)" = '0 B'
.PHONY: $(NAME_help)
hru_help: $(BIN)/hru
! $(BIN)/hru -h
.PHONY: hru_negative
hru_negative: $(BIN)/hru
! printf '%s\n' '-1' | $(BIN)/hru
.PHONY: hru_regressions
hru_regressions: $(BIN)/hru
n=1; \
while true; \
do n="$$(($$n * 10))"; \
printf '%s\n' "$$n" | $(BIN)/hru || break; \
done; \
printf 'Max float: %s\n' "$$n"