[Vm-dev] VM Maker: VMMaker.oscog-eem.268.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Feb 26 18:41:53 UTC 2013


Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.268.mcz

==================== Summary ====================

Name: VMMaker.oscog-eem.268
Author: eem
Time: 26 February 2013, 10:39:50.779 am
UUID: 5fdf7a63-1080-44b2-985d-0850b60cbbc3
Ancestors: VMMaker.oscog-eem.267

Merge VMMaker-dtl.301.  Add IncludedMethodsTest to VMMaker-Tests.

=============== Diff against VMMaker.oscog-eem.267 ===============

Item was added:
+ TestCase subclass: #IncludedMethodsTest
+ 	instanceVariableNames: ''
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'VMMaker-Tests'!
+ 
+ !IncludedMethodsTest commentStamp: 'dtl 11/9/2010 21:03' prior: 0!
+ Various classes in the image contain methods that are intended to be translated to C and executed as primitives. IncludedMethodsTest provides tests to validate these methods.
+ !

Item was added:
+ ----- Method: IncludedMethodsTest>>compare:with:collated: (in category 'primitives') -----
+ compare: string1 with: string2 collated: order
+ 	"Return 1, 2 or 3, if string1 is <, =, or > string2, with the collating order of characters given by the order array."
+ 
+ 	<primitive: 'primitiveCompareString' module: 'MiscPrimitivePlugin'>
+ 	self primitiveFailed
+ !

Item was added:
+ ----- Method: IncludedMethodsTest>>compress:toByteArray: (in category 'primitives') -----
+ compress: bm toByteArray: ba
+ 
+ 	<primitive: 'primitiveCompressToByteArray' module: 'MiscPrimitivePlugin'>
+ 	self primitiveFailed!

Item was added:
+ ----- Method: IncludedMethodsTest>>convert8bitSignedFrom:to16Bit: (in category 'primitives') -----
+ convert8bitSignedFrom: aByteArray to16Bit: aSoundBuffer
+ 	"Copy the contents of the given array of signed 8-bit samples into the given array of 16-bit signed samples."
+ 
+ 	<primitive: 'primitiveConvert8BitSigned' module: 'MiscPrimitivePlugin'>
+ 	self primitiveFailed
+ !

Item was added:
+ ----- Method: IncludedMethodsTest>>decompress:fromByteArray:at: (in category 'primitives') -----
+ decompress: bm fromByteArray: ba at: index
+ 
+ 	<primitive: 'primitiveDecompressFromByteArray' module: 'MiscPrimitivePlugin'>
+ 	self primitiveFailed
+ !

Item was added:
+ ----- Method: IncludedMethodsTest>>findFirstInString:inSet:startingAt: (in category 'primitives') -----
+ findFirstInString: aString  inSet: inclusionMap  startingAt: start
+ 
+ 	<primitive: 'primitiveFindFirstInString' module: 'MiscPrimitivePlugin'>
+ 	self primitiveFailed
+ !

Item was added:
+ ----- Method: IncludedMethodsTest>>findSubstring:in:startingAt:matchTable: (in category 'primitives') -----
+ findSubstring: key in: body startingAt: start matchTable: matchTable
+ 	"Answer the index in the string body at which the substring key first occurs, at or beyond start.  The match is determined using matchTable, which can be used to effect, eg, case-insensitive matches.  If no match is found, zero will be returned."
+ 
+ 	<primitive: 'primitiveFindSubstring' module: 'MiscPrimitivePlugin'>
+ 	self primitiveFailed
+ !

Item was added:
+ ----- Method: IncludedMethodsTest>>indexOfAscii:inString:startingAt: (in category 'primitives') -----
+ indexOfAscii: anInteger inString: aString startingAt: start
+ 
+ 	<primitive: 'primitiveIndexOfAsciiInString' module: 'MiscPrimitivePlugin'>
+ 	self primitiveFailed
+ !

Item was added:
+ ----- Method: IncludedMethodsTest>>mixSampleCount:into:startingAt:leftVol:rightVol: (in category 'primitives') -----
+ mixSampleCount: n into: aSoundBuffer startingAt: startIndex leftVol: leftVol rightVol: rightVol
+ 	"Play samples from a wave table by stepping a fixed amount through the table on every sample. The table index and increment are scaled to allow fractional increments for greater pitch accuracy."
+ 	"(FMSound pitch: 440.0 dur: 1.0 loudness: 0.5) play"
+ 
+ 	<primitive:'primitiveMixFMSound' module:'SoundGenerationPlugin'>
+ 	self primitiveFailed
+ !

Item was added:
+ ----- Method: IncludedMethodsTest>>testCompareWithCollated (in category 'testing - MiscPrimitivePlugin') -----
+ testCompareWithCollated
+ 	"Verify that primitive exists in the VM"
+ 
+ 	self assert: 3 = (self compare: 'foo' with: 'bar' collated: ((0 to: 255) as: ByteArray))
+ !

Item was added:
+ ----- Method: IncludedMethodsTest>>testCompressToByteArray (in category 'testing - MiscPrimitivePlugin') -----
+ testCompressToByteArray
+ 
+ 	| bitmap byteArray |
+ 	bitmap := Bitmap with: 16rFFFFFFFF.
+ 	byteArray := ByteArray new:  4.
+ 	self compress: bitmap toByteArray: byteArray.
+ 	self should: byteArray = #[1 5 255 0]!

Item was added:
+ ----- Method: IncludedMethodsTest>>testConvert8bitSignedFromTo16Bit (in category 'testing - MiscPrimitivePlugin') -----
+ testConvert8bitSignedFromTo16Bit
+ 	"SampledSound class>>convert8bitSignedFrom:to16Bit:"
+ 
+ 
+ 	| aByteArray aSoundBuffer |
+ 	aByteArray := #[1 2 3 4 5 6 7 8 9].
+ 	aSoundBuffer := SoundBuffer newMonoSampleCount: aByteArray size.
+ 	self convert8bitSignedFrom: aByteArray to16Bit: aSoundBuffer.
+ 	self assert: aSoundBuffer = ((SoundBuffer new: 10) at: 1 put: 256; at: 2 put: 512;
+ 		at: 3 put: 768; at: 4 put: 1024; at: 5 put: 1280; at: 6 put: 1536; at: 7 put: 1792;
+ 		at: 8 put: 2048; at: 9 put: 2304; at: 10 put: 0; yourself)!

Item was added:
+ ----- Method: IncludedMethodsTest>>testDecompressFromByteArrayAt (in category 'testing - MiscPrimitivePlugin') -----
+ testDecompressFromByteArrayAt
+ 
+ 	| bitmap byteArray s size |
+ 	byteArray := #(1 5 255  0) asByteArray.
+ 	s := ReadStream on: byteArray.
+ 	size := Bitmap decodeIntFrom: s.
+ 	bitmap := Bitmap new: size.
+ 	self decompress: bitmap fromByteArray: byteArray at: s position + 1.
+ 	self should: bitmap = ((Bitmap new: 1) at: 1 put: 4294967295; yourself)!

Item was added:
+ ----- Method: IncludedMethodsTest>>testFindFirstInStringInSetStartingAt (in category 'testing - MiscPrimitivePlugin') -----
+ testFindFirstInStringInSetStartingAt
+ 
+ 	| position set |
+ 	set := ((0 to: 255) collect: [:e | (e \\ 2) + $0 asciiValue]) asByteArray.
+ 	position := self findFirstInString: 'abcdef' inSet: set startingAt: 1.
+ 	self assert: position = 1
+ !

Item was added:
+ ----- Method: IncludedMethodsTest>>testFindSubstring (in category 'testing - MiscPrimitivePlugin') -----
+ testFindSubstring
+ 	"Verify that primitive exists in the VM and that non byte array arguments cause primitive to fail"
+ 
+ 	| position |
+ 	position := IncludedMethodsTest new
+ 				findSubstring: 'bc'
+ 				in: 'abcdef'
+ 				startingAt: 1
+ 				matchTable: ((0 to: 255)
+ 						as: ByteArray).
+ 	self assert: position = 2.
+ 	self should: [IncludedMethodsTest new
+ 				findSubstring: 'bc' asWideString
+ 				in: 'abcdef'
+ 				startingAt: 1
+ 				matchTable: ((0 to: 255)
+ 						as: ByteArray)]
+ 					raise: Error.
+ 	self should: [IncludedMethodsTest new
+ 				findSubstring: 'bc'
+ 				in: 'abcdef' asWideString
+ 				startingAt: 1
+ 				matchTable: ((0 to: 255)
+ 						as: ByteArray)]
+ 					raise: Error.
+ 	self should: [IncludedMethodsTest new
+ 				findSubstring: 'bc' asWideString
+ 				in: 'abcdef' asWideString
+ 				startingAt: 1
+ 				matchTable: ((0 to: 255)
+ 						as: ByteArray)]
+ 					raise: Error
+ !

Item was added:
+ ----- Method: IncludedMethodsTest>>testIindexOfAsciiInStringStartingAt (in category 'testing - MiscPrimitivePlugin') -----
+ testIindexOfAsciiInStringStartingAt
+ 
+ 	| position |
+ 	position := self indexOfAscii: 50 inString: '012345' startingAt: 1.
+ 	self assert: position = 3!

Item was added:
+ ----- Method: IncludedMethodsTest>>testMixSampleCountIntoStartingAtLeftVolRightVol (in category 'testing - SoundGeneratorPlugin') -----
+ testMixSampleCountIntoStartingAtLeftVolRightVol
+ 
+ 	"mixSampleCount: n into: aSoundBuffer startingAt: startIndex leftVol: leftVol rightVol: rightVol"!

Item was added:
+ ----- Method: IncludedMethodsTest>>testTranslateFromToTable (in category 'testing - MiscPrimitivePlugin') -----
+ testTranslateFromToTable
+ 	"Verify that primitive exists in the VM"
+ 
+ 	| s t |
+ 	s := 'foo' copy. "copy so string is instantiated each time"
+ 	t := ByteArray withAll: ((1 to: 255) as: ByteArray).
+ 	self translate: s from: 1 to: 3 table: t.
+ 	self assert: s = 'gpp'
+ !

Item was added:
+ ----- Method: IncludedMethodsTest>>todoForADPCMCodecPlugin (in category 'testing - ADPCMCodecPlugin') -----
+ todoForADPCMCodecPlugin
+ 	"TODO - write tests for these"
+ 
+ 	^#(
+ 		(ADPCMCodec privateDecodeMono:)
+ 		(ADPCMCodec privateDecodeStereo:)
+ 		(ADPCMCodec privateEncodeMono:)
+ 		(ADPCMCodec privateEncodeStereo:)
+ 		(ADPCMCodec indexForDeltaFrom:to:)
+ 		(ADPCMCodec nextBits:)
+ 		(ADPCMCodec nextBits:put:)
+ 		)!

Item was added:
+ ----- Method: IncludedMethodsTest>>todoForSoundGeneratorPlugin (in category 'testing - SoundGeneratorPlugin') -----
+ todoForSoundGeneratorPlugin
+ 	"TODO - write tests for these"
+ 
+ 	^#(
+ 		(FMSound mixSampleCount:into:startingAt:leftVol:rightVol:)
+ 		(PluckedSound mixSampleCount:into:startingAt:leftVol:rightVol:)
+ 		(LoopedSampledSound mixSampleCount:into:startingAt:leftVol:rightVol:)
+ 		(SampledSound mixSampleCount:into:startingAt:leftVol:rightVol:)
+ 		(ReverbSound applyReverbTo:startingAt:count:)
+ 		)!

Item was added:
+ ----- Method: IncludedMethodsTest>>translate:from:to:table: (in category 'primitives') -----
+ translate: aString from: start  to: stop  table: table
+ 	"translate the characters in the string by the given table, in place"
+ 
+ 	<primitive: 'primitiveTranslateStringWithTable' module: 'MiscPrimitivePlugin'>
+ 	self primitiveFailed!



More information about the Vm-dev mailing list