Nicolas Cellier uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-nice.339.mcz ==================== Summary ==================== Name: CollectionsTests-nice.339 Author: nice Time: 10 May 2020, 6:18:29.341931 pm UUID: 38abf144-a487-4dfb-bed7-8ef6a9dab6b9 Ancestors: CollectionsTests-nice.338 Use Float32Array explicitely =============== Diff against CollectionsTests-nice.338 =============== Item was changed: ----- Method: FloatArrayTest>>testArithmeticCoercion (in category 'tests') ----- testArithmeticCoercion "This test is related to http://bugs.squeak.org/view.php?id=6782" + self should: [3.0 / (Float32Array with: 2.0) = (Float32Array with: 1.5)]. + self should: [3.0 * (Float32Array with: 2.0) = (Float32Array with: 6.0)]. + self should: [3.0 + (Float32Array with: 2.0) = (Float32Array with: 5.0)]. + self should: [3.0 - (Float32Array with: 2.0) = (Float32Array with: 1.0)].! - self should: [3.0 / (FloatArray with: 2.0) = (FloatArray with: 1.5)]. - self should: [3.0 * (FloatArray with: 2.0) = (FloatArray with: 6.0)]. - self should: [3.0 + (FloatArray with: 2.0) = (FloatArray with: 5.0)]. - self should: [3.0 - (FloatArray with: 2.0) = (FloatArray with: 1.0)].! Item was changed: ----- Method: FloatArrayTest>>testFloatArrayPluginPrimitiveAt (in category 'tests') ----- testFloatArrayPluginPrimitiveAt "if FloatArrayPlugin primitive are not here, this test is dumb. Otherwise, it will compare primitive and #fromIEEE32Bit:" #( "regular numbers no truncation or rounding" 2r0.0 2r1.0 2r1.1 2r1.00000000000000000000001 2r1.0e-10 2r1.1e-10 2r1.00000000000000000000001e-10 2r1.0e10 2r1.1e10 2r1.00000000000000000000001e10 "smallest float32 before gradual underflow" 2r1.0e-126 "biggest float32" 2r1.11111111111111111111111e127 "overflow" 2r1.11111111111111111111111e128 "gradual underflow" 2r0.11111111111111111111111e-126 2r0.00000000000000000000001e-126 "with rounding mode : tests on 25 bits" 2r1.0000000000000000000000001 2r1.0000000000000000000000010 2r1.0000000000000000000000011 2r1.0000000000000000000000100 2r1.0000000000000000000000101 2r1.0000000000000000000000110 2r1.0000000000000000000000111 2r1.1111111111111111111111001 2r1.1111111111111111111111010 2r1.1111111111111111111111011 2r1.1111111111111111111111101 2r1.1111111111111111111111110 2r1.1111111111111111111111111 "overflow" 2r1.1111111111111111111111110e127 "gradual underflow" 2r0.1111111111111111111111111e-126 2r0.1111111111111111111111110e-126 2r0.1111111111111111111111101e-126 2r0.1111111111111111111111011e-126 2r0.1111111111111111111111010e-126 2r0.1111111111111111111111001e-126 2r0.0000000000000000000000111e-126 2r0.0000000000000000000000110e-126 2r0.0000000000000000000000101e-126 2r0.0000000000000000000000011e-126 2r0.0000000000000000000000010e-126 2r0.0000000000000000000000001e-126 2r0.0000000000000000000000010000000000000000000000000001e-126 ) do: [:e | + self assert: ((Float32Array with: e) at: 1) = (Float fromIEEE32Bit: ((Float32Array with: e) basicAt: 1)). + self assert: ((Float32Array with: e negated) at: 1) = (Float fromIEEE32Bit: ((Float32Array with: e negated) basicAt: 1))]. - self assert: ((FloatArray with: e) at: 1) = (Float fromIEEE32Bit: ((FloatArray with: e) basicAt: 1)). - self assert: ((FloatArray with: e negated) at: 1) = (Float fromIEEE32Bit: ((FloatArray with: e negated) basicAt: 1))]. "special cases" (Array with: Float infinity with: Float negativeInfinity with: Float negativeZero) + do: [:e | self assert: ((Float32Array with: e) at: 1) = (Float fromIEEE32Bit: ((Float32Array with: e) basicAt: 1))]. - do: [:e | self assert: ((FloatArray with: e) at: 1) = (Float fromIEEE32Bit: ((FloatArray with: e) basicAt: 1))]. "Cannot compare NaN" (Array with: Float nan) + do: [:e | self assert: (Float fromIEEE32Bit: ((Float32Array with: e) basicAt: 1)) isNaN].! - do: [:e | self assert: (Float fromIEEE32Bit: ((FloatArray with: e) basicAt: 1)) isNaN].! Item was changed: ----- Method: FloatArrayTest>>testFloatArrayPluginPrimitiveAtPut (in category 'tests') ----- testFloatArrayPluginPrimitiveAtPut "if FloatArrayPlugin primitive are not here, this test is dumb. Otherwise, it will compare primitive and #asIEEE32BitWord" #( "regular numbers no truncation or rounding" 2r0.0 2r1.0 2r1.1 2r1.00000000000000000000001 2r1.0e-10 2r1.1e-10 2r1.00000000000000000000001e-10 2r1.0e10 2r1.1e10 2r1.00000000000000000000001e10 "smallest float32 before gradual underflow" 2r1.0e-126 "biggest float32" 2r1.11111111111111111111111e127 "overflow" 2r1.11111111111111111111111e128 "gradual underflow" 2r0.11111111111111111111111e-126 2r0.00000000000000000000001e-126 "with rounding mode : tests on 25 bits" 2r1.0000000000000000000000001 2r1.0000000000000000000000010 2r1.0000000000000000000000011 2r1.0000000000000000000000100 2r1.0000000000000000000000101 2r1.0000000000000000000000110 2r1.0000000000000000000000111 2r1.1111111111111111111111001 2r1.1111111111111111111111010 2r1.1111111111111111111111011 2r1.1111111111111111111111101 2r1.1111111111111111111111110 2r1.1111111111111111111111111 "overflow" 2r1.1111111111111111111111110e127 "gradual underflow" 2r0.1111111111111111111111111e-126 2r0.1111111111111111111111110e-126 2r0.1111111111111111111111101e-126 2r0.1111111111111111111111011e-126 2r0.1111111111111111111111010e-126 2r0.1111111111111111111111001e-126 2r0.0000000000000000000000111e-126 2r0.0000000000000000000000110e-126 2r0.0000000000000000000000101e-126 2r0.0000000000000000000000011e-126 2r0.0000000000000000000000010e-126 2r0.0000000000000000000000001e-126 2r0.0000000000000000000000010000000000000000000000000001e-126 ) do: [:e | + self assert: ((Float32Array with: e) basicAt: 1) = e asIEEE32BitWord. + self assert: ((Float32Array with: e negated) basicAt: 1) = e negated asIEEE32BitWord]. - self assert: ((FloatArray with: e) basicAt: 1) = e asIEEE32BitWord. - self assert: ((FloatArray with: e negated) basicAt: 1) = e negated asIEEE32BitWord]. "special cases" (Array with: Float infinity with: Float negativeInfinity with: Float negativeZero with: Float nan) + do: [:e | self assert: ((Float32Array with: e) basicAt: 1) = e asIEEE32BitWord]. - do: [:e | self assert: ((FloatArray with: e) basicAt: 1) = e asIEEE32BitWord]. ! Item was changed: ----- Method: FloatArrayTest>>testVectorOperations (in category 'tests') ----- testVectorOperations "Test primtive cases 'receiver size = argument size'." + self assert: (Float32Array withAll: {2.0. 2.0}) equals: (Float32Array withAll: {4.0. 6.0}) / (Float32Array withAll: {2.0. 3.0}). + self assert: (Float32Array withAll: {8.0. 9.0}) equals: (Float32Array withAll: {4.0. 4.5}) * (Float32Array withAll: {2.0. 2.0}). + self assert: (Float32Array withAll: {6.0. 9.0}) equals: (Float32Array withAll: {4.0. 6.0}) + (Float32Array withAll: {2.0. 3.0}). + self assert: (Float32Array withAll: {2.0. 3.0}) equals: (Float32Array withAll: {4.0. 6.0}) - (Float32Array withAll: {2.0. 3.0}). + self assert: 26 equals: ((Float32Array withAll: {4.0. 6.0}) dot: (Float32Array withAll: {2.0. 3.0})). - self assert: (FloatArray withAll: {2.0. 2.0}) equals: (FloatArray withAll: {4.0. 6.0}) / (FloatArray withAll: {2.0. 3.0}). - self assert: (FloatArray withAll: {8.0. 9.0}) equals: (FloatArray withAll: {4.0. 4.5}) * (FloatArray withAll: {2.0. 2.0}). - self assert: (FloatArray withAll: {6.0. 9.0}) equals: (FloatArray withAll: {4.0. 6.0}) + (FloatArray withAll: {2.0. 3.0}). - self assert: (FloatArray withAll: {2.0. 3.0}) equals: (FloatArray withAll: {4.0. 6.0}) - (FloatArray withAll: {2.0. 3.0}). - self assert: 26 equals: ((FloatArray withAll: {4.0. 6.0}) dot: (FloatArray withAll: {2.0. 3.0})). "Test corner cases where 'receiver size < argument size'." + self should: [(Float32Array withAll: {4.0. 6.0}) / (Float32Array withAll: {2.0. 3.0. 42.0})] raise: Error. + self should: [(Float32Array withAll: {4.0. 6.0}) * (Float32Array withAll: {2.0. 3.0. 42.0})] raise: Error. + self should: [(Float32Array withAll: {4.0. 6.0}) + (Float32Array withAll: {2.0. 3.0. 42.0})] raise: Error. + self should: [(Float32Array withAll: {4.0. 6.0}) - (Float32Array withAll: {2.0. 3.0. 42.0})] raise: Error. + self should: [(Float32Array withAll: {4.0. 6.0}) dot: (Float32Array withAll: {2.0. 3.0. 42.0})] raise: Error. - self should: [(FloatArray withAll: {4.0. 6.0}) / (FloatArray withAll: {2.0. 3.0. 42.0})] raise: Error. - self should: [(FloatArray withAll: {4.0. 6.0}) * (FloatArray withAll: {2.0. 3.0. 42.0})] raise: Error. - self should: [(FloatArray withAll: {4.0. 6.0}) + (FloatArray withAll: {2.0. 3.0. 42.0})] raise: Error. - self should: [(FloatArray withAll: {4.0. 6.0}) - (FloatArray withAll: {2.0. 3.0. 42.0})] raise: Error. - self should: [(FloatArray withAll: {4.0. 6.0}) dot: (FloatArray withAll: {2.0. 3.0. 42.0})] raise: Error. "Test corner cases where 'receiver size > argument size'." + self should: [(Float32Array withAll: {4.0. 6.0. 42.0}) / (Float32Array withAll: {2.0. 3.0})] raise: Error. + self should: [(Float32Array withAll: {4.0. 6.0. 42.0}) * (Float32Array withAll: {2.0. 3.0})] raise: Error. + self should: [(Float32Array withAll: {4.0. 6.0. 42.0}) + (Float32Array withAll: {2.0. 3.0})] raise: Error. + self should: [(Float32Array withAll: {4.0. 6.0. 42.0}) - (Float32Array withAll: {2.0. 3.0})] raise: Error. + self should: [(Float32Array withAll: {4.0. 6.0. 42.0}) dot: (Float32Array withAll: {2.0. 3.0})] raise: Error. - self should: [(FloatArray withAll: {4.0. 6.0. 42.0}) / (FloatArray withAll: {2.0. 3.0})] raise: Error. - self should: [(FloatArray withAll: {4.0. 6.0. 42.0}) * (FloatArray withAll: {2.0. 3.0})] raise: Error. - self should: [(FloatArray withAll: {4.0. 6.0. 42.0}) + (FloatArray withAll: {2.0. 3.0})] raise: Error. - self should: [(FloatArray withAll: {4.0. 6.0. 42.0}) - (FloatArray withAll: {2.0. 3.0})] raise: Error. - self should: [(FloatArray withAll: {4.0. 6.0. 42.0}) dot: (FloatArray withAll: {2.0. 3.0})] raise: Error. ! Item was changed: ----- Method: FloatCollectionTest>>testAdd (in category 'tests') ----- testAdd | fc | fc := #(1 2 3 4 ) as: FloatCollection. fc add: 88. + self assert: #(1.0 2.0 3.0 4.0 88.0 ) asFloat32Array equals: fc asFloat32Array. - self assert: #(1.0 2.0 3.0 4.0 88.0 ) asFloatArray equals: fc asFloatArray. fc add: 99. self assert: (#(1 2 3 4 88 99 ) as: FloatCollection) equals: fc! |
Free forum by Nabble | Edit this page |