Added some tests for (Signed)LongIntegerArray.
--- a/RegressionTests__STCCompilerTests.st Mon Mar 03 13:08:38 2014 +0100
+++ b/RegressionTests__STCCompilerTests.st Tue Mar 04 11:32:51 2014 +0100
@@ -27,6 +27,7 @@
"
! !
+
!STCCompilerTests methodsFor:'code templates'!
inlinedBlockVariables1
@@ -238,8 +239,6 @@
| sizes |
[
Class withoutUpdatingChangesDo:[
-
- "/ Now, compile the same source using stc and check...
(STCCompilerInterface new)
compileToMachineCode:'doubleArraySize
| arr size1 size2 |
@@ -274,6 +273,7 @@
"
"Created: / 11-02-2014 / 23:50:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (format): / 04-03-2014 / 10:13:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
test10_bitor_bug
@@ -392,6 +392,185 @@
"
"Created: / 17-09-2011 / 10:32:18 / cg"
+!
+
+test_LongIntegeraArray_01
+ | sizes |
+ [
+ Class withoutUpdatingChangesDo:[
+
+ "/ Now, compile the same source using stc and check...
+ (STCCompilerInterface new)
+ compileToMachineCode:'longIntegerArray_size
+ | arr size1 size2 |
+
+ arr := LongIntegerArray new: 8.
+ size1 := arr size.
+%{
+ size2 = __MKINT(__longIntegerArraySize(arr));
+%}.
+ ^ Array with: size1 with: size2.
+ '
+ forClass:self class class
+ selector:#'longIntegerArray_size'
+ inCategory:'tests'
+ notifying:nil
+ install:true
+ skipIfSame:false
+ silent:true.
+
+ sizes := self class perform: #'longIntegerArray_size'.
+ self assert:(sizes first == 8).
+ self assert:(sizes second == 8).
+ self class class removeSelector:#longIntegerArray_size.
+ ].
+ ] ensure:[
+ self class class removeSelector:#longIntegerArray_size.
+ ]
+
+ "
+ self run:#test02_compilation
+ self new test02_compilation
+ "
+
+ "Created: / 04-03-2014 / 10:20:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+test_LongIntegeraArray_02
+ | sizes |
+ [
+ Class withoutUpdatingChangesDo:[
+ (STCCompilerInterface new)
+ compileToMachineCode:'longIntegerArray_i_element
+ | arr v1 v8 |
+
+ arr := LongIntegerArray new: 8.
+ arr at: 1 put: 1123456789.
+ arr at: 8 put: 1123456789.
+ self assert: (arr at: 1) = 1123456789.
+ self assert: (arr at: 8) = 1123456789.
+
+%{
+ __uint64__ val;
+ val = __LongIntegerArrayInstPtr(arr)->i_element[0];
+ v1 = __MKUINT64(&val);
+ val = __LongIntegerArrayInstPtr(arr)->i_element[7];
+ v8 = __MKUINT64(&val);
+%}.
+ ^ Array with: v1 with: v8.
+ '
+ forClass:self class class
+ selector:#'longIntegerArray_i_element'
+ inCategory:'tests'
+ notifying:nil
+ install:true
+ skipIfSame:false
+ silent:true.
+
+ sizes := self class perform: #'longIntegerArray_i_element'.
+ self assert:(sizes first = 1123456789).
+ self assert:(sizes second = 1123456789).
+ self class class removeSelector:#'longIntegerArray_i_element'.
+ ].
+ ] ensure:[
+ self class class removeSelector:#longIntegerArray_i_element.
+ ]
+
+ "
+ self run:#test02_compilation
+ self new test02_compilation
+ "
+
+ "Created: / 04-03-2014 / 10:21:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+test_SignedLongIntegeraArray_01
+ | sizes |
+ [
+ Class withoutUpdatingChangesDo:[
+
+ "/ Now, compile the same source using stc and check...
+ (STCCompilerInterface new)
+ compileToMachineCode:'signedLongIntegerArray_size
+ | arr size1 size2 |
+
+ arr := SignedLongIntegerArray new: 8.
+ size1 := arr size.
+%{
+ size2 = __MKINT(__signedLongIntegerArraySize(arr));
+%}.
+ ^ Array with: size1 with: size2.
+ '
+ forClass:self class class
+ selector:#'signedLongIntegerArray_size'
+ inCategory:'tests'
+ notifying:nil
+ install:true
+ skipIfSame:false
+ silent:true.
+
+ sizes := self class perform: #'signedLongIntegerArray_size'.
+ self assert:(sizes first == 8).
+ self assert:(sizes second == 8).
+ self class class removeSelector:#signedLongIntegerArray_size.
+ ].
+ ] ensure:[
+ self class class removeSelector:#signedLongIntegerArray_size.
+ ]
+
+ "
+ self run:#test02_compilation
+ self new test02_compilation
+ "
+
+ "Created: / 04-03-2014 / 10:11:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+test_SignedLongIntegeraArray_02
+ | sizes |
+ [
+ Class withoutUpdatingChangesDo:[
+ (STCCompilerInterface new)
+ compileToMachineCode:'signedLongIntegerArray_i_element
+ | arr v1 v8 |
+
+ arr := SignedLongIntegerArray new: 8.
+ arr at: 1 put: 1123456789.
+ arr at: 8 put: 1123456789.
+
+%{
+ __int64__ val;
+ val = __SignedLongIntegerArrayInstPtr(arr)->i_element[0];
+ v1 = __MKINT64(&val);
+ val = __SignedLongIntegerArrayInstPtr(arr)->i_element[7];
+ v8 = __MKINT64(&val);
+
+%}.
+ ^ Array with: v1 with: v8.
+ '
+ forClass:self class class
+ selector:#'signedLongIntegerArray_i_element'
+ inCategory:'tests'
+ notifying:nil
+ install:true
+ skipIfSame:false
+ silent:true.
+
+ sizes := self class perform: #'signedLongIntegerArray_i_element'.
+ self assert:(sizes first = 1123456789).
+ self assert:(sizes second = 1123456789).
+ self class class removeSelector:#'signedLongIntegerArray_i_element'.
+ ].
+ ] ensure:[
+ self class class removeSelector:#signedLongIntegerArray_i_element.
+ ]
+
+ "
+ self run:#test02_compilation
+ self new test02_compilation
+ "
+
+ "Created: / 04-03-2014 / 10:13:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!STCCompilerTests class methodsFor:'documentation'!