Add types of BufferSource
This commit is contained in:
parent
81ec8a9891
commit
6303c66f51
1 changed files with 5 additions and 5 deletions
|
@ -79,21 +79,21 @@ make.typed = {
|
|||
])
|
||||
return random.chance(10) ? -value : value
|
||||
},
|
||||
arrayBuffer: function(byteLength = null) {
|
||||
arrayBuffer: function (byteLength = null) {
|
||||
let length = (byteLength !== null) ? byteLength : this.unsignedShort()
|
||||
return 'new ArrayBuffer(' + length + ')'
|
||||
},
|
||||
dataView: function(byteLength = null) {
|
||||
dataView: function (byteLength = null) {
|
||||
let length = (byteLength !== null) ? byteLength : this.unsignedShort()
|
||||
return 'new DataView(' + this.arrayBuffer(length) + ')'
|
||||
},
|
||||
typedArray: function(byteLength = null) {
|
||||
typedArray: function (byteLength = null) {
|
||||
let length = (byteLength !== null) ? byteLength : this.unsignedShort()
|
||||
let arrType = random.item([
|
||||
'Int8', 'Uint8', 'Uint8Clamped',
|
||||
'Int16', 'Uint16',
|
||||
'Int32', 'Uint32',
|
||||
'Float32', 'Float64',
|
||||
'Float32', 'Float64'
|
||||
])
|
||||
let method = 'new ' + arrType + 'Array'
|
||||
switch (random.number(16)) {
|
||||
|
@ -105,7 +105,7 @@ make.typed = {
|
|||
return method + '(' + length + ')'
|
||||
}
|
||||
},
|
||||
bufferSource: function() {
|
||||
bufferSource: function () {
|
||||
return random.choose([
|
||||
[1, [this.arrayBuffer, this.dataView]],
|
||||
[1, [this.typedArray]]
|
||||
|
|
Loading…
Reference in a new issue