tests: bonsai/rpn.mk: added rpn(1) test
This commit is contained in:
parent
acdbecf178
commit
3880abaa4f
43
tests/bonsai/rpn.mk
Executable file
43
tests/bonsai/rpn.mk
Executable file
|
@ -0,0 +1,43 @@
|
|||
# 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.
|
||||
|
||||
.PHONY: rpn_tests
|
||||
rpn_tests: rpn_help rpn_add
|
||||
|
||||
.PHONY: rpn_help
|
||||
rpn_help: $(BIN)/rpn
|
||||
! $(BIN)/rpn -h
|
||||
|
||||
.PHONY: rpn_add
|
||||
rpn_add: $(BIN)/rpn
|
||||
test "$$($(BIN)/rpn 1 2 +)" -eq 3
|
||||
test "$$($(BIN)/rpn 0.2 0.1 +)" = 0.3
|
||||
|
||||
.PHONY: rpn_sub
|
||||
rpn_sub: $(BIN)/rpn
|
||||
test "$$($(BIN)/rpn 23 5 -)" -eq 18
|
||||
test "$$($(BIN)/rpn 0.3 0.1)" = 0.2
|
||||
|
||||
.PHONY: rpn_mul
|
||||
rpn_mul: $(BIN)/rpn
|
||||
test "$$($(BIN)/rpn 1.2 3 '*')" = 3.6
|
||||
test "$$($(BIN)/rpn 0 3 '*')" -eq 0
|
||||
|
||||
.PHONY: rpn_div
|
||||
rpn_div: $(BIN)/rpn
|
||||
test "$$($(BIN)/rpn 12 5 /)" = 2.4
|
||||
test "$$($(BIN)/rpn 3 0 /)" -eq inf
|
||||
|
||||
.PHONY: rpn_mod
|
||||
rpn_mod: $(BIN)/rpn
|
||||
test "$$($(BIN)/rpn 12 5 %)" -eq 2
|
||||
test "$$($(BIN)/rpn 9 4 %)" -eq 1
|
||||
|
||||
.PHONY: rpn_flr
|
||||
rpn_flr: $(BIN)/rpn
|
||||
test "$$($(BIN)/rpn 12 5 //)" -eq 2
|
||||
test "$$($(BIN)/rpn 9 4 //)" -eq 2
|
Loading…
Reference in New Issue
Block a user