forked from rebolsource/r3
-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX: allow comparison of
char!
with integer!
resolves: Oldes/Rebol-issues#2454
- Loading branch information
Showing
3 changed files
with
73 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
Rebol [ | ||
Title: "Rebol3 compare test script" | ||
Author: "Oldes, Peter W A Wood" | ||
File: %compare-test.r3 | ||
Tabs: 4 | ||
Needs: [%../quick-test-module.r3] | ||
] | ||
|
||
~~~start-file~~~ "COMPARE" | ||
|
||
===start-group=== "char!" | ||
--test-- "char! = ..." | ||
--assert #"a" = #"a" | ||
--assert #"a" = 97 | ||
|
||
--test-- "char! <> ..." | ||
--assert #"a" <> #"b" | ||
--assert #"a" <> 98 | ||
--assert #"a" <> 97.0 | ||
--assert #"a" <> $97 | ||
--assert #"a" <> 97% | ||
--assert #"a" <> "a" | ||
|
||
--test-- "char! < ..." | ||
--assert #"a" < #"b" | ||
--assert #"a" < 98 | ||
|
||
--test-- "char! > ..." | ||
--assert #"b" > #"a" | ||
--assert #"a" > 96 | ||
|
||
--test-- "char! invalid compare" | ||
--assert all [error? e: try [#"a" < 98.0] e/id = 'invalid-compare] | ||
--assert all [error? e: try [#"a" < $98 ] e/id = 'invalid-compare] | ||
--assert all [error? e: try [#"a" < 98% ] e/id = 'invalid-compare] | ||
--assert all [error? e: try [#"a" < "a" ] e/id = 'invalid-compare] | ||
--assert all [error? e: try [#"a" < 1x1 ] e/id = 'invalid-compare] | ||
|
||
===end-group=== | ||
|
||
===start-group=== "integer!" | ||
--test-- "integer! = ..." | ||
--assert 97 = 97 | ||
--assert 97 = 97.0 | ||
--assert 97 = 9700% | ||
--assert 97 = #"a" | ||
|
||
--test-- "integer! < ..." | ||
--assert 97 < 98 | ||
--assert 97 < 97.1 | ||
--assert 97 < 9701% | ||
--assert 97 < #"b" | ||
|
||
--test-- "integer! > ..." | ||
--assert 97 > 96 | ||
--assert 97 > 96.0 | ||
--assert 97 > 9600% | ||
--assert 98 > #"a" | ||
|
||
--test-- "integer! invalid compare" | ||
--assert all [error? e: try [90 < "a" ] e/id = 'invalid-compare] | ||
--assert all [error? e: try [90 < 1x1 ] e/id = 'invalid-compare] | ||
===end-group=== | ||
|
||
~~~end-file~~~ |