Skip to content

Commit

Permalink
TESTS: added tests to reflect issue red#208 in float-test.reds and fl…
Browse files Browse the repository at this point in the history
…oat32-test.reds
  • Loading branch information
PeterWAWood committed Feb 27, 2012
1 parent 4437311 commit 86e048f
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 1 deletion.
40 changes: 40 additions & 0 deletions red-system/tests/source/units/float-test.reds
Expand Up @@ -237,4 +237,44 @@ Red/System [

===end-group===

===start-group=== "float arguments to typed functions"
fatf1: function [
[typed]
count [integer!]
list [typed-value!]
return: [float!]
/local
a [float!]
][
a: as float! list/value
]

fatf2: function [
[typed]
count [integer!]
list [typed-value!]
return: [float!]
/local
a [float!]
b [float!]
][
a: as float! list/value
list: list + 1
b: as float! list/value
a + b
]

--test-- "fatf-1"
--assert 2.0 = fatf1 2.0

--test-- "fatf-2"
--assert 2.0 = fatf1 1.0 + fatf1 1.0

--test-- "fatf-3"
--assert 3.0 = fatf2 1.0 2.0


===end-group===


~~~end-file~~~
41 changes: 40 additions & 1 deletion red-system/tests/source/units/float32-test.reds
Expand Up @@ -215,7 +215,7 @@ Red/System [
as float32! 2.0
]

--test-- "ewrfv0"
--test-- "ewrfv0"
--assertf32~= as float32! 1.0 (fe1 * as float32! 1.0) as float32! 0.1E-3

--test-- "ewrfv1"
Expand All @@ -226,5 +226,44 @@ Red/System [

===end-group===

===start-group=== "float32 arguments to typed functions"
fatf1: function [
[typed]
count [integer!]
list [typed-value!]
return: [float32!]
/local
a [float32!]
][
a: as float32! list/value
]

fatf2: function [
[typed]
count [integer!]
list [typed-value!]
return: [float32!]
/local
a [float32!]
b [float32!]
][
a: as float32! list/value
list: list + 1
b: as float32! list/value
a + b
]

--test-- "fatf-1"
--assert (as float32! 2.0) = (fatf1 as float32! 2.0)

--test-- "fatf-2"
--assert (as float32! 2.0) = ((fatf1 as float32! 1.0) + (fatf1 as float32! 1.0))

--test-- "fatf-3"
--assert (as float32! 3.0) = fatf2 as float32! 1.0 as float! 2.0


===end-group===


~~~end-file~~~

0 comments on commit 86e048f

Please sign in to comment.