Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
12771 lines (12768 sloc) 271 KB
<
; Rebol []
; *****************************************************************************
; Title: Rebol core tests
; Copyright:
; 2012 REBOL Technologies
; 2013 Saphirion AG
; Author:
; Carl Sassenrath, Ladislav Mecir, Andreas Bolka, Brian Hawley, John K
; License:
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
; *****************************************************************************
; datatypes/action.r
[action? :abs]
[not action? 1]
[action! = type? :abs]
; bug#1659
; implicit evaluation
[1 == do reduce [:abs -1]]
; indirect (word) implicit evaluation
[1 == abs -1]
; indirect (path) implicit evaluation
[
b: reduce [:abs]
1 == b/1 -1
]
; explicit evaluation
[1 == do :abs -1]
; indirect (word) explicit evaluation
; indirect (path) explicit evaluation
; datatypes/binary.r
[binary? #{00}]
[not binary? 1]
[binary! = type? #{00}]
[
system/options/binary-base: 2
"2#{00000000}" == mold #{00}
]
[
system/options/binary-base: 64
"64#{AAAA}" == mold #{000000}
]
[
system/options/binary-base: 16
"#{00}" == mold #{00}
]
[#{00} == 2#{00000000}]
[#{000000} == 64#{AAAA}]
[#{} == make binary! 0]
[#{00} == to binary! "^(00)"]
; minimum
[binary? #{}]
; alternative literal representation
[#{} == #[binary! #{}]]
; access symmetry
[
b: #{0b}
not error? try [b/1: b/1]
]
; bug#42
[
b: #{0b}
b/1 == 11
]
; case sensitivity
; bug#1459
[lesser? #{0141} #{0161}]
; datatypes/bitset.r
[bitset? make bitset! "a"]
[not bitset? 1]
[bitset! = type? make bitset! "a"]
; minimum, literal representation
[bitset? #[bitset! #{}]]
; TS crash
[bitset? charset reduce [to-char "^(A0)"]]
; datatypes/block.r
[block? [1]]
[not block? 1]
[block! = type? [1]]
; minimum
[block? []]
; alternative literal representation
[[] == #[block! []]]
[[] == make block! 0]
[[] == to block! ""]
["[]" == mold []]
; implicit evaluation
[
a-block: [1 + 2]
same? :a-block do reduce [:a-block]
]
; indirect (word) implicit evaluation
[
a-block: [1 + 2]
same? :a-block do [a-block]
]
; indirect (path) implicit evaluation
[
a-block: [[1 + 2]]
same? first :a-block a-block/1
]
; explicit evaluation
[do [true]]
; datatypes/char.r
[char? #"a"]
[not char? 1]
[char! = type? #"a"]
[#"^@" = #"^(00)"]
[#"^A" = #"^(01)"]
[#"^B" = #"^(02)"]
[#"^C" = #"^(03)"]
[#"^D" = #"^(04)"]
[#"^E" = #"^(05)"]
[#"^F" = #"^(06)"]
[#"^G" = #"^(07)"]
[#"^H" = #"^(08)"]
[#"^I" = #"^(09)"]
[#"^J" = #"^(0A)"]
[#"^K" = #"^(0B)"]
[#"^L" = #"^(0C)"]
[#"^M" = #"^(0D)"]
[#"^N" = #"^(0E)"]
[#"^O" = #"^(0F)"]
[#"^P" = #"^(10)"]
[#"^Q" = #"^(11)"]
[#"^R" = #"^(12)"]
[#"^S" = #"^(13)"]
[#"^T" = #"^(14)"]
[#"^U" = #"^(15)"]
[#"^V" = #"^(16)"]
[#"^W" = #"^(17)"]
[#"^X" = #"^(18)"]
[#"^Y" = #"^(19)"]
[#"^Z" = #"^(1A)"]
[#"^[" = #"^(1B)"]
[#"^\" = #"^(1C)"]
[#"^]" = #"^(1D)"]
[#"^!" = #"^(1E)"]
[#"^_" = #"^(1F)"]
[#" " = #"^(20)"]
[#"!" = #"^(21)"]
[#"^"" = #"^(22)"]
[#"#" = #"^(23)"]
[#"$" = #"^(24)"]
[#"%" = #"^(25)"]
[#"&" = #"^(26)"]
[#"'" = #"^(27)"]
[#"(" = #"^(28)"]
[#")" = #"^(29)"]
[#"*" = #"^(2A)"]
[#"+" = #"^(2B)"]
[#"," = #"^(2C)"]
[#"-" = #"^(2D)"]
[#"." = #"^(2E)"]
[#"/" = #"^(2F)"]
[#"0" = #"^(30)"]
[#"1" = #"^(31)"]
[#"2" = #"^(32)"]
[#"3" = #"^(33)"]
[#"4" = #"^(34)"]
[#"5" = #"^(35)"]
[#"6" = #"^(36)"]
[#"7" = #"^(37)"]
[#"8" = #"^(38)"]
[#"9" = #"^(39)"]
[#":" = #"^(3A)"]
[#";" = #"^(3B)"]
[#"<" = #"^(3C)"]
[#"=" = #"^(3D)"]
[#">" = #"^(3E)"]
[#"?" = #"^(3F)"]
[#"@" = #"^(40)"]
[#"A" = #"^(41)"]
[#"B" = #"^(42)"]
[#"C" = #"^(43)"]
[#"D" = #"^(44)"]
[#"E" = #"^(45)"]
[#"F" = #"^(46)"]
[#"G" = #"^(47)"]
[#"H" = #"^(48)"]
[#"I" = #"^(49)"]
[#"J" = #"^(4A)"]
[#"K" = #"^(4B)"]
[#"L" = #"^(4C)"]
[#"M" = #"^(4D)"]
[#"N" = #"^(4E)"]
[#"O" = #"^(4F)"]
[#"P" = #"^(50)"]
[#"Q" = #"^(51)"]
[#"R" = #"^(52)"]
[#"S" = #"^(53)"]
[#"T" = #"^(54)"]
[#"U" = #"^(55)"]
[#"V" = #"^(56)"]
[#"W" = #"^(57)"]
[#"X" = #"^(58)"]
[#"Y" = #"^(59)"]
[#"Z" = #"^(5A)"]
[#"[" = #"^(5B)"]
[#"\" = #"^(5C)"]
[#"]" = #"^(5D)"]
[#"^^" = #"^(5E)"]
[#"_" = #"^(5F)"]
[#"`" = #"^(60)"]
[#"a" = #"^(61)"]
[#"b" = #"^(62)"]
[#"c" = #"^(63)"]
[#"d" = #"^(64)"]
[#"e" = #"^(65)"]
[#"f" = #"^(66)"]
[#"g" = #"^(67)"]
[#"h" = #"^(68)"]
[#"i" = #"^(69)"]
[#"j" = #"^(6A)"]
[#"k" = #"^(6B)"]
[#"l" = #"^(6C)"]
[#"m" = #"^(6D)"]
[#"n" = #"^(6E)"]
[#"o" = #"^(6F)"]
[#"p" = #"^(70)"]
[#"q" = #"^(71)"]
[#"r" = #"^(72)"]
[#"s" = #"^(73)"]
[#"t" = #"^(74)"]
[#"u" = #"^(75)"]
[#"v" = #"^(76)"]
[#"w" = #"^(77)"]
[#"x" = #"^(78)"]
[#"y" = #"^(79)"]
[#"z" = #"^(7A)"]
[#"{" = #"^(7B)"]
[#"|" = #"^(7C)"]
[#"}" = #"^(7D)"]
[#"~" = #"^(7E)"]
[#"^~" = #"^(7F)"]
; alternatives
[#"^(null)" = #"^(00)"]
[#"^(line)" = #"^(0A)"]
[#"^/" = #"^(0A)"]
[#"^(tab)" = #"^(09)"]
[#"^-" = #"^(09)"]
[#"^(page)" = #"^(0C)"]
[#"^(esc)" = #"^(1B)"]
[#"^(back)" = #"^(08)"]
[#"^(del)" = #"^(7f)"]
[#"^(00)" = make char! 0]
[#"^(00)" = to char! 0]
[{#"a"} = mold #"a"]
; minimum
[char? #"^(00)"]
; maximum
[char? #"^(ff)"]
; datatypes/closure.r
[closure? closure [] ["OK"]]
[not closure? 1]
#r3only
[closure! = type? closure [] ["OK"]]
; minimum
[closure? closure [] []]
; literal form
#r3only
[closure? first [#[closure! [[] []]]]]
; return-less return value tests
[
f: closure [] []
unset? f
]
[
f: closure [] [:abs]
:abs = f
]
[
a-value: #{}
f: closure [] [a-value]
same? a-value f
]
[
a-value: charset ""
f: closure [] [a-value]
same? a-value f
]
[
a-value: []
f: closure [] [a-value]
same? a-value f
]
[
a-value: none!
f: closure [] [a-value]
same? a-value f
]
[
f: closure [] [1/Jan/0000]
1/Jan/0000 = f
]
[
f: closure [] [0.0]
0.0 == f
]
[
f: closure [] [1.0]
1.0 == f
]
[
a-value: me@here.com
f: closure [] [a-value]
same? a-value f
]
#r3only
[
f: closure [] [try [1 / 0]]
error? f
]
[
a-value: %""
f: closure [] [a-value]
same? a-value f
]
[
a-value: does []
f: closure [] [:a-value]
same? :a-value f
]
[
a-value: first [:a]
f: closure [] [:a-value]
(same? :a-value f) and (:a-value == f)
]
[
f: closure [] [#"^@"]
#"^@" == f
]
[
a-value: make image! 0x0
f: closure [] [a-value]
same? a-value f
]
[
f: closure [] [0]
0 == f
]
[
f: closure [] [1]
1 == f
]
[
f: closure [] [#a]
#a == f
]
[
a-value: first ['a/b]
f: closure [] [:a-value]
:a-value == f
]
[
a-value: first ['a]
f: closure [] [:a-value]
:a-value == f
]
[
f: closure [] [true]
true = f
]
[
f: closure [] [false]
false = f
]
[
f: closure [] [$1]
$1 == f
]
[
f: closure [] [:type?]
same? :type? f
]
[
f: closure [] [#[none]]
none? f
]
[
a-value: make object! []
f: closure [] [:a-value]
same? :a-value f
]
[
a-value: first [()]
f: closure [] [:a-value]
same? :a-value f
]
[
f: closure [] [get '+]
same? get '+ f
]
[
f: closure [] [0x0]
0x0 == f
]
[
a-value: 'a/b
f: closure [] [:a-value]
:a-value == f
]
[
a-value: make port! http://
f: closure [] [:a-value]
port? f
]
[
f: closure [] [/a]
/a == f
]
[
a-value: first [a/b:]
f: closure [] [:a-value]
:a-value == f
]
[
a-value: first [a:]
f: closure [] [:a-value]
:a-value == all [:a-value]
]
[
a-value: ""
f: closure [] [:a-value]
same? :a-value f
]
[
a-value: make tag! ""
f: closure [] [:a-value]
same? :a-value f
]
[
f: closure [] [0:00]
0:00 == f
]
[
f: closure [] [0.0.0]
0.0.0 == f
]
[
f: closure [] [()]
unset? f
]
[
f: closure [] ['a]
'a == f
]
; basic test for recursive closure! invocation
[
i: 0
countdown: closure [n] [if n > 0 [++ i countdown n - 1]]
countdown 10
i = 10
]
; bug#21
[
c: closure [a] [return a]
1 == c 1
]
; two-function return test
[
g: closure [f [any-function!]] [f [return 1] 2]
1 = g :do
]
; BREAK out of a closure
[
1 = loop 1 [
f: closure [] [break/return 1]
f
2
]
]
; THROW out of a closure
[
1 = catch [
f: closure [] [throw 1]
f
2
]
]
; "error out" of a closure
[
error? try [
f: closure [] [1 / 0 2]
f
2
]
]
; BREAK out leaves a "running" closure in a "clean" state
[
1 = loop 1 [
f: closure [x] [
either x = 1 [
loop 1 [f 2]
x
] [break/return 1]
]
f 1
]
]
; THROW out leaves a "running" closure in a "clean" state
[
1 = catch [
f: closure [x] [
either x = 1 [
catch [f 2]
x
] [throw 1]
]
f 1
]
]
; "error out" leaves a "running" closure in a "clean" state
[
f: closure [x] [
either x = 1 [
error? try [f 2]
x = 1
] [1 / 0]
]
f 1
]
; bug#1659
; inline closure test
[
f: closure [] reduce [closure [] [true]]
f
]
; rebind test
[
a: closure [b] [does [b]]
b: a 1
c: a 2
all [
1 = b
2 = c
]
]
; recursive closure test
[
blk: copy []
c: closure [a] [
append blk 'a
if a <> 2 [
c 2
]
]
c 1
all [
[a a] = blk
[1 2] = reduce blk
]
]
; bug#447
[slf: 'self do closure [x] [same? slf 'self] 1]
; bug#1528
[closure? closure [self] []]
; bug#2048
#r3only
[
f: make closure! reduce [[x] f-body: [x + x]]
change f-body 'x
x: 1
3 == f 2
]
; datatypes/datatype.r
[not datatype? 1]
[datatype! = type? action!]
[datatype? action!]
[datatype? binary!]
[datatype? bitset!]
[datatype? block!]
[datatype? char!]
#r3
[datatype? closure!] ; closure! =? function! in R2/Forward, R2 2.7.7+
#r3only
[datatype? command!]
[datatype? datatype!]
[datatype? date!]
[datatype? decimal!]
[datatype? email!]
[datatype? error!]
[datatype? event!]
[datatype? file!]
[datatype? function!]
#r3
[datatype? get-path!] ; get-path! =? path! in R2/Forward, R2 2.7.7+
[datatype? get-word!]
#r3only
[datatype? gob!]
#r3only
[datatype? handle!]
#r2only
[datatype? hash!]
[datatype? image!]
[datatype? integer!]
[datatype? issue!]
[datatype? library!]
#r2only
[datatype? list!]
[datatype? lit-path!]
[datatype? lit-word!]
[datatype? logic!]
#r3
[datatype? map!] ; map! =? hash! in R2/Forward, R2 2.7.7+
#r3only
[datatype? module!]
[datatype? money!]
[datatype? native!]
[datatype? none!]
[datatype? object!]
[datatype? op!]
[datatype? pair!]
[datatype? paren!]
[datatype? path!]
#r3only
[datatype? percent!]
[datatype? port!]
[datatype? refinement!]
#r2only
[datatype? routine!]
[datatype? set-path!]
[datatype? set-word!]
[datatype? string!]
[datatype? struct!]
#r2only
[datatype? symbol!]
[datatype? tag!]
[datatype? time!]
[datatype? tuple!]
#r3
[datatype? typeset!] ; typeset! =? block! in R2/Forward, R2 2.7.7+
[datatype? unset!]
[datatype? url!]
#r3only
[datatype? vector!]
[datatype? word!]
; alternative literal representation
[datatype? #[datatype! action!]]
; datatypes/date.r
[date? 25/Sep/2006]
[not date? 1]
[date! = type? 25/Sep/2006]
; alternative formats
[25/Sep/2006 = 25/9/2006]
[25/Sep/2006 = 25-Sep-2006]
[25/Sep/2006 = 25-9-2006]
[25/Sep/2006 = make date! "25/Sep/2006"]
[25/Sep/2006 = to date! "25-Sep-2006"]
["25-Sep-2006" = mold 25/Sep/2006]
; minimum
[date? 1/Jan/0000]
; another minimum
[date? 1/Jan/0000/0:00]
; extreme behaviour
[
found? any [
error? try [date-d: 1/Jan/0000 - 1]
date-d = load mold date-d
]
]
[
found? any [
error? try [date-d: 31-Dec-16383 + 1]
date-d = load mold date-d
]
]
; datatypes/decimal.r
[decimal? 0.0]
[not decimal? 0]
[decimal! = type? 0.0]
[decimal? 1.0]
[decimal? -1.0]
[decimal? 1.5]
; LOAD decimal and to binary! tests
; 64-bit IEEE 754 maximum
#r3only
[equal? #{7FEFFFFFFFFFFFFF} to binary! 1.7976931348623157e308]
; Minimal positive normalized
#r3only
[equal? #{0010000000000000} to binary! 2.2250738585072014E-308]
; Maximal positive denormalized
#r3only
[equal? #{000FFFFFFFFFFFFF} to binary! 2.225073858507201E-308]
; Minimal positive denormalized
#r3only
[equal? #{0000000000000001} to binary! 4.9406564584124654E-324]
; zero
#r3only
[equal? #{0000000000000000} to binary! 0.0]
; negative zero
#r3only
[equal? #{8000000000000000} to binary! -0.0]
; Maximal negative denormalized
#r3only
[equal? #{8000000000000001} to binary! -4.9406564584124654E-324]
; Minimal negative denormalized
#r3only
[equal? #{800FFFFFFFFFFFFF} to binary! -2.225073858507201E-308]
; Maximal negative normalized
#r3only
[equal? #{8010000000000000} to binary! -2.2250738585072014E-308]
; 64-bit IEEE 754 minimum
#r3only
[equal? #{FFEFFFFFFFFFFFFF} to binary! -1.7976931348623157e308]
; bug#729
; MOLD decimal accuracy tests
#r3only
[
system/options/decimal-digits: 17
system/options/decimal-digits = 17
]
; 64-bit IEEE 754 maximum
[zero? 1.7976931348623157e308 - load mold 1.7976931348623157e308]
[same? 1.7976931348623157e308 load mold 1.7976931348623157e308]
; Minimal positive normalized
[zero? 2.2250738585072014E-308 - load mold 2.2250738585072014E-308]
[same? 2.2250738585072014E-308 load mold 2.2250738585072014E-308]
; Maximal positive denormalized
[zero? 2.225073858507201E-308 - load mold 2.225073858507201E-308]
[same? 2.225073858507201E-308 load mold 2.225073858507201E-308]
; Minimal positive denormalized
[zero? 4.9406564584124654E-324 - load mold 4.9406564584124654E-324]
[same? 4.9406564584124654E-324 load mold 4.9406564584124654E-324]
; Positive zero
[zero? 0.0 - load mold 0.0]
[same? 0.0 load mold 0.0]
; Negative zero
[zero? -0.0 - load mold -0.0]
[same? -0.0 load mold -0.0]
; Maximal negative denormalized
[zero? -4.9406564584124654E-324 - load mold -4.9406564584124654E-324]
[same? -4.9406564584124654E-324 load mold -4.9406564584124654E-324]
; Minimal negative denormalized
[zero? -2.225073858507201E-308 - load mold -2.225073858507201E-308]
[same? -2.225073858507201E-308 load mold -2.225073858507201E-308]
; Maximal negative normalized
[zero? -2.2250738585072014E-308 - load mold -2.2250738585072014E-308]
[same? -2.2250738585072014E-308 load mold -2.2250738585072014E-308]
; 64-bit IEEE 754 minimum
[zero? -1.7976931348623157E308 - load mold -1.7976931348623157e308]
[same? -1.7976931348623157E308 load mold -1.7976931348623157e308]
[zero? 0.10000000000000001 - load mold 0.10000000000000001]
[same? 0.10000000000000001 load mold 0.10000000000000001]
[zero? 0.29999999999999999 - load mold 0.29999999999999999]
[same? 0.29999999999999999 load mold 0.29999999999999999]
[zero? 0.30000000000000004 - load mold 0.30000000000000004]
[same? 0.30000000000000004 load mold 0.30000000000000004]
[zero? 9.9999999999999926e152 - load mold 9.9999999999999926e152]
[same? 9.9999999999999926e152 load mold 9.9999999999999926e152]
; bug#718
[
a: 9.9999999999999926e152 * 1e-138
zero? a - load mold a
]
; bug#897
; MOLD/ALL decimal accuracy tests
; 64-bit IEEE 754 maximum
[zero? 1.7976931348623157e308 - load mold/all 1.7976931348623157e308]
[same? 1.7976931348623157e308 load mold/all 1.7976931348623157e308]
; Minimal positive normalized
[zero? 2.2250738585072014E-308 - load mold/all 2.2250738585072014E-308]
[same? 2.2250738585072014E-308 load mold/all 2.2250738585072014E-308]
; Maximal positive denormalized
[zero? 2.225073858507201E-308 - load mold/all 2.225073858507201E-308]
[same? 2.225073858507201E-308 load mold/all 2.225073858507201E-308]
; Minimal positive denormalized
[zero? 4.9406564584124654E-324 - load mold/all 4.9406564584124654E-324]
[same? 4.9406564584124654E-324 load mold/all 4.9406564584124654E-324]
; Positive zero
[zero? 0.0 - load mold/all 0.0]
[same? 0.0 load mold/all 0.0]
; Negative zero
[zero? -0.0 - load mold/all -0.0]
[same? -0.0 load mold/all -0.0]
; Maximal negative denormalized
[zero? -4.9406564584124654E-324 - load mold/all -4.9406564584124654E-324]
[same? -4.9406564584124654E-324 load mold/all -4.9406564584124654E-324]
; Minimal negative denormalized
[zero? -2.225073858507201E-308 - load mold/all -2.225073858507201E-308]
[same? -2.225073858507201E-308 load mold/all -2.225073858507201E-308]
; Maximal negative normalized
[zero? -2.2250738585072014E-308 - load mold/all -2.2250738585072014E-308]
[same? -2.2250738585072014E-308 load mold/all -2.2250738585072014E-308]
; 64-bit IEEE 754 minimum
[zero? -1.7976931348623157E308 - load mold/all -1.7976931348623157e308]
[same? -1.7976931348623157E308 load mold/all -1.7976931348623157e308]
[zero? 0.10000000000000001 - load mold/all 0.10000000000000001]
[same? 0.10000000000000001 load mold/all 0.10000000000000001]
[zero? 0.29999999999999999 - load mold/all 0.29999999999999999]
[same? 0.29999999999999999 load mold/all 0.29999999999999999]
[zero? 0.30000000000000004 - load mold/all 0.30000000000000004]
[same? 0.30000000000000004 load mold/all 0.30000000000000004]
[zero? 9.9999999999999926e152 - load mold/all 9.9999999999999926e152]
[same? 9.9999999999999926e152 load mold/all 9.9999999999999926e152]
; LOAD decimal accuracy tests
[equal? to binary! 2.2250738585072004e-308 #{000FFFFFFFFFFFFE}]
[equal? to binary! 2.2250738585072005e-308 #{000FFFFFFFFFFFFE}]
[equal? to binary! 2.2250738585072006e-308 #{000FFFFFFFFFFFFE}]
[equal? to binary! 2.2250738585072007e-308 #{000FFFFFFFFFFFFF}]
[equal? to binary! 2.2250738585072008e-308 #{000FFFFFFFFFFFFF}]
[equal? to binary! 2.2250738585072009e-308 #{000FFFFFFFFFFFFF}]
[equal? to binary! 2.225073858507201e-308 #{000FFFFFFFFFFFFF}]
[equal? to binary! 2.2250738585072011e-308 #{000FFFFFFFFFFFFF}]
[equal? to binary! 2.2250738585072012e-308 #{0010000000000000}]
[equal? to binary! 2.2250738585072013e-308 #{0010000000000000}]
[equal? to binary! 2.2250738585072014e-308 #{0010000000000000}]
; bug#1753
[c: last mold/all 1e16 (#"0" <= c) and (#"9" >= c)]
; alternative form
[1.1 == 1,1]
[1.1 = make decimal! 1.1]
[1.1 = make decimal! "1.1"]
[1.1 = to decimal! 1.1]
[1.1 = to decimal! "1.1"]
[error? try [to decimal! "t"]]
; decimal! to binary! and binary! to decimal!
[equal? #{3ff0000000000000} to binary! 1.0]
[same? to decimal! #{3ff0000000000000} 1.0]
; bug#747
[equal? #{3FF0000000000009} to binary! to decimal! #{3FF0000000000009}]
; bug#2256
[
a: 0.1 + 0.1 + 0.1
b: 0.3
equal? (lesser? a b) or (equal? a b) lesser-or-equal? a b
]
; datatypes/email.r
[email? me@here.com]
[not email? 1]
[email! = type? me@here.com]
; "minimum"
[email? #[email! ""]]
[strict-equal? #[email! ""] make email! 0]
[strict-equal? #[email! ""] to email! ""]
[equal? mold/all #[email! ""] {#[email! ""]}]
[equal? mold/all #[email! "a"] {#[email! "a"]}]
; datatypes/error.r
[error? try [1 / 0]]
[not error? 1]
[error! = type? try [1 / 0]]
; error types
#r2only
[error? make error! [throw no-loop]]
#r2only
[error? make error! [throw no-function]]
#r2only
[error? make error! [throw no-catch]]
#r2only
[error? make error! [note no-load]]
#r2only
[error? make error! [note exited]]
#r2only
[error? make error! [syntax invalid]]
#r2only
[error? make error! [syntax missing]]
#r2only
[error? make error! [syntax header]]
#r2only
[error? make error! [script no-value]]
#r2only
[error? make error! [script need-value]]
#r2only
[error? make error! [script no-arg]]
#r2only
[error? make error! [script expect-arg]]
#r2only
[error? make error! [script expect-set]]
#r2only
[error? make error! [script invalid-arg]]
#r2only
[error? make error! [script invalid-op]]
#r2only
[error? make error! [script no-op-arg]]
#r2only
[error? make error! [script no-return]]
#r2only
[error? make error! [script not-defined]]
#r2only
[error? make error! [script no-refine]]
#r2only
[error? make error! [script invalid-path]]
#r2only
[error? make error! [script cannot-use]]
#r2only
[error? make error! [script already-used]]
#r2only
[error? make error! [script out-of-range]]
#r2only
[error? make error! [script past-end]]
#r2only
[error? make error! [script no-memory]]
#r2only
[error? make error! [script block-lines]]
#r2only
[error? make error! [script invalid-part]]
#r2only
[error? make error! [script wrong-denom]]
#r2only
[error? make error! [script else-gone]]
#r2only
[error? make error! [script bad-press]]
#r2only
[error? make error! [script bad-prompt]]
#r2only
[error? make error! [script bad-port-action]]
#r2only
[error? make error! [script needs]]
#r2only
[error? make error! [script locked-word]]
#r2only
[error? make error! [script too-many-refines]]
#r2only
[error? make error! [script dup-vars]]
#r2only
[error? make error! [script feature-na]]
#r2only
[error? make error! [script bad-bad]]
#r2only
[error? make error! [script limit-hit]]
#r2only
[error? make error! [script call-fail]]
#r2only
[error? make error! [script face-error]]
#r2only
[error? make error! [script face-reused]]
#r2only
[error? make error! [script bad-refine]]
#r2only
[error? make error! [math zero-divide]]
#r2only
[error? make error! [math overflow]]
#r2only
[error? make error! [math positive]]
#r2only
[error? make error! [access cannot-open]]
#r2only
[error? make error! [access not-open]]
#r2only
[error? make error! [access already-open]]
#r2only
[error? make error! [access already-closed]]
#r2only
[error? make error! [access read-error]]
#r2only
[error? make error! [access invalid-spec]]
#r2only
[error? make error! [access socket-open]]
#r2only
[error? make error! [access no-connect]]
#r2only
[error? make error! [access no-delete]]
#r2only
[error? make error! [access no-rename]]
#r2only
[error? make error! [access no-make-dir]]
#r2only
[error? make error! [access protocol]]
#r2only
[error? make error! [access timeout]]
#r2only
[error? make error! [access new-level]]
#r2only
[error? make error! [access security]]
#r2only
[error? make error! [access invalid-path]]
#r2only
[error? make error! [access bad-image]]
#r2only
[error? make error! [access would-block]]
#r2only
[error? make error! [access serial-timeout]]
#r2only
[error? make error! [access write-error]]
#r2only
[error? make error! [command fmt-too-short]]
#r2only
[error? make error! [command fmt-no-struct-size]]
#r2only
[error? make error! [command fmt-no-struct-align]]
#r2only
[error? make error! [command fmt-bad-word]]
#r2only
[error? make error! [command fmt-type-mismatch]]
#r2only
[error? make error! [command fmt-size-mismatch]]
#r2only
[error? make error! [command dll-arg-count]]
#r2only
[error? make error! [command empty-command]]
#r2only
[error? make error! [command db-not-open]]
#r2only
[error? make error! [command db-too-many]]
#r2only
[error? make error! [command cant-free]]
#r2only
[error? make error! [command nothing-to-free]]
#r2only
[error? make error! [command ssl-error]]
#r2only
[error? make error! [user message]]
#r2only
[error? make error! [internal bad-path]]
#r2only
[error? make error! [internal not-here]]
#r2only
[error? make error! [internal stack-overflow]]
#r2only
[error? make error! [internal globals-full]]
#r2only
[error? make error! [internal bad-internal]]
; error evaluation
#r3only
[error? do head insert copy [] try [1 / 0]]
; error that does not exist
#r3only
[try/except [make error! [type: 'script id: 'set-self]] [true]]
; throw errors cannot be made
#r3only
[try/except [make error! [type: 'throw id: 'break]] [true]]
#r3only
[try/except [make error! [type: 'throw id: 'return]] [true]]
#r3only
[try/except [make error! [type: 'throw id: 'throw]] [true]]
#r3only
[try/except [make error! [type: 'throw id: 'continue]] [true]]
#r3only
[try/except [make error! [type: 'throw id: 'halt]] [true]]
#r3only
[try/except [make error! [type: 'throw id: 'quit]] [true]]
; error types that should be predefined
#r3only
[error? make error! [type: 'note id: 'no-load]]
#r3only
[error? make error! [type: 'note id: 'exited]]
#r3only
[error? make error! [type: 'note id: 'deprecated]]
#r3only
[error? make error! [type: 'syntax id: 'invalid]]
#r3only
[error? make error! [type: 'syntax id: 'missing]]
#r3only
[error? make error! [type: 'syntax id: 'no-header]]
#r3only
[error? make error! [type: 'syntax id: 'bad-header]]
#r3only
[error? make error! [type: 'syntax id: 'bad-checksum]]
#r3only
[error? make error! [type: 'syntax id: 'malconstruct]]
#r3only
[error? make error! [type: 'syntax id: 'bad-char]]
#r3only
[error? make error! [type: 'syntax id: 'needs]]
#r3only
[error? make error! [type: 'script id: 'no-value]]
#r3only
[error? make error! [type: 'script id: 'need-value]]
#r3only
[error? make error! [type: 'script id: 'not-defined]]
#r3only
[error? make error! [type: 'script id: 'not-in-context]]
#r3only
[error? make error! [type: 'script id: 'no-arg]]
#r3only
[error? make error! [type: 'script id: 'expect-arg]]
#r3only
[error? make error! [type: 'script id: 'expect-val]]
#r3only
[error? make error! [type: 'script id: 'expect-type]]
#r3only
[error? make error! [type: 'script id: 'cannot-use]]
#r3only
[error? make error! [type: 'script id: 'invalid-arg]]
#r3only
[error? make error! [type: 'script id: 'invalid-type]]
#r3only
[error? make error! [type: 'script id: 'invalid-op]]
#r3only
[error? make error! [type: 'script id: 'no-op-arg]]
#r3only
[error? make error! [type: 'script id: 'invalid-data]]
#r3only
[error? make error! [type: 'script id: 'not-same-type]]
#r3only
[error? make error! [type: 'script id: 'not-related]]
#r3only
[error? make error! [type: 'script id: 'bad-func-def]]
#r3only
[error? make error! [type: 'script id: 'bad-func-arg]]
#r3only
[error? make error! [type: 'script id: 'no-refine]]
#r3only
[error? make error! [type: 'script id: 'bad-refines]]
#r3only
[error? make error! [type: 'script id: 'bad-refine]]
#r3only
[error? make error! [type: 'script id: 'invalid-path]]
#r3only
[error? make error! [type: 'script id: 'bad-path-type]]
#r3only
[error? make error! [type: 'script id: 'bad-path-set]]
#r3only
[error? make error! [type: 'script id: 'bad-field-set]]
#r3only
[error? make error! [type: 'script id: 'dup-vars]]
#r3only
[error? make error! [type: 'script id: 'past-end]]
#r3only
[error? make error! [type: 'script id: 'missing-arg]]
#r3only
[error? make error! [type: 'script id: 'out-of-range]]
#r3only
[error? make error! [type: 'script id: 'too-short]]
#r3only
[error? make error! [type: 'script id: 'too-long]]
#r3only
[error? make error! [type: 'script id: 'invalid-chars]]
#r3only
[error? make error! [type: 'script id: 'invalid-compare]]
#r3only
[error? make error! [type: 'script id: 'assert-failed]]
#r3only
[error? make error! [type: 'script id: 'wrong-type]]
#r3only
[error? make error! [type: 'script id: 'invalid-part]]
#r3only
[error? make error! [type: 'script id: 'type-limit]]
#r3only
[error? make error! [type: 'script id: 'size-limit]]
#r3only
[error? make error! [type: 'script id: 'no-return]]
#r3only
[error? make error! [type: 'script id: 'block-lines]]
#r3only
[error? make error! [type: 'script id: 'throw-usage]]
#r3only
[error? make error! [type: 'script id: 'locked-word]]
#r3only
[error? make error! [type: 'script id: 'protected]]
#r3only
[error? make error! [type: 'script id: 'hidden]]
#r3only
[error? make error! [type: 'script id: 'self-protected]]
#r3only
[error? make error! [type: 'script id: 'bad-bad]]
#r3only
[error? make error! [type: 'script id: 'bad-make-arg]]
#r3only
[error? make error! [type: 'script id: 'bad-decode]]
#r3only
[error? make error! [type: 'script id: 'already-used]]
#r3only
[error? make error! [type: 'script id: 'wrong-denom]]
#r3only
[error? make error! [type: 'script id: 'bad-press]]
#r3only
[error? make error! [type: 'script id: 'dialect]]
#r3only
[error? make error! [type: 'script id: 'bad-command]]
#r3only
[error? make error! [type: 'script id: 'parse-rule]]
#r3only
[error? make error! [type: 'script id: 'parse-end]]
#r3only
[error? make error! [type: 'script id: 'parse-variable]]
#r3only
[error? make error! [type: 'script id: 'parse-command]]
#r3only
[error? make error! [type: 'script id: 'parse-series]]
#r3only
[error? make error! [type: 'math id: 'zero-divide]]
#r3only
[error? make error! [type: 'math id: 'overflow]]
#r3only
[error? make error! [type: 'math id: 'positive]]
#r3only
[error? make error! [type: 'access id: 'cannot-open]]
#r3only
[error? make error! [type: 'access id: 'not-open]]
#r3only
[error? make error! [type: 'access id: 'already-open]]
#r3only
[error? make error! [type: 'access id: 'no-connect]]
#r3only
[error? make error! [type: 'access id: 'not-connected]]
#r3only
[error? make error! [type: 'access id: 'no-script]]
#r3only
[error? make error! [type: 'access id: 'no-scheme-name]]
#r3only
[error? make error! [type: 'access id: 'no-scheme]]
#r3only
[error? make error! [type: 'access id: 'invalid-spec]]
#r3only
[error? make error! [type: 'access id: 'invalid-port]]
#r3only
[error? make error! [type: 'access id: 'invalid-actor]]
#r3only
[error? make error! [type: 'access id: 'invalid-port-arg]]
#r3only
[error? make error! [type: 'access id: 'no-port-action]]
#r3only
[error? make error! [type: 'access id: 'protocol]]
#r3only
[error? make error! [type: 'access id: 'invalid-check]]
#r3only
[error? make error! [type: 'access id: 'write-error]]
#r3only
[error? make error! [type: 'access id: 'read-error]]
#r3only
[error? make error! [type: 'access id: 'read-only]]
#r3only
[error? make error! [type: 'access id: 'no-buffer]]
#r3only
[error? make error! [type: 'access id: 'timeout]]
#r3only
[error? make error! [type: 'access id: 'no-create]]
#r3only
[error? make error! [type: 'access id: 'no-delete]]
#r3only
[error? make error! [type: 'access id: 'no-rename]]
#r3only
[error? make error! [type: 'access id: 'bad-file-path]]
#r3only
[error? make error! [type: 'access id: 'bad-file-mode]]
#r3only
[error? make error! [type: 'access id: 'security]]
#r3only
[error? make error! [type: 'access id: 'security-level]]
#r3only
[error? make error! [type: 'access id: 'security-error]]
#r3only
[error? make error! [type: 'access id: 'no-codec]]
#r3only
[error? make error! [type: 'access id: 'bad-media]]
#r3only
[error? make error! [type: 'access id: 'no-extension]]
#r3only
[error? make error! [type: 'access id: 'bad-extension]]
#r3only
[error? make error! [type: 'access id: 'extension-init]]
#r3only
[error? make error! [type: 'access id: 'call-fail]]
#r3only
[error? make error! [type: 'user id: 'message]]
#r3only
[error? make error! [type: 'internal id: 'bad-path]]
#r3only
[error? make error! [type: 'internal id: 'not-here]]
#r3only
[error? make error! [type: 'internal id: 'no-memory]]
#r3only
[error? make error! [type: 'internal id: 'stack-overflow]]
#r3only
[error? make error! [type: 'internal id: 'globals-full]]
#r3only
[error? make error! [type: 'internal id: 'max-natives]]
#r3only
[error? make error! [type: 'internal id: 'bad-series]]
#r3only
[error? make error! [type: 'internal id: 'limit-hit]]
#r3only
[error? make error! [type: 'internal id: 'bad-sys-func]]
#r3only
[error? make error! [type: 'internal id: 'feature-na]]
#r3only
[error? make error! [type: 'internal id: 'not-done]]
; triggered errors should not be assignable
[a: 1 error? try [a: 1 / 0] :a =? 1]
[a: 1 error? try [set 'a 1 / 0] :a =? 1]
[a: 1 error? try [set/any 'a 1 / 0] :a =? 1]
; bug#2190
[catch/quit [attempt [catch/quit [1 / 0]] quit/return true]]
; bug#2190
[error? try [catch/quit [attempt [quit]] print x]]
; datatypes/event.r
[not event? 1]
; datatypes/file.r
[file? %myscript.r]
[not file? 1]
[file! = type? %myscript.r]
; minimum
[file? %""]
[%"" == #[file! ""]]
[%"" == make file! 0]
[%"" == to file! ""]
["%%2520" = mold to file! "%20"]
; bug#1241
[file? %"/c/Program Files (x86)"]
; datatypes/function.r
[function? does ["OK"]]
[not function? 1]
[function! = type? does ["OK"]]
; minimum
[function? does []]
; literal form
#r2only
[function? first [#[function! [] []]]]
#r3only
[function? first [#[function! [[] []]]]]
; return-less return value tests
[
f: does []
unset? f
]
[
f: does [:abs]
:abs = f
]
[
a-value: #{}
f: does [a-value]
same? a-value f
]
[
a-value: charset ""
f: does [a-value]
same? a-value f
]
[
a-value: []
f: does [a-value]
same? a-value f
]
[
a-value: none!
f: does [a-value]
same? a-value f
]
[
f: does [1/Jan/0000]
1/Jan/0000 = f
]
[
f: does [0.0]
0.0 == f
]
[
f: does [1.0]
1.0 == f
]
[
a-value: me@here.com
f: does [a-value]
same? a-value f
]
#r3only
[
f: does [try [1 / 0]]
error? f
]
[
a-value: %""
f: does [a-value]
same? a-value f
]
[
a-value: does []
f: does [:a-value]
same? :a-value f
]
[
a-value: first [:a]
f: does [:a-value]
(same? :a-value f) and (:a-value == f)
]
[
f: does [#"^@"]
#"^@" == f
]
[
a-value: make image! 0x0
f: does [a-value]
same? a-value f
]
[
f: does [0]
0 == f
]
[
f: does [1]
1 == f
]
[
f: does [#a]
#a == f
]
[
a-value: first ['a/b]
f: does [:a-value]
:a-value == f
]
[
a-value: first ['a]
f: does [:a-value]
:a-value == f
]
[
f: does [true]
true = f
]
[
f: does [false]
false = f
]
[
f: does [$1]
$1 == f
]
[
f: does [:type?]
same? :type? f
]
[
f: does [#[none]]
none? f
]
[
a-value: make object! []
f: does [:a-value]
same? :a-value f
]
[
a-value: first [()]
f: does [:a-value]
same? :a-value f
]
[
f: does [get '+]
same? get '+ f
]
[
f: does [0x0]
0x0 == f
]
[
a-value: 'a/b
f: does [:a-value]
:a-value == f
]
[
a-value: make port! http://
f: does [:a-value]
port? f
]
[
f: does [/a]
/a == f
]
[
a-value: first [a/b:]
f: does [:a-value]
:a-value == f
]
[
a-value: first [a:]
f: does [:a-value]
:a-value == all [:a-value]
]
[
a-value: ""
f: does [:a-value]
same? :a-value f
]
[
a-value: make tag! ""
f: does [:a-value]
same? :a-value f
]
[
f: does [0:00]
0:00 == f
]
[
f: does [0.0.0]
0.0.0 == f
]
[
f: does [()]
unset? f
]
[
f: does ['a]
'a == f
]
; two-function return tests
[
g: func [f [any-function!]] [f [return 1] 2]
1 = g :do
]
; BREAK out of a function
[
1 = loop 1 [
f: does [break/return 1]
f
2
]
]
; THROW out of a function
[
1 = catch [
f: does [throw 1]
f
2
]
]
; "error out" of a function
[
error? try [
f: does [1 / 0 2]
f
2
]
]
; BREAK out leaves a "running" function in a "clean" state
[
1 = loop 1 [
f: func [x] [
either x = 1 [
loop 1 [f 2]
x
] [break/return 1]
]
f 1
]
]
; THROW out leaves a "running" function in a "clean" state
[
1 = catch [
f: func [x] [
either x = 1 [
catch [f 2]
x
] [throw 1]
]
f 1
]
]
; "error out" leaves a "running" function in a "clean" state
[
f: func [x] [
either x = 1 [
error? try [f 2]
x = 1
] [1 / 0]
]
f 1
]
; Argument passing of "get arguments" ("get-args")
[gf: func [:x] [:x] 10 == gf 10]
#r3only
[gf: func [:x] [:x] 'a == gf a]
[gf: func [:x] [:x] (quote 'a) == gf 'a]
[gf: func [:x] [:x] (quote :a) == gf :a]
[gf: func [:x] [:x] (quote a:) == gf a:]
[gf: func [:x] [:x] (quote (10 + 20)) == gf (10 + 20)]
[gf: func [:x] [:x] o: context [f: 10] (quote :o/f) == gf :o/f]
#r2only
[gf: func [:x] [:x] a: 10 10 == gf a]
; Argument passing of "literal arguments" ("lit-args")
[lf: func ['x] [:x] 10 == lf 10]
[lf: func ['x] [:x] 'a == lf a]
[lf: func ['x] [:x] (quote 'a) == lf 'a]
[lf: func ['x] [:x] a: 10 10 == lf :a]
[lf: func ['x] [:x] (quote a:) == lf a:]
#r3only
[lf: func ['x] [:x] 30 == lf (10 + 20)]
#r3only
[lf: func ['x] [:x] o: context [f: 10] 10 == lf :o/f]
#r2only
[lf: func ['x] [:x] (quote (10 + 20)) == lf (10 + 20)]
#r2only
[lf: func ['x] [:x] (quote :o/f) == lf :o/f]
; basic test for recursive function! invocation
[i: 0 countdown: func [n] [if n > 0 [++ i countdown n - 1]] countdown 10 i = 10]
; a function-local word that escapes the function's dynamic extent still works
; when re-entering the dynamic extent of the same function later.
[
f: func [code value] [either none? code ['value] [do code]]
f-value: f none none
42 == f compose [2 * (f-value)] 21 ; re-entering same function
]
[
f: func [code value] [either none? code ['value] [do code]]
g: func [code value] [either none? code ['value] [do code]]
f-value: f none none
error? try [g compose [2 * (f-value)] 21] ; re-entering different function
]
; bug#19
[
f: func [/r x] [x]
2 == f/r/r 1 2
]
; bug#27
#r3only
[error? try [(type?) 1]]
; bug#1659
; inline function test
[
f: does reduce [does [true]]
f
]
; no-rebind test
[
a: func [b] [a: none c: b]
f: func [d] [a [d] do c]
all [
1 = f 1
2 = f 2
]
]
; bug#1528
[function? func [self] []]
; bug#1756
#r3only
[do does [reduce reduce [:self] true]]
; bug#2025
#r3only
[
body: [x + y]
f: make function! reduce [[x] body]
g: make function! reduce [[y] body]
error? try [f 1]
]
; bug#2044
[
o: make object! [f: func [x] ['x]]
p: make o []
not same? o/f 1 p/f 1
]
; datatypes/get-path.r
; minimum
; bug#1947
; empty get-path test
#r3only
[get-path? load "#[get-path! []]"]
#r3only
[get-path? load "#[get-path! [a]]"]
#r3only
[equal? mold/all load "#[get-path! []]" "#[get-path! []]"]
#r3only
[equal? mold/all load "#[get-path! [a]]" "#[get-path! [a]]"]
#r3only
[
all [
get-path? a: load "#[get-path! [a b c] 2]"
2 == index? a
]
]
; datatypes/get-word.r
[get-word? first [:a]]
[not get-word? 1]
[get-word! = type? first [:a]]
#r2only
[
; context-less get-word
e: disarm try [do to block! ":a"]
e/id = 'not-defined
]
#r3only
[
; context-less get-word
e: try [do to block! ":a"]
e/id = 'not-defined
]
; behaviour for REBOL datatypes; unset
#r2only
[
unset 'a
e: disarm try [:a]
e/id = 'no-value
]
#r3only
[
unset 'a
unset? :a
]
; bug#1477
[get-word? first [:/]]
[get-word? first [://]]
[get-word? first [:///]]
; datatypes/gob.r
; minimum
#r3only
[gob? make gob! []]
#r3only
[gob! = type? make gob! []]
; bug#62
#r3only
[
g: make gob! []
1x1 == g/offset: 1x1
]
; bug#1969
#r3only
[
g1: make gob! []
g2: make gob! []
insert g1 g2
same? g1 g2/parent
do "g1: none"
do "recycle"
g3: make gob! []
insert g2/parent g3
true
]
; bug#1989
#r3only
[
loop 30000000 [make gob! []]
true
]
#r3only
[
main: make gob! []
foreach i [31 325 1] [
clear main
recycle
loop i [
append main make gob! []
]
]
true
]
; datatypes/hash.r
#r2only
; minimum
[hash? make hash! []]
#r2only
[not hash? 1]
#r2only
[hash! = type? make hash! []]
; datatypes/image.r
[image? make image! 100x100]
[not image? 1]
[image! = type? make image! 0x0]
; minimum
[image? #[image! 0x0 #{}]]
[equal? load mold/all #[image! 0x0 #{}] #[image! 0x0 #{}]]
; default colours
#r2only
[
a-value: #[image! 1x1 #{}]
equal? pick a-value 0x0 0.0.0.0
]
#r3only
[
a-value: #[image! 1x1 #{}]
equal? pick a-value 0x0 0.0.0.255
]
; datatypes/integer.r
[integer? 0]
; bug#33
[integer? -0]
[not integer? 1.1]
[integer! = type? 0]
[integer? 1]
[integer? -1]
[integer? 2]
; 32-bit minimum for two's complement representation
[integer? -2147483648]
; 32-bit maximum
[integer? 2147483647]
; 64-bit minimum for two's complement representation
#64bit
[integer? -9223372036854775808]
; 64-bit maximum
#64bit
[integer? 9223372036854775807]
[0 == make integer! 0]
[0 == make integer! "0"]
[0 == to integer! 0]
; 32-bit minimum for two's complement representation
[-2147483648 == to integer! -2147483648.0]
; 32-bit minimum for two's complement representation
[-2147483648 == to integer! -2147483648.9]
; 32-bit maximum
[2147483647 == to integer! 2147483647.9]
#32bit
[error? try [to integer! -2147483649.0]]
#32bit
[error? try [to integer! 2147483648.0]]
; bug#921
[error? try [to integer! 9.2233720368547765e18]]
[error? try [to integer! -9.2233720368547779e18]]
[0 == to integer! "0"]
[error? try [to integer! false]]
[error? try [to integer! true]]
[0 == to integer! #"^@"]
[1 == to integer! #"^a"]
[0 == to integer! #0]
[1 == to integer! #1]
[0 == to integer! #{00}]
[1 == to integer! #{01}]
; -1 for 32-bit two's complement representation
#32bit
[-1 == to integer! #{ffffffff}]
; -1 for 64-bit two's complement representation
#64bit
[-1 == to integer! #{ffffffffffffffff}]
#64bit
[302961000000 == to integer! "3.02961E+11"]
[error? try [to integer! "t"]]
["0" = mold 0]
["1" = mold 1]
["-1" = mold -1]
; datatypes/issue.r
[issue? #aa]
[not issue? 1]
[issue! = type? #aa]
; minimum
#r2only
[issue? #]
#r2only
[# == #[issue! ""]]
#r2only
[# == make issue! 0]
#r2only
[# == to issue! ""]
[issue? #a]
; datatypes/library.r
[
success: library? a-library: load/library case [
; this needs to be system-specific
system/version/4 = 2 [%libc.dylib] ; OSX
system/version/4 = 3 [%kernel32.dll] ; Windows
all [system/version/4 = 4 system/version/5 = 2] [%/lib/libc.so.6] ; Linux libc6
system/version/4 = 4 [%libc.so] ; Linux
system/version/4 = 7 [%libc.so] ; FreeBSD
system/version/4 = 8 [%libc.so] ; NetBSD
system/version/4 = 9 [%libc.so] ; OpenBSD
system/version/4 = 10 [%libc.so] ; Solaris
]
free a-library
success
]
; datatypes/list.r
#r2only
[list? make list! []]
#r2only
[not list? 1]
#r2only
[list! = type? make list! []]
; datatypes/lit-path.r
[lit-path? first ['a/b]]
[not lit-path? 1]
[lit-path! = type? first ['a/b]]
; minimum
; bug#1947
[lit-path? load "#[lit-path! []]"]
[lit-path? load "#[lit-path! [a]]"]
[equal? mold/all load "#[lit-path! []]" "#[lit-path! []]"]
[equal? mold/all load "#[lit-path! [a]]" "#[lit-path! [a]]"]
[
all [
lit-path? a: load "#[lit-path! [a b c] 2]"
2 == index? a
]
]
; lit-paths are active
[
a-value: first ['a/b]
strict-equal? to path! :a-value do reduce [:a-value]
]
; datatypes/lit-word.r
[lit-word? first ['a]]
[not lit-word? 1]
[lit-word! = type? first ['a]]
; lit-words are active
[
a-value: first ['a]
strict-equal? to word! :a-value do reduce [:a-value]
]
; bug#1477
[word? '/]
[word? '//]
[word? '///]
; bug#1342
[word? '<]
[word? '>]
[word? '<=]
[word? '>=]
[word? '<>]
; datatypes/logic.r
[logic? true]
[logic? false]
[not logic? 1]
[logic! = type? true]
[logic! = type? false]
[true = #[true]]
[false = #[false]]
[on = true]
[off = false]
[yes = true]
[no = false]
[false = make logic! 0]
[true = make logic! 1]
[true = to logic! 0]
[true = to logic! 1]
[false = to logic! none]
[true = to logic! "f"]
["true" = mold true]
["false" = mold false]
; datatypes/map.r
; map! =? hash! in R2/Forward, R2 2.7.7+
#r3
[empty? make map! []]
#r3
[empty? make map! 4]
#r3only
; The length of a map is the number of key/value pairs it holds.
[2 == length? make map! [a 1 b 2]] ; 4 in R2, R2/Forward
#r3
[m: make map! [a 1 b 2] 1 == m/a]
#r3
[m: make map! [a 1 b 2] 2 == m/b]
#r3only
[m: make map! [a 1 b 2] none? m/c]
#r3only
[m: make map! [a 1 b 2] m/c: 3 3 == m/c]
; Maps contain key/value pairs and must be created from blocks of even length.
#r3only
[error? try [make map! [1]]]
#r3
[empty? clear make map! [a 1 b 2]]
; bug#1930: Lookup crashes on empty hashed map.
#r3only
[m: make map! 8 clear m none? m/a]
; append to a map string key
#r3only
[
res: true
b: copy []
k: copy "key"
append b k
append b copy "value"
m: make map! b
if "value" <> select m "key" [res: false]
append k "chain"
if none <> select m "keychain" [res: false]
if "value" <> select m "key" [res: false]
res
]
; datatypes/module.r
#r3only
[module? make module! [[] []]]
#r3only
[not module? 1]
#r3only
[module! = type? make module! [[] []]]
#r3only
[
a-module: make module! [
[]
[
; 'var will be in the module
var: 1
]
]
var: 2
1 == a-module/var
]
; import test
#r3only
[
a-module: make module! [
[
exports: [var]
]
[
var: 2
]
]
import a-module
2 == var
]
; import test
#r3only
[
var: 1
a-module: make module! [
[
exports: [var]
]
[
var: 2
]
]
import a-module
1 == var
]
; datatypes/money.r
[money? $0.0]
[not money? 0]
[money! = type? $0.0]
[money? $1.0]
[money? -$1.0]
[money? $1.5]
[money? USD$1]
[money? CZK$1]
; moldable maximum for R2
[money? $999999999999999.87]
; moldable minimum for R2
[money? -$999999999999999.87]
; check, whether these are moldable
[
x: $999999999999999
found? any [
error? try [x: x + $1]
not error? try [mold x]
]
]
[
x: -$999999999999999
found? any [
error? try [x: x - $1]
not error? try [mold x]
]
]
; alternative form
[$1.1 == $1,1]
[
found? any [
error? try [x: $1234567890123456]
not error? try [mold x]
]
]
[$11 = make money! 11]
[$1.1 = make money! "1.1"]
; bug#4
[$11 = to money! 11]
[$1.1 = to money! "1.1"]
["$1.10" = mold $1.10]
["-$1.10" = mold -$1.10]
#r3only
["$0" = mold $0]
; equality
[$1 = $1.0000000000000000000000000]
[not $1 = $2]
#r3only
; maximum for R3
[equal? $99999999999999999999999999e127 $99999999999999999999999999e127]
#r3only
; minimum for R3
[equal? -$99999999999999999999999999e127 -$99999999999999999999999999e127]
#r3only
[not $0 = $1e-128]
#r3only
[not $0 = -$1e-128]
; inequality
[not $1 <> $1]
[$1 <= $2]
[not $2 <= $1]
#r3only
[not zero? $1e-128]
#r3only
[not zero? -$1e-128]
; positive? tests
[not positive? negate $0]
#r3only
[positive? $1e-128]
#r3only
[not positive? -$1e-128]
[not negative? negate $0]
#r3only
[not negative? $1e-128]
#r3only
[negative? -$1e-128]
; same? tests
[same? $0 $0]
[same? $0 negate $0]
[same? $1 $1]
#r3only
[not same? $1 $1.0]
#r3only
["$1.0000000000000000000000000" = mold $2.0000000000000000000000000 - $1]
#r3only
["$1" = mold $2 - $1]
#r3only
["$1" = mold $1 * $1]
#r3only
["$4" = mold $2 * $2]
#r3only
["$1.0000000000000000000000000" = mold $1 * $1.0000000000000000000000000]
#r3only
["$1.0000000000000000000000000" = mold $1.0000000000000000000000000 * $1.0000000000000000000000000]
; division uses "full precision"
#r3only
["$1.0000000000000000000000000" = mold $1 / $1]
#r3only
["$1.0000000000000000000000000" = mold $1 / $1.0]
#r3only
["$1.0000000000000000000000000" = mold $1 / $1.000]
#r3only
["$1.0000000000000000000000000" = mold $1 / $1.000000]
#r3only
["$1.0000000000000000000000000" = mold $1 / $1.000000000]
#r3only
["$1.0000000000000000000000000" = mold $1 / $1.000000000000]
#r3only
["$1.0000000000000000000000000" = mold $1 / $1.0000000000000000000000000]
#r3only
["$0.10000000000000000000000000" = mold $1 / $10]
#r3only
["$0.33333333333333333333333333" = mold $1 / $3]
#r3only
["$0.66666666666666666666666667" = mold $2 / $3]
; conversion to integer
#r3only
[1 = to integer! $1]
#r3only
#64bit
[-9223372036854775808 == to integer! -$9223372036854775808.99]
#r3only
#64bit
[9223372036854775807 == to integer! $9223372036854775807.99]
; conversion to decimal
#r3only
[1.0 = to decimal! $1]
#r3only
[zero? 0.3 - to decimal! $0.3]
#r3only
[zero? 0.1 - to decimal! $0.1]
#r3only
[
x: 9.9999999999999981e152
zero? x - to decimal! to money! x
]
#r3only
[
x: -9.9999999999999981e152
zero? x - to decimal! to money! x
]
#r3only
[
x: 9.9999999999999926E152
zero? x - to decimal! to money! x
]
#r3only
[
x: -9.9999999999999926E152
zero? x - to decimal! to money! x
]
#r3only
[
x: 9.9999999999999293E152
zero? x - to decimal! to money! x
]
#r3only
[
x: -9.9999999999999293E152
zero? x - to decimal! to money! x
]
#r3only
[
x: to decimal! $1e-128
zero? x - to decimal! to money! x
]
#r3only
[
x: to decimal! -$1e-128
zero? x - to decimal! to money! x
]
#r3only
[
x: 9.2233720368547758E18
zero? x - to decimal! to money! x
]
#r3only
[
x: -9.2233720368547758E18
zero? x - to decimal! to money! x
]
#r3only
[
x: 9.2233720368547748E18
zero? x - to decimal! to money! x
]
#r3only
[
x: -9.2233720368547748E18
zero? x - to decimal! to money! x
]
#r3only
[
x: 9.2233720368547779E18
zero? x - to decimal! to money! x
]
#r3only
[
x: -9.2233720368547779E18
zero? x - to decimal! to money! x
]
; datatypes/native.r
[native? :type?]
[not native? 1]
[native! = type? :type?]
; bug#1659
; natives are active
[same? none! do reduce [:type? make none! none]]
; datatypes/none.r
[none? none]
[not none? 1]
[none! = type? none]
; literal form
[none = #[none]]
; bug#845
[none = #[none!]]
#r3only
[none = #]
[none = make none! none]
[none = to none! none]
[none = to none! 1]
["none" = mold none]
; bug#1666
; bug#1650
[
f: does [#]
# == f
]
; datatypes/object.r
[object? make object! [x: 1]]
[not object? 1]
[object! = type? make object! [x: 1]]
; minimum
[object? make object! []]
; literal form
[object? #[object! []]]
; local words
[
x: 1
make object! [x: 2]
x = 1
]
; BREAK out of make object!
; bug#846
[
1 = loop 1 [
make object! [break/return 1]
2
]
]
; THROW out of make object!
; bug#847
[
1 = catch [
make object! [throw 1]
2
]
]
; "error out" of make object!
[
error? try [
make object! [1 / 0]
2
]
]
; RETURN out of make object!
; bug#848
[
f: func [] [
make object! [return 1]
2
]
1 = f
]
; object cloning
; bug#2045
[
a: 1
f: func [] [a]
g: :f
o: make object! [a: 2 g: :f]
p: make o [a: 3]
1 == p/g
]
; object cloning
; bug#2045
[
a: 1
b: [a]
c: b
o: make object! [a: 2 c: b]
p: make o [a: 3]
1 == do p/c
]
; object cloning
; bug#2050
[
o: make object! [n: 'o b: reduce [func [] [n]]]
p: make o [n: 'p]
o/b/1 = 'o
]
; multiple inheritance
; bug#1863
[
o1: make object! [a: 1 f: does [a]]
o2: make object! [a: 2]
o3: make o1 o2
2 == o3/f
]
; object cloning
; bug#2049
[
o: make object! [n: 'o f: closure [] [n]]
p: make o [n: 'p]
'p = p/f
]
; appending to objects
; bug#1979
#r3only
[
o: make object! []
append o [b: 1 b: 2]
1 == length? words-of o
]
#r3only
[
o: make object! [b: 0]
append o [b: 1 b: 2]
1 == length? words-of o
]
#r3only
[
o: make object! []
c: "c"
append o compose [b: "b" b: (c)]
same? c o/b
]
#r3only
[
o: make object! [b: "a"]
c: "c"
append o compose [b: "b" b: (c)]
same? c o/b
]
#r3only
[
o: make object! []
error? try [append o 'self]
]
#r3only
[
o: make object! []
error? try [append o [self: 1]]
]
; bug#2076
#r3only
[
o: bound? use [x] ['x]
2 == length? words-of append o 'self
]
; bug#2076
#r3only
[
o: bound? use [x] ['x]
2 == length? words-of append o [self: 1]
]
; datatypes/op.r
[op? get '+]
[not op? 1]
[op! = type? get '+]
#r2only
[3 == do reduce [get '+ 1 2]]
#r3only
[error? try [do reduce [get '+ 1 2]]]
; bug#1934
#r3only
[3 = do reduce [1 :+ 2]]
; datatypes/pair.r
[pair? 1x2]
[not pair? 1]
[pair! = type? 1x2]
[1x1 = make pair! 1]
[1x2 = make pair! [1 2]]
[1x1 = to pair! 1]
; bug#17
[error? try [to pair! [0.4]]]
[1x2 = to pair! [1 2]]
["1x1" = mold 1x1]
; minimum
[pair? -2147483648x-2147483648]
; maximum
[pair? 2147483647x2147483647]
; datatypes/paren.r
[paren? first [(1 + 1)]]
[not paren? 1]
; minimum
[paren! = type? first [()]]
; alternative literal form
[strict-equal? first [()] first [#[paren! []]]]
[strict-equal? first [()] make paren! 0]
[strict-equal? first [()] to paren! []]
["()" == mold first [()]]
; parens are active
[
a-value: first [(1)]
1 == do reduce [:a-value]
]
; finite recursion
[
num1: 4
num2: 1
fact: to paren! [either num1 = 1 [num2] [num2: num1 * num2 num1: num1 - 1]]
insert/only tail last fact fact
24 = do fact
]
; bug#1665
; infinite recursion
[
fact: to paren! []
insert/only fact fact
error? try [do fact]
]
; datatypes/path.r
[path? 'a/b]
['a/b == first [a/b]]
[not path? 1]
[path! = type? 'a/b]
; the minimum
; bug#1947
[path? load "#[path! []]"]
[path? load "#[path! [a]]"]
[equal? mold/all load "#[path! []]" "#[path! []]"]
[equal? mold/all load "#[path! [a]]" "#[path! [a]]"]
[
all [
path? a: load "#[path! [a b c] 2]"
2 == index? a
]
]
["a/b" = mold 'a/b]
[
a-word: 1
data: #{0201}
2 = data/:a-word
]
[
blk: reduce [:abs 2]
2 == blk/:abs
]
[
blk: [#{} 2]
2 == blk/#{}
]
[
blk: reduce [charset "a" 3]
3 == do reduce [to path! reduce ['blk charset "a"]]
]
[
blk: [[] 3]
3 == blk/#[block! []]
]
[
blk: [#[none] 3]
3 == do [blk/#[none]]
]
[
blk: [none 3]
3 == do [blk/none]
]
[
a-value: 1/Jan/0000
0 == a-value/1
]
[
a-value: me@here.com
#"m" == a-value/1
]
#r3only
[
a-value: make error! ""
a-value/type = 'user
]
[
a-value: func [/local a] [a]
1 == a-value/local 1
]
#r2only
[
a-value: make image! 1x1
0.0.0.0 == a-value/1
]
#r3only
[
a-value: make image! 1x1
0.0.0.255 == a-value/1
]
#r2only
[
a-value: #2
#"2" == a-value/1
]
[
a-value: first ['a/b]
'a == a-value/1
]
[
a-value: USD$1
"USD" = a-value/1
]
[
a-value: make object! [a: 1]
1 == a-value/a
]
[
a-value: 2x3
2 = a-value/1
]
[
a-value: first [(2)]
2 == a-value/1
]
[
a-value: 'a/b
'a == a-value/1
]
#r2only
[
a-value: make port! http://
none? a-value/user-data
]
#r3only
[
a-value: make port! http://
none? a-value/data
]
[
a-value: first [a/b:]
'a == a-value/1
]
[
a-value: "12"
#"1" == a-value/1
]
[
a-value: <tag>
#"t" == a-value/1
]
[
a-value: 2:03
2 == a-value/1
]
[
a-value: 1.2.3
1 == a-value/1
]
[
a-value: file://a
file://a/1 = a-value/1
]
; calling functions through paths: function in object
[
obj: make object! [fun: func [] [1]]
1 == obj/fun
]
[
obj: make object! [fun: func [/ref val] [val]]
1 == obj/fun/ref 1
]
; calling functions through paths: function in block, positional
[
blk: reduce [func [] [10] func [] [20]]
10 == blk/1
]
; calling functions through paths: function in block, "named"
[
blk: reduce ['foo func [] [10] 'bar func [] [20]]
20 == blk/bar
]
; bug#26
[
b: [b 1]
1 = b/b
]
; path evaluation order
[
a: 1x2
found? any [
error? try [b: a/(a: [3 4] 1)]
b = 1
b = 3
]
]
; recursive path
[
a: make object! []
path: 'a/a
change/only back tail path path
error? try [do path]
true
]
; bug#71
[
a: "abcd"
error? try [a/x]
]
; bug#1820: Word USER can't be selected with path syntax
[
b: [user 1 _user 2]
1 = b/user
]
; bug#1977
#r3only
[f: func [/r] [1] error? try [f/r/%]]
; datatypes/percent.r
#r3only
[percent? 0%]
#r3only
[not percent? 1]
#r3only
[percent! = type? 0%]
#r3only
[percent? 0.0%]
#r3only
[percent? 1%]
#r3only
[percent? -1.0%]
#r3only
[percent? 2.2%]
#r3only
[0% = make percent! 0]
#r3only
[0% = make percent! "0"]
#r3only
[0% = to percent! 0]
#r3only
[0% = to percent! "0"]
#r3only
[100% = to percent! 1]
#r3only
[10% = to percent! 0.1]
#r3only
[error? try [to percent! "t"]]
#r3only
[0 = to decimal! 0%]
#r3only
[0.1 = to decimal! 10%]
#r3only
[1.0 = to decimal! 100%]
#r3only
[0% = load mold 0.0%]
#r3only
[1% = load mold 1.0%]
#r3only
[1.1% = load mold 1.1%]
#r3only
[-1% = load mold -1.0%]
; bug#57
#r3only
[-5% = negate 5%]
; bug#57
#r3only
[10% = (5% + 5%)]
; bug#57
#r3only
[6% = round 5.55%]
; bug#97
#r3only
[$59.0 = (10% * $590)]
; bug#97
#r3only
[$100.6 = ($100 + 60%)]
; 64-bit IEEE 754 maximum
; bug#1475
#r3only
[same? 1.7976931348623157e310% load mold/all 1.7976931348623157e310%]
; bug#1475
; 64-bit IEEE 754 minimum
#r3only
[same? -1.7976931348623157E310% load mold/all -1.7976931348623157e310%]
; Minimal positive normalized
#r3only
[same? 2.2250738585072014E-310% load mold/all 2.2250738585072014E-310%]
; Maximal positive denormalized
#r3only
[same? 2.2250738585072009E-310% load mold/all 2.2250738585072009E-310%]
; Minimal positive denormalized
#r3only
[same? 4.9406564584124654E-322% load mold/all 4.9406564584124654E-322%]
; Maximal negative normalized
#r3only
[same? -2.2250738585072014E-306% load mold/all -2.2250738585072014E-306%]
; Minimal negative denormalized
#r3only
[same? -2.2250738585072009E-306% load mold/all -2.2250738585072009E-306%]
; Maximal negative denormalized
#r3only
[same? -4.9406564584124654E-322% load mold/all -4.9406564584124654E-322%]
#r3only
[same? 10.000000000000001% load mold/all 10.000000000000001%]
#r3only
[same? 29.999999999999999% load mold/all 29.999999999999999%]
#r3only
[same? 30.000000000000004% load mold/all 30.000000000000004%]
#r3only
[same? 9.9999999999999926e154% load mold/all 9.9999999999999926e154%]
; alternative form
#r3only
[1.1% == 1,1%]
#r3only
[110% = make percent! 110%]
#r3only
[110% = make percent! "110%"]
#r3only
[1.1% = to percent! 1.1%]
#r3only
[1.1% = to percent! "1.1%"]
; datatypes/port.r
[port? make port! http://]
[not port? 1]
[port! = type? make port! http://]
; datatypes/refinement.r
[refinement? /a]
[not refinement? 1]
[refinement! = type? /a]
; datatypes/routine.r
#r2only
[
success: routine? case [
; this needs to be system-specific
system/version/4 = 2 [ ; OSX
a-library: load/library %libc.dylib
make routine! [
tv [struct! []]
tz [struct! []]
return: [integer!]
] a-library "settimeofday"
]
system/version/4 = 3 [ ; Windows
a-library: load/library %kernel32.dll
make routine! [
systemtime [struct! []]
return: [int]
] a-library "SetSystemTime"
]
all [system/version/4 = 4 system/version/5 = 2] [ ; Linux libc6
a-library: %/lib/libc.so.6
make routine! [
tv [struct! []]
tz [struct! []]
return: [integer!]
] a-library "settimeofday"
]
system/version/4 = 4 [ ; Linux
a-library: load/library %libc.so
make routine! [
tv [struct! []]
tz [struct! []]
return: [integer!]
] a-library "settimeofday"
]
system/version/4 = 7 [ ; FreeBSD
a-library: load/library %libc.so
make routine! [
tv [struct! []]
tz [struct! []]
return: [integer!]
] a-library "settimeofday"
]
system/version/4 = 8 [ ; NetBSD
a-library: load/library %libc.so
make routine! [
tv [struct! []]
tz [struct! []]
return: [integer!]
] a-library "settimeofday"
]
system/version/4 = 9 [ ; OpenBSD
a-library: load/library %libc.so
make routine! [
tv [struct! []]
tz [struct! []]
return: [integer!]
] a-library "settimeofday"
]
system/version/4 = 10 [ ; Solaris
a-library: load/library %libc.so
make routine! [
tv [struct! []]
tz [struct! []]
return: [integer!]
] a-library "settimeofday"
]
]
free a-library
success
]
; datatypes/set-path.r
[set-path? first [a/b:]]
[not set-path? 1]
[set-path! = type? first [a/b:]]
; the minimum
; bug#1947
[set-path? load "#[set-path! []]"]
[set-path? load "#[set-path! [a]]"]
[equal? mold/all load "#[set-path! []]" "#[set-path! []]"]
[equal? mold/all load "#[set-path! [a]]" "#[set-path! [a]]"]
[
all [
set-path? a: load "#[set-path! [a b c] 2]"
2 == index? a
]
]
["a/b:" = mold first [a/b:]]
; set-paths are active
[
a: make object! [b: none]
a/b: 5
5 == a/b
]
; bug#1
[
o: make object! [a: 0x0]
o/a/x: 71830
o/a/x = 71830
]
; set-path evaluation order
[
a: 1x2
a/x: (a: [x 4] 3)
any [
a == 3x2
a == [x 3]
]
]
; bug#64
[
blk: [1]
i: 1
blk/:i: 2
blk = [2]
]
; datatypes/set-word.r
[set-word? first [a:]]
[not set-word? 1]
[set-word! = type? first [a:]]
; set-word is active
[
a: :abs
equal? :a :abs
]
[
a: #{}
equal? :a #{}
]
[
a: charset ""
equal? :a charset ""
]
[
a: []
equal? a []
]
[
a: action!
equal? :a action!
]
; bug#1477
[set-word? first [/:]]
[set-word? first [//:]]
[set-word? first [///:]]
; bug#1817
#r3only
[
a: make map! []
a/b: make object! [
c: make map! []
]
integer? a/b/c/d: 1
]
; datatypes/string.r
[string? "ahoj"]
[not string? 1]
[string! = type? "ahoj"]
; minimum
[string? ""]
; alternative literal form
["" == #[string! ""]]
["" == make string! 0]
["^@" = "^(00)"]
["^A" = "^(01)"]
["^B" = "^(02)"]
["^C" = "^(03)"]
["^D" = "^(04)"]
["^E" = "^(05)"]
["^F" = "^(06)"]
["^G" = "^(07)"]
["^H" = "^(08)"]
["^I" = "^(09)"]
["^J" = "^(0A)"]
["^K" = "^(0B)"]
["^L" = "^(0C)"]
["^M" = "^(0D)"]
["^N" = "^(0E)"]
["^O" = "^(0F)"]
["^P" = "^(10)"]
["^Q" = "^(11)"]
["^R" = "^(12)"]
["^S" = "^(13)"]
["^T" = "^(14)"]
["^U" = "^(15)"]
["^V" = "^(16)"]
["^W" = "^(17)"]
["^X" = "^(18)"]
["^Y" = "^(19)"]
["^Z" = "^(1A)"]
["^[" = "^(1B)"]
["^\" = "^(1C)"]
["^]" = "^(1D)"]
["^!" = "^(1E)"]
["^_" = "^(1F)"]
[" " = "^(20)"]
["!" = "^(21)"]
["^"" = "^(22)"]
["#" = "^(23)"]
["$" = "^(24)"]
["%" = "^(25)"]
["&" = "^(26)"]
["'" = "^(27)"]
["(" = "^(28)"]
[")" = "^(29)"]
["*" = "^(2A)"]
["+" = "^(2B)"]
["," = "^(2C)"]
["-" = "^(2D)"]
["." = "^(2E)"]
["/" = "^(2F)"]
["0" = "^(30)"]
["1" = "^(31)"]
["2" = "^(32)"]
["3" = "^(33)"]
["4" = "^(34)"]
["5" = "^(35)"]
["6" = "^(36)"]
["7" = "^(37)"]
["8" = "^(38)"]
["9" = "^(39)"]
[":" = "^(3A)"]
[";" = "^(3B)"]
["<" = "^(3C)"]
["=" = "^(3D)"]
[">" = "^(3E)"]
["?" = "^(3F)"]
["@" = "^(40)"]
["A" = "^(41)"]
["B" = "^(42)"]
["C" = "^(43)"]
["D" = "^(44)"]
["E" = "^(45)"]
["F" = "^(46)"]
["G" = "^(47)"]
["H" = "^(48)"]
["I" = "^(49)"]
["J" = "^(4A)"]
["K" = "^(4B)"]
["L" = "^(4C)"]
["M" = "^(4D)"]
["N" = "^(4E)"]
["O" = "^(4F)"]
["P" = "^(50)"]
["Q" = "^(51)"]
["R" = "^(52)"]
["S" = "^(53)"]
["T" = "^(54)"]
["U" = "^(55)"]
["V" = "^(56)"]
["W" = "^(57)"]
["X" = "^(58)"]
["Y" = "^(59)"]
["Z" = "^(5A)"]
["[" = "^(5B)"]
["\" = "^(5C)"]
["]" = "^(5D)"]
["^^" = "^(5E)"]
["_" = "^(5F)"]
["`" = "^(60)"]
["a" = "^(61)"]
["b" = "^(62)"]
["c" = "^(63)"]
["d" = "^(64)"]
["e" = "^(65)"]
["f" = "^(66)"]
["g" = "^(67)"]
["h" = "^(68)"]
["i" = "^(69)"]
["j" = "^(6A)"]
["k" = "^(6B)"]
["l" = "^(6C)"]
["m" = "^(6D)"]
["n" = "^(6E)"]
["o" = "^(6F)"]
["p" = "^(70)"]
["q" = "^(71)"]
["r" = "^(72)"]
["s" = "^(73)"]
["t" = "^(74)"]
["u" = "^(75)"]
["v" = "^(76)"]
["w" = "^(77)"]
["x" = "^(78)"]
["y" = "^(79)"]
["z" = "^(7A)"]
["{" = "^(7B)"]
["|" = "^(7C)"]
["}" = "^(7D)"]
["~" = "^(7E)"]
["^~" = "^(7F)"]
["^(null)" = "^(00)"]
["^(line)" = "^(0A)"]
["^/" = "^(0A)"]
["^(tab)" = "^(09)"]
["^-" = "^(09)"]
["^(page)" = "^(0C)"]
["^(esc)" = "^(1B)"]
["^(back)" = "^(08)"]
["^(del)" = "^(7f)"]
["ahoj" = #[string! "ahoj"]]
["1" = to string! 1]
[{""} = mold ""]
; datatypes/struct.r
[struct? make struct! [i [integer!]] none]
[not struct? 1]
[struct! = type? make struct! [] none]
; minimum
[struct? make struct! [] none]
; literal form
[struct? #[struct! [] []]]
[
s: make string! 15
addr: func [s] [copy third make struct! [s [string!]] reduce [s]]
(addr s) = (addr insert/dup s #"0" 15)
]
[false = not make struct! [] none]
[
a-value: make struct! [] none
f: does [:a-value]
same? third :a-value third f
]
[
a-value: make struct! [i [integer!]] [1]
1 == a-value/i
]
[
a-value: make struct! [] none
same? third :a-value third all [:a-value]
]
[
a-value: make struct! [] none
same? third :a-value third all [true :a-value]
]
[
a-value: make struct! [] none
true = all [:a-value true]
]
[
a-value: make struct! [] none
same? third :a-value third do reduce [:a-value]
]
[
a-value: make struct! [] none
same? third :a-value third do :a-value
]
[if make struct! [] none [true]]
[
a-value: make struct! [] none
same? third :a-value third any [:a-value]
]
[
a-value: make struct! [] none
same? third :a-value third any [false :a-value]
]
[
a-value: make struct! [] none
same? third :a-value third any [:a-value false]
]
; datatypes/symbol.r
#r2only
[symbol! = type? make symbol! "xx"]
; datatypes/tag.r
[tag? <tag>]
[not tag? 1]
[tag! = type? <tag>]
; minimum
[tag? #[tag! ""]]
[strict-equal? #[tag! ""] make tag! 0]
[strict-equal? #[tag! ""] to tag! ""]
["<tag>" == mold <tag>]
; bug#2169
["<ēee>" == mold <ēee>]
[equal? mold/all #[tag! ""] {#[tag! ""]}]
; datatypes/time.r
[time? 0:00]
[not time? 1]
[time! = type? 0:00]
[0:0:10 = make time! 10]
[0:0:10 = to time! 10]
[error? try [to time! "a"]]
["0:00" = mold 0:00]
; small value
[
found? any [
error? try [t: -596522:0:0 - 1:00]
t = load mold t
]
]
; big value
[
found? any [
error? try [t: 596522:0:0 + 1:00]
t = load mold t
]
]
; strange value
[error? try [load "--596523:-14:-07.772224"]]
; minimal time
[time? -596523:14:07.999999999]
; maximal negative time
[negative? -0:0:0.000000001]
; minimal positive time
[positive? 0:0:0.000000001]
; maximal time
[time? 596523:14:07.999999999]
; bug#96
[
time: 1:23:45.6
1:23:45.7 = (time + 0.1)
]
; bug#96
[
time: 1:23:45.6
0:41:52.8 = (time * .5)
]
; datatypes/tuple.r
[tuple? 1.2.3]
[not tuple? 1]
[tuple! = type? 1.2.3]
[1.2.3 = to tuple! [1 2 3]]
["1.2.3" = mold 1.2.3]
; minimum
[tuple? make tuple! []]
; maximum
[tuple? 255.255.255.255.255.255.255.255.255.255]
[error? try [load "255.255.255.255.255.255.255.255.255.255.255"]]
; datatypes/typeset.r
#r2only
[datatype? any-block!]
#r3only
[typeset? any-block!]
#r3
[typeset? to-typeset any-block!]
#r2only
[datatype? any-function!]
#r3only
[typeset? any-function!]
#r3
[typeset? to-typeset any-function!]
#r3
[typeset? any-path!]
#r3
[typeset? to-typeset any-path!]
#r3
[typeset? any-object!]
#r3
[typeset? to-typeset any-object!]
#r2only
[datatype? any-string!]
#r3only
[typeset? any-string!]
#r3
[typeset? to-typeset any-string!]
#r2only
[datatype? any-word!]
#r3only
[typeset? any-word!]
#r3
[typeset? to-typeset any-word!]
#r3
[typeset? immediate!]
#r3
[typeset? to-typeset immediate!]
#r3
[typeset? internal!]
#r3
[typeset? to-typeset internal!]
#r2only
[datatype? number!]
#r3only
[typeset? number!]
#r3
[typeset? to-typeset number!]
#r3
[typeset? scalar!]
#r3
[typeset? to-typeset scalar!]
#r2only
[datatype? series!]
#r3only
[typeset? series!]
#r3
[typeset? to-typeset series!]
#r3only
[typeset? make typeset! [integer! none!]]
#r3
[typeset? make typeset! reduce [integer! none!]]
#r3
[typeset? to-typeset [integer! none!]]
#r3only
[typeset! = type? series!]
; bug#92
[
x: to typeset! []
not x = now
]
; datatypes/unset.r
[unset? ()]
[unset! == type? ()]
[not unset? 1]
; bug#836
[unset? #[unset!]]
#r3only
[unset? make unset! none]
; bug#68
#r3only
[unset? to unset! none]
#r3only
[unset? to unset! 1]
[error? try [a: ()]]
[not error? try [set/any 'a ()]]
; datatypes/url.r
[url? http://www.fm.tul.cz/~ladislav/rebol]
[not url? 1]
[url! = type? http://www.fm.tul.cz/~ladislav/rebol]
; minimum; alternative literal form
[url? #[url! ""]]
[strict-equal? #[url! ""] make url! 0]
[strict-equal? #[url! ""] to url! ""]
["http://" = mold http://]
["http://a%2520b" = mold http://a%2520b]
[equal? mold/all #[url! ""] {#[url! ""]}]
[equal? mold/all #[url! "a"] {#[url! "a"]}]
; bug#2011
[url? http://a.b.c/d?e=f%26]
[url? http://a.b.c/d?e=f&]
[not equal? http://a.b.c/d?e=f%26 http://a.b.c/d?e=f&]
; bug#2013
[url? http://a.b.c/d?e=č]
[url? http://a.b.c/d?e=%c4%8d]
[equal? http://a.b.c/d?e=%c4%8d http://a.b.c/d?e=č]
; datatypes/vector.r
#r3only
[vector? make vector! 0]
#r3only
[vector? make vector! [integer! 8]]
#r3only
[vector? make vector! [integer! 16]]
#r3only
[vector? make vector! [integer! 32]]
#r3only
[vector? make vector! [integer! 64]]
#r3only
[0 = length? make vector! 0]
#r3only
[1 = length? make vector! 1]
#r3only
[1 = length? make vector! [integer! 32]]
#r3only
[2 = length? make vector! 2]
#r3only
[2 = length? make vector! [integer! 32 2]]
; bug#1538
#r3only
[10 = length? make vector! 10.5]
; bug#1213
#r3only
[error? try [make vector! -1]]
#r3only
[0 = first make vector! [integer! 32]]
#r3only
[all map-each x make vector! [integer! 32 16] [zero? x]]
#r3only
[
v: make vector! [integer! 32 3]
v/1: 10
v/2: 20
v/3: 30
v = make vector! [integer! 32 [10 20 30]]
]
; datatypes/word.r
[word? 'a]
[not word? 1]
[word! = type? 'a]
; literal form
[word? first [a]]
; transitivity, bug#2251
[
not all [
lesser-or-equal? 'C 'a
lesser-or-equal? 'c 'C
not lesser-or-equal? 'c 'a
]
]
; words are active
[
a-value: #{}
same? :a-value a-value
]
[
a-value: charset ""
same? :a-value a-value
]
[
a-value: []
same? :a-value a-value
]
[
a-value: none!
same? :a-value a-value
]
[
a-value: 1/Jan/0000
same? :a-value a-value
]
[
a-value: 0.0
:a-value == a-value
]
[
a-value: 1.0
:a-value == a-value
]
[
a-value: me@here.com
same? :a-value a-value
]
#r2only
[
error? a-value: try [1 / 0]
same? disarm :a-value disarm a-value
]
#r3only
[
error? a-value: try [1 / 0]
same? :a-value a-value
]
[
a-value: %""
same? :a-value a-value
]
; functions are word-active
[
a-value: does [1]
1 == a-value
]
[
a-value: first [:a]
:a-value == a-value
]
[
a-value: #"^@"
:a-value == a-value
]
[
a-value: make image! 0x0
same? :a-value a-value
]
[
a-value: 0
:a-value == a-value
]
[
a-value: 1
:a-value == a-value
]
[
a-value: #
same? :a-value a-value
]
; lit-paths are word-active
#r2only
[
a-value: first ['a/b]
a-value == to path! :a-value
]
; lit-paths aren't word-active
#r3only
[
a-value: first ['a/b]
a-value == :a-value
]
; lit-words are word-active
[
a-value: first ['a]
a-value == to word! :a-value
]
[:true == true]
[:false == false]
[
a-value: $1
:a-value == a-value
]
; natives are word-active
[native! == type? :type?]
[:none == none]
; library test?
[
a-value: make object! []
same? :a-value a-value
]
[
a-value: first [()]
same? :a-value a-value
]
; ops are word-active
#r2only
[
a-value: get '+
3 == a-value 1 2
]
#r3only
[
a-value: get '+
1 a-value 2 == 3
]
[
a-value: 0x0
:a-value == a-value
]
[
a-value: 'a/b
:a-value == a-value
]
[
a-value: make port! http://
port? a-value
]
[
a-value: /a
:a-value == a-value
]
; set-paths are not word-active
[
a-value: first [a/b:]
:a-value == a-value
]
[
a-value: first [a:]
:a-value == a-value
]
[
a-value: ""
same? :a-value a-value
]
#r2only
[
a-value: make struct! [] none
same? third :a-value third a-value
]
[
a-value: make tag! ""
same? :a-value a-value
]
[
a-value: 0:00
same? :a-value a-value
]
[
a-value: 0.0.0
same? :a-value a-value
]
#r2only
[
unset 'a-value
e: disarm try [a-value]
e/id = 'no-value
]
#r3only
[
unset 'a-value
e: try [a-value]
e/id = 'no-value
]
[
a-value: 'a
:a-value == a-value
]
; functions/comparison/lesserq.r
; integer -9223372036854775808 < x tests
#64bit
[not -9223372036854775808 < -9223372036854775808]
#64bit
[-9223372036854775808 < -9223372036854775807]
#64bit
[-9223372036854775808 < -2147483648]
#64bit
[-9223372036854775808 < -1]
#64bit
[-9223372036854775808 < 0]
; bug#2054
#64bit
[-9223372036854775808 < 1]
#64bit
[-9223372036854775808 < 9223372036854775806]
#64bit
[-9223372036854775808 < 9223372036854775807]
; integer -9223372036854775807 < x tests
#64bit
[not -9223372036854775807 < -9223372036854775808]
#64bit
[not -9223372036854775807 < -9223372036854775807]
#64bit
[-9223372036854775807 < -1]
#64bit
[-9223372036854775807 < 0]
#64bit
[-9223372036854775807 < 1]
#64bit
[-9223372036854775807 < 9223372036854775806]
#64bit
[-9223372036854775807 < 9223372036854775807]
; integer -2147483648 < x tests
[not -2147483648 < -2147483648]
[-2147483648 < -1]
[-2147483648 < 0]
[-2147483648 < 1]
[-2147483648 < 2147483647]
; integer -1 < x tests
#64bit
[not -1 < -9223372036854775808]
#64bit
[not -1 < -9223372036854775807]
[not -1 < -1]
[-1 < 0]
[-1 < 1]
#64bit
[-1 < 9223372036854775806]
#64bit
[-1 < 9223372036854775807]
; integer 0 < x tests
#64bit
[not 0 < -9223372036854775808]
#64bit
[not 0 < -9223372036854775807]
[not 0 < -1]
[not 0 < 0]
[0 < 1]
#64bit
[0 < 9223372036854775806]
#64bit
[0 < 9223372036854775807]
; integer 1 < x tests
#64bit
[not 1 < -9223372036854775808]
#64bit
[not 1 < -9223372036854775807]
[not 1 < -1]
[not 1 < 0]
[not 1 < 1]
#64bit
[1 < 9223372036854775806]
#64bit
[1 < 9223372036854775807]
; integer 2147483647 < x tests
[not 2147483647 < -2147483648]
[not 2147483647 < -1]
[not 2147483647 < 0]
[not 2147483647 < 1]
[not 2147483647 < 2147483647]
; integer 9223372036854775806 < x tests
#64bit
[not 9223372036854775806 < -9223372036854775808]
#64bit
[not 9223372036854775806 < -9223372036854775807]
#64bit
[not 9223372036854775806 < -1]
#64bit
[not 9223372036854775806 < 0]
#64bit
[not 9223372036854775806 < 1]
#64bit
[not 9223372036854775806 < 9223372036854775806]
#64bit
[9223372036854775806 < 9223372036854775807]
; integer 9223372036854775807 < x tests
#64bit
[not 9223372036854775807 < -9223372036854775808]
#64bit
[not 9223372036854775807 < -9223372036854775807]
#64bit
[not 9223372036854775807 < -1]
#64bit
[not 9223372036854775807 < 0]
#64bit
[not 9223372036854775807 < 1]
#64bit
[not 9223372036854775807 < 9223372036854775806]
#64bit
[not 9223372036854775807 < 9223372036854775807]
; decimal < integer
[not 1.1 < 1]
[1.0 < 2147483647]
[not -1.0 < -2147483648]
; integer < decimal
[1 < 1.1]
[not 2147483647 < 1.0]
[-2147483648 < -1.0]
; -1.7976931348623157e308 < decimal
[not -1.7976931348623157e308 < -1.7976931348623157e308]
[-1.7976931348623157e308 < -1.0]
[-1.7976931348623157e308 < -4.94065645841247E-324]
[-1.7976931348623157e308 < 0.0]
[-1.7976931348623157e308 < 4.94065645841247E-324]
[-1.7976931348623157e308 < 1.0]
[-1.7976931348623157e308 < 1.7976931348623157e308]
; -1.0 < decimal
[not -1.0 < -1.7976931348623157e308]
[not -1.0 < -1.0]
[-1.0 < -4.94065645841247E-324]
[-1.0 < 0.0]
[-1.0 < 4.94065645841247E-324]
[-1.0 < 1.0]
[-1.0 < 1.7976931348623157e308]
; -4.94065645841247E-324 < decimal
[not -4.94065645841247E-324 < -1.7976931348623157e308]
[not -4.94065645841247E-324 < -1.0]
[not -4.94065645841247E-324 < -4.94065645841247E-324]
[-4.94065645841247E-324 < 0.0]
[-4.94065645841247E-324 < 4.94065645841247E-324]
[-4.94065645841247E-324 < 1.0]
[-4.94065645841247E-324 < 1.7976931348623157e308]
; 0.0 < decimal
[not 0.0 < -1.7976931348623157e308]
[not 0.0 < -1.0]
[not 0.0 < -4.94065645841247E-324]
[not 0.0 < 0.0]
[0.0 < 4.94065645841247E-324]
[0.0 < 1.0]
[0.0 < 1.7976931348623157e308]
; 4.94065645841247E-324 < decimal
[not 4.94065645841247E-324 < -1.7976931348623157e308]
[not 4.94065645841247E-324 < -1.0]
[not 4.94065645841247E-324 < -4.94065645841247E-324]
[not 4.94065645841247E-324 < 0.0]
[not 4.94065645841247E-324 < 4.94065645841247E-324]
[4.94065645841247E-324 < 1.0]
[4.94065645841247E-324 < 1.7976931348623157e308]
; 1.0 < decimal
[not 1.0 < -1.7976931348623157e308]
[not 1.0 < -1.0]
[not 1.0 < -4.94065645841247E-324]
[not 1.0 < 0.0]
[not 1.0 < 4.94065645841247E-324]
[not 1.0 < 1.0]
[1.0 < 1.7976931348623157e308]
; 1.7976931348623157e308 < decimal
[not 1.7976931348623157e308 < -1.7976931348623157e308]
[not 1.7976931348623157e308 < -1.0]
[not 1.7976931348623157e308 < -4.94065645841247E-324]
[not 1.7976931348623157e308 < 0.0]
[not 1.7976931348623157e308 < 4.94065645841247E-324]
[not 1.7976931348623157e308 < 1.0]
[not 1.7976931348623157e308 < 1.7976931348623157e308]
; char
[not #"^(00)" < #"^(00)"]
[#"^(00)" < #"^(01)"]
[#"^(00)" < #"^(ff)"]
[not #"^(01)" < #"^(00)"]
[not #"^(01)" < #"^(01)"]
[#"^(01)" < #"^(ff)"]
[not #"^(ff)" < #"^(00)"]
[not #"^(ff)" < #"^(01)"]
[not #"^(ff)" < #"^(ff)"]
; tuple
[not 0.0.0 < 0.0.0]
[0.0.0 < 0.0.1]
[0.0.0 < 0.0.255]
[not 0.0.1 < 0.0.0]
[not 0.0.1 < 0.0.1]
[0.0.1 < 0.0.255]
[not 0.0.255 < 0.0.0]
[not 0.0.255 < 0.0.1]
[not 0.0.255 < 0.0.255]
; functions/comparison/maximum-of.r
; bug#8
[3 = first maximum-of [1 2 3]]
; functions/comparison/equalq.r
; reflexivity test for native!
[equal? :abs :abs]
[not equal? :abs :add]
[equal? :all :all]
[not equal? :all :any]
; reflexivity test for op!
[equal? :+ :+]
[not equal? :+ :-]
; reflexivity test for function!
; Uses func instead of make function! so the test is compatible.
[equal? a-value: func [] [] :a-value]
; No structural equivalence for function!
; Uses FUNC instead of make function! so the test is compatible.
[not equal? func [] [] func [] []]
; reflexivity test for closure!
; Uses CLOSURE to make the test compatible.
[equal? a-value: closure [] [] :a-value]
; No structural equivalence for closure!
; Uses CLOSURE to make the test compatible.
[not equal? closure [] [] closure [] []]
[equal? a-value: #{00} a-value]
; binary!
; Same contents
[equal? #{00} #{00}]
; Different contents
[not equal? #{00} #{01}]
; Offset + similar contents at reference
[equal? #{00} #[binary! #{0000} 2]]
; Offset + similar contents at reference
[equal? #{00} #[binary! #{0100} 2]]
[equal? equal? #{00} #[binary! #{0100} 2] equal? #[binary! #{0100} 2] #{00}]
; No binary! padding
[not equal? #{00} #{0000}]
[equal? equal? #{00} #{0000} equal? #{0000} #{00}]
; Empty binary! not none
[not equal? #{} none]
[equal? equal? #{} none equal? none #{}]
; case sensitivity
; bug#1459
[not-equal? #{0141} #{0161}]
; email! vs. string!
; RAMBO #3518
#r3only
[
a-value: to email! ""
equal? a-value to string! a-value
]
; email! vs. string! symmetry
[
a-value: to email! ""
equal? equal? to string! a-value a-value equal? a-value to string! a-value
]
; file! vs. string!
; RAMBO #3518
#r3only
[
a-value: %""
equal? a-value to string! a-value
]
; file! vs. string! symmetry
[
a-value: %""
equal? equal? a-value to string! a-value equal? to string! a-value a-value
]
; image! same contents
[equal? a-value: #[image! 1x1 #{000000}] a-value]
[equal? #[image! 1x1 #{000000}] #[image! 1x1 #{000000}]]
[equal? #[image! 1x1 #{}] #[image! 1x1 #{000000}]]
; image! different size
[not equal? #[image! 1x2 #{000000}] #[image! 1x1 #{000000}]]
; image! different size
[not equal? #[image! 2x1 #{000000}] #[image! 1x1 #{000000}]]
; image! different rgb
[not equal? #[image! 1x1 #{000001}] #[image! 1x1 #{000000}]]
; image! alpha not specified = 0
#r2only
[equal? #[image! 1x1 #{000000} #{00}] #[image! 1x1 #{000000}]]
; image! alpha not specified = ff
#r3only
[equal? #[image! 1x1 #{000000} #{ff}] #[image! 1x1 #{000000}]]
; image! alpha different
[not equal? #[image! 1x1 #{000000} #{01}] #[image! 1x1 #{000000} #{00}]]
; Literal offset not supported in R2.
#r3only
[equal? #[image! 1x1 #{000000} 2] #[image! 1x1 #{000000} 2]]
; Literal offset not supported in R2.
#r3only
[not equal? #[image! 1x1 #{000000} 2] #[image! 1x1 #{000000}]]
[
a-value: #[image! 1x1 #{000000}]
not equal? a-value next a-value
]
; image! offset + structural equivalence
#r3only
[equal? #[image! 0x0 #{}] next #[image! 1x1 #{000000}]]
; image! offset + structural equivalence
#r3only
[equal? #[image! 1x0 #{}] next #[image! 1x1 #{000000}]]
; image! offset + structural equivalence
#r3only
[equal? #[image! 0x1 #{}] next #[image! 1x1 #{000000}]]
; image! offset + structural equivalence
#r2
[not equal? #[image! 0x0 #{}] next #[image! 1x1 #{000000}]]
; image! offset + structural equivalence
#r2
[not equal? #[image! 1x0 #{}] next #[image! 1x1 #{000000}]]
; image! offset + structural equivalence
#r2
[not equal? #[image! 0x1 #{}] next #[image! 1x1 #{000000}]]
; No implicit to binary! from image!
[not equal? #{00} #[image! 1x1 #{000000}]]
; No implicit to binary! from image!
[not equal? #{00000000} #[image! 1x1 #{000000}]]
; No implicit to binary! from image!
[not equal? #{0000000000} #[image! 1x1 #{000000}]]
[equal? equal? #{00} #[image! 1x1 #{00}] equal? #[image! 1x1 #{00}] #{00}]
; No implicit to binary! from integer!
[not equal? #{00} to integer! #{00}]
[equal? equal? #{00} to integer! #{00} equal? to integer! #{00} #{00}]
; issue! vs. string!
; RAMBO #3518
#r3only
[not-equal? a-value: #a to string! a-value]
[
a-value: #a
equal? equal? a-value to string! a-value equal? to string! a-value a-value
]
; No implicit to binary! from string!
[not equal? a-value: "" to binary! a-value]
[
a-value: ""
equal? equal? a-value to binary! a-value equal? to binary! a-value a-value
]
; tag! vs. string!
; RAMBO #3518
#r3only
[equal? a-value: to tag! "" to string! a-value]
[
a-value: to tag! ""
equal? equal? a-value to string! a-value equal? to string! a-value a-value
]
[equal? 0.0.0 0.0.0]
[not equal? 0.0.1 0.0.0]
; tuple! right-pads with 0
[equal? 1.0.0 1.0.0.0.0.0.0.0.0.0]
; tuple! right-pads with 0
[equal? 1.0.0.0.0.0.0.0.0.0 1.0.0]
; tuple! right-pads with 0
[not equal? 1.0.0 0.0.0.0.0.0.0.1.0.0]
; No implicit to binary! from tuple!
[
a-value: 0.0.0.0
not equal? to binary! a-value a-value
]
[
a-value: 0.0.0.0
equal? equal? to binary! a-value a-value equal? a-value to binary! a-value
]
[equal? #[bitset! #{00}] #[bitset! #{00}]]
; bitset! with no bits set does not equal empty bitset
; This is because of the COMPLEMENT problem: bug#1085.
[not equal? #[bitset! #{}] #[bitset! #{00}]]
; No implicit to binary! from bitset!
[not equal? #{00} #[bitset! #{00}]]
[equal? equal? #[bitset! #{00}] #{00} equal? #{00} #[bitset! #{00}]]
[equal? [] []]
[equal? a-value: [] a-value]
; Reflexivity for past-tail blocks
; Error in R2.
#r3only
[
a-value: tail [1]
clear head a-value
equal? a-value a-value
]
; Reflexivity for cyclic blocks
[
a-value: copy []
insert/only a-value a-value
equal? a-value a-value
]
; bug#1049
; Comparison of cyclic blocks
[
a-value: copy []
insert/only a-value a-value
b-value: copy []
insert/only b-value b-value
error? try [equal? a-value b-value]
true
]
[not equal? [] none]
[equal? equal? [] none equal? none []]
; block! vs. paren!
[not equal? [] first [()]]
; block! vs. paren! symmetry
[equal? equal? [] first [()] equal? first [()] []]
; block! vs. path!
[not equal? [a b] 'a/b]
; block! vs. path! symmetry
[
a-value: 'a/b
b-value: [a b]
equal? equal? :a-value :b-value equal? :b-value :a-value
]
; block! vs. lit-path!
[not equal? [a b] first ['a/b]]
; block! vs. lit-path! symmetry
[
a-value: first ['a/b]
b-value: [a b]
equal? equal? :a-value :b-value equal? :b-value :a-value
]
; block! vs. set-path!
[not equal? [a b] first [a/b:]]
; block! vs. set-path! symmetry
[
a-value: first [a/b:]
b-value: [a b]
equal? equal? :a-value :b-value equal? :b-value :a-value
]
; block! vs. get-path!
[not equal? [a b] first [:a/b]]
; block! vs. get-path! symmetry
[
a-value: first [:a/b]
b-value: [a b]
equal? equal? :a-value :b-value equal? :b-value :a-value
]
[equal? decimal! decimal!]
[not equal? decimal! integer!]
[equal? equal? decimal! integer! equal? integer! decimal!]
; datatype! vs. typeset!
[not equal? number! integer!]
; datatype! vs. typeset! symmetry
[equal? equal? number! integer! equal? integer! number!]
; datatype! vs. typeset!
#r3only
[not equal? integer! make typeset! [integer!]]
; datatype! vs. typeset!
#r3only
[not equal? integer! to typeset! [integer!]]
; datatype! vs. typeset!
; Supported by R2/Forward.
#r3
[not equal? integer! to-typeset [integer!]]
; typeset! (or pseudo-type in R2)
[equal? number! number!]
; typeset! (or pseudo-type in R2)
[not equal? number! series!]
#r3only
[equal? make typeset! [integer!] make typeset! [integer!]]
#r3only
[equal? to typeset! [integer!] to typeset! [integer!]]
; Supported by R2/Forward.
#r3
[equal? to-typeset [integer!] to-typeset [integer!]]
[equal? -1 -1]
[equal? 0 0]
[equal? 1 1]
[equal? 0.0 0.0]
[equal? 0.0 -0.0]
[equal? 1.0 1.0]
[equal? -1.0 -1.0]
#64bit
[equal? -9223372036854775808 -9223372036854775808]
#64bit
[equal? -9223372036854775807 -9223372036854775807]
#64bit
[equal? 9223372036854775807 9223372036854775807]
#64bit
[not equal? -9223372036854775808 -9223372036854775807]
#64bit
[not equal? -9223372036854775808 -1]
#64bit
[not equal? -9223372036854775808 0]
#64bit
[not equal? -9223372036854775808 1]
#64bit
[not equal? -9223372036854775808 9223372036854775806]
#64bit
[not equal? -9223372036854775807 -9223372036854775808]