Skip to content

Commit

Permalink
Merge pull request #363 from Don-Ward/FixedPoint
Browse files Browse the repository at this point in the history
Add classes to uni/lib that implement fixed point arithmetic.
  • Loading branch information
Jafaral authored Mar 2, 2024
2 parents 9958407 + 5b1a617 commit 241d87b
Show file tree
Hide file tree
Showing 9 changed files with 1,271 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ E=/bin/echo
# define UC if it is not defined already
UC?=../bin/unicon

TESTS=general posix thread pattern mt
TESTS=general posix thread pattern mt unicon

# The default is to run all tests, using icont.

Expand Down
20 changes: 20 additions & 0 deletions tests/unicon/FxPtTest.icn
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#################################################################################
#
# This file is released under the terms of the GNU LIBRARY GENERAL PUBLIC LICENSE
# (LGPL) version 2. The licence may be found in the root directory of the Unicon
# source directory in the file COPYING.
#
# Fixed Point Arithmetic class tests (without operator overloading)
# --------------------------------------------------------------------------------

procedure main(args)
if not(&features == "large integers") then
stop("large integers not supported")

runTests(args)
end

# Turn off operator overloading
$undef _OVLD
$include "FxPtTests.icn"

21 changes: 21 additions & 0 deletions tests/unicon/FxPtTest_OVLD.icn
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#################################################################################
#
# This file is released under the terms of the GNU LIBRARY GENERAL PUBLIC LICENSE
# (LGPL) version 2. The licence may be found in the root directory of the Unicon
# source directory in the file COPYING.
#
# Fixed Point Arithmetic class tests (with operator overloading)
# --------------------------------------------------------------------------------

procedure main(args)
if not(&features == "large integers") then
stop("large integers not supported")

if not (&features == "operator overloading") then
stop("operator overloading not supported")

runTests(args)
end

$include "FxPtTests.icn"

550 changes: 550 additions & 0 deletions tests/unicon/FxPtTests.icn

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions tests/unicon/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

include ../Makedefs

ifneq ("$(wildcard $(UC))","")
TARGETS=$(patsubst %.icn,%,$(wildcard *.icn))

SKIP= tester FxPtTests\
audio dbi list_test nlm q rec test testnlm clin_err hello mintest ovld q2 sel to
else
skip:
@echo "Unicon compiler not found"

TARGETS=skip
endif

Test: DoTest

include ../Makefile.test

FxPtTest: FxPtTest.icn tester.u

FxPtTest_OVLD: FxPtTest_OVLD.icn tester.u

tester.u: tester.icn
$(UC) -s -u -c $^



4 changes: 4 additions & 0 deletions tests/unicon/stand/FxPtTest.std
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
--------------------------------------------------
Fixed Point Tests Start
Fixed Point Tests Passed = 454 Failed = 0
--------------------------------------------------
4 changes: 4 additions & 0 deletions tests/unicon/stand/FxPtTest_OVLD.std
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
--------------------------------------------------
Fixed Point Tests Start
Fixed Point Tests Passed = 586 Failed = 0
--------------------------------------------------
Loading

0 comments on commit 241d87b

Please sign in to comment.