RegressionTests__STCCompilerTests.st
changeset 1048 b5f4b15a3dbf
parent 1047 c602a3472c37
child 1102 0b428b9f023f
--- a/RegressionTests__STCCompilerTests.st	Tue Feb 11 21:08:55 2014 +0100
+++ b/RegressionTests__STCCompilerTests.st	Wed Feb 12 00:51:42 2014 +0100
@@ -227,6 +227,55 @@
     "Created: / 04-09-2013 / 09:35:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+test04_doubleArraySize_bug
+
+    "As of 2014-03-11, __doubleArraySize() seem to return off-by-one size
+     on Windows. Under Linux it seem to work just fine.
+
+     This tests checks for this bug.
+    "
+
+    | sizes |
+    [
+       Class withoutUpdatingChangesDo:[
+
+           "/ Now, compile the same source using stc and check...
+           (STCCompilerInterface new)
+               compileToMachineCode:'doubleArraySize
+                    | arr size1 size2 |
+
+                    arr := DoubleArray new: 8.
+                    size1 := arr size.
+%{
+                    size2 = __MKINT(__doubleArraySize(arr));
+%}.
+                    ^ Array with: size1 with: size2.
+   '
+               forClass:self class class
+               selector:#'doubleArraySize'
+               inCategory:'tests'
+               notifying:nil
+               install:true
+               skipIfSame:false
+               silent:true.
+
+           sizes := self class perform: #doubleArraySize.
+           self assert:(sizes first == 8).
+           self assert:(sizes second == 8).
+           self class class removeSelector:#doubleArraySize.
+       ].
+    ] ensure:[
+        self class class removeSelector:#doubleArraySize.
+    ]
+
+    "
+     self run:#test02_compilation
+     self new test02_compilation
+    "
+
+    "Created: / 11-02-2014 / 23:50:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 test10_bitor_bug
     "checks for an stc compiler bug (detected Sep 2011).
      stc generates bad code for the bitOr expression in nextLittleEndianNumber"