| commit 89: | 94c37be642c0 |
| parent 88: | 638789ff72c2 |
| branch: | default |
Fix definition of Test.ReferenceEqual
Changed (Δ124 bytes):
raw changeset »
Test/CharStreamTests.fs (14 lines added, 14 lines removed)
Test/Test.fs (2 lines added, 2 lines removed)
Up to file-list Test/CharStreamTests.fs:
| … | … | @@ -442,7 +442,7 @@ let testEmptyStream (stream: CharStream) |
442 |
442 |
let cs = iter.Read2() |
443 |
443 |
cs.Char0 |> Equal EOS |
444 |
444 |
cs.Char1 |> Equal EOS |
445 |
iter.ReadUntil(iter) |> |
|
445 |
iter.ReadUntil(iter) |> ReferenceEqual "" |
|
446 |
446 |
|
447 |
447 |
/// Tries to systematically test all code branches in CharStream.Iterator methods. |
448 |
448 |
let testStream (stream: CharStream) (refString: string) blockSize blockOverlap minRegexSpace = |
| … | … | @@ -802,15 +802,15 @@ let testStream (stream: CharStream) (ref |
802 |
802 |
if str.Length = n then |
803 |
803 |
getIter(i).Read(n, true) |> Equal str |
804 |
804 |
else |
805 |
getIter(i).Read(n, true) |> |
|
805 |
getIter(i).Read(n, true) |> Equal "" |
|
806 |
806 |
let cs = Array.create (N + 2) '$' |
807 |
807 |
getIter(i).Read(cs, i%2, min n N) |> Equal str.Length |
808 |
808 |
cs |> Equal (((if i%2 = 1 then "$" else "") + str + new string('$', N + 2 - str.Length - i%2)).ToCharArray()) |
809 |
809 |
else |
810 |
810 |
if i >= N then getIter(i).Read() |> Equal EOS |
811 |
getIter(i).Read(n) |> ReferenceEqual "" |
|
812 |
getIter(i).Read(n, true) |> ReferenceEqual "" |
|
813 |
getIter(i).Read(n |
|
811 |
getIter(i).Read(n) |> Equal "" |
|
812 |
getIter(i).Read(n, true) |> Equal "" |
|
813 |
getIter(i).Read(n, false) |> Equal "" |
|
814 |
814 |
let endIter = getIter(i) |
815 |
815 |
getIter(i).ReadUntil(endIter) |> ReferenceEqual "" |
816 |
816 |
let cs = dollarString.ToCharArray() |
| … | … | @@ -843,7 +843,7 @@ let testStream (stream: CharStream) (ref |
843 |
843 |
with ArgumentOutOfRange -> () |
844 |
844 |
|
845 |
845 |
try |
846 |
iter0.Read(System.Int32.MaxValue, true) |> |
|
846 |
iter0.Read(System.Int32.MaxValue, true) |> Equal "" |
|
847 |
847 |
with OutOfMemory -> () |
848 |
848 |
try iter0.Read(-1, true) |> ignore; Fail() |
849 |
849 |
with ArgumentOutOfRange -> () |
| … | … | @@ -892,21 +892,21 @@ let testStream (stream: CharStream) (ref |
892 |
892 |
|
893 |
893 |
let iterN = getIter(N) |
894 |
894 |
|
895 |
try iterN.Read(System.Int32.MaxValue) |> |
|
895 |
try iterN.Read(System.Int32.MaxValue) |> Equal "" |
|
896 |
896 |
with OutOfMemory -> () |
897 |
897 |
try iterN.Read(-1) |> ignore; Fail() |
898 |
898 |
with ArgumentOutOfRange -> () |
899 |
899 |
try iterN.Read(System.Int32.MinValue) |> ignore; Fail() |
900 |
900 |
with ArgumentOutOfRange -> () |
901 |
901 |
|
902 |
try iterN.Read(System.Int32.MaxValue, false) |> |
|
902 |
try iterN.Read(System.Int32.MaxValue, false) |> Equal "" |
|
903 |
903 |
with OutOfMemory -> () |
904 |
904 |
try iterN.Read(-1, false) |> ignore; Fail() |
905 |
905 |
with ArgumentOutOfRange -> () |
906 |
906 |
try iterN.Read(System.Int32.MinValue, false) |> ignore; Fail() |
907 |
907 |
with ArgumentOutOfRange -> () |
908 |
908 |
|
909 |
try iterN.Read(System.Int32.MaxValue, true) |> |
|
909 |
try iterN.Read(System.Int32.MaxValue, true) |> Equal "" |
|
910 |
910 |
with OutOfMemory -> () |
911 |
911 |
try iterN.Read(-1, true) |> ignore; Fail() |
912 |
912 |
with ArgumentOutOfRange -> () |
| … | … | @@ -1156,7 +1156,8 @@ let xTest() = |
1156 |
1156 |
let testNormalizeNewlines() = |
1157 |
1157 |
let normalize = CharStream.NormalizeNewlines |
1158 |
1158 |
normalize null |> Equal null |
1159 |
normalize "" |> |
|
1159 |
normalize "" |> ReferenceEqual "" |
|
1160 |
normalize "ab" |> ReferenceEqual "ab" |
|
1160 |
1161 |
|
1161 |
1162 |
let check (cs: char[]) n = |
1162 |
1163 |
let str = new string(cs, 0, n) |
| … | … | @@ -1197,12 +1198,11 @@ let testFoldCase() = |
1197 |
1198 |
|
1198 |
1199 |
let foldCase = CharStream.FoldCase |
1199 |
1200 |
foldCase null |> Equal null |
1200 |
foldCase "" |> ReferenceEqual "" |
|
1201 |
foldCase "a" |> ReferenceEqual "a" |
|
1201 |
for s in [""; "a"; "aa"; "aaa"] do |
|
1202 |
foldCase s |> ReferenceEqual s |
|
1203 |
||
1202 |
1204 |
foldCase "A" |> Equal "a" |
1203 |
foldCase "aa" |> ReferenceEqual "aa" |
|
1204 |
1205 |
foldCase "aA" |> Equal "aa" |
1205 |
foldCase "aaa" |> ReferenceEqual "aaa" |
|
1206 |
1206 |
foldCase "aaA" |> Equal "aaa" |
1207 |
1207 |
foldCase "abcAOUÄÖÜdef" |> Equal "abcaouäöüdef" |
1208 |
1208 |
| … | … | @@ -22,8 +22,8 @@ let Equal a b = |
22 |
22 |
let NotEqual a b = |
23 |
23 |
if a = b then Fail () |
24 |
24 |
|
25 |
let ReferenceEqual a b = |
|
26 |
if not (System.Object.Equals(a, b)) then Fail () |
|
25 |
let ReferenceEqual (a: 't) (b: 't) = |
|
26 |
if not (System.Object.ReferenceEquals(a, b)) then Fail () |
|
27 |
27 |
|
28 |
28 |
|
29 |
29 |
let private ROkE_ withNewline (content: string) nSkippedChars result error (parser: Parser<_,_>) = |
