RegressionTests__CollectionTests.st
branchjv
changeset 1487 c737fa75ba5a
parent 1477 7a6b9d928845
child 1492 bbd5bdff488a
--- a/RegressionTests__CollectionTests.st	Wed Apr 13 23:15:27 2016 +0100
+++ b/RegressionTests__CollectionTests.st	Tue Apr 26 21:49:30 2016 +0100
@@ -73,6 +73,34 @@
         nonEmpty := OrderedCollection with: #x.
 ! !
 
+!CollectionTests methodsFor:'tests-byteArray'!
+
+testByteArrayReverse
+     1 to:1024 do:[:i|
+        |bytes test rBytes|
+
+        bytes := ((1 to:i) asArray collect:[:i | i bitAnd:255]) asByteArray.
+        test := ((i to:1 by:-1) asArray collect:[:i | i bitAnd:255]) asByteArray.
+        rBytes := bytes copy.
+        self assert:(rBytes reverse = test).
+
+        rBytes := bytes copy.
+        self assert:(rBytes reverse reverse = bytes).
+     ].
+!
+
+testByteArrayReversed
+     1 to:1024 do:[:i|
+        |bytes test rBytes|
+
+        bytes := ((1 to:i) asArray collect:[:i | i bitAnd:255]) asByteArray.
+        test := ((i to:1 by:-1) asArray collect:[:i | i bitAnd:255]) asByteArray.
+        self assert:(bytes reversed = test).
+
+        self assert:(bytes reversed reversed = bytes).
+     ].
+! !
+
 !CollectionTests methodsFor:'tests-dictionary'!
 
 testDictionary01