tests: Add test for ByteArray.writeObject
This commit is contained in:
parent
fe951b4989
commit
e40229d90b
|
@ -211,6 +211,7 @@ swf_tests! {
|
|||
(as3_boolean_tostring, "avm2/boolean_tostring", 1),
|
||||
(as3_bytearray_readobject_amf0, "avm2/bytearray_readobject_amf0", 1),
|
||||
(as3_bytearray_readobject_amf3, "avm2/bytearray_readobject_amf3", 1),
|
||||
(as3_bytearray_writeobject, "avm2/bytearray_writeobject", 1),
|
||||
(as3_bytearray, "avm2/bytearray", 1),
|
||||
(as3_class_call, "avm2/class_call", 1),
|
||||
(as3_class_cast_call, "avm2/class_cast_call", 1),
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
package
|
||||
{
|
||||
import flash.utils.ByteArray;
|
||||
public class Test
|
||||
{
|
||||
var TESTS = [
|
||||
undefined,
|
||||
null,
|
||||
false,
|
||||
true,
|
||||
4,
|
||||
4.5,
|
||||
Infinity,
|
||||
-Infinity,
|
||||
NaN,
|
||||
"test"
|
||||
];
|
||||
|
||||
public function testValue(value) {
|
||||
var ba = new ByteArray();
|
||||
ba.writeObject(value);
|
||||
ba.position = 0;
|
||||
trace(ba.readObject());
|
||||
}
|
||||
public function runTests() {
|
||||
for each(var val in TESTS) {
|
||||
testValue(val);
|
||||
}
|
||||
testValue(TESTS);
|
||||
}
|
||||
public function Test()
|
||||
{
|
||||
trace("AMF3 TESTS");
|
||||
runTests();
|
||||
ByteArray.defaultObjectEncoding = 0;
|
||||
trace("AMF0 TESTS");
|
||||
runTests();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
AMF3 TESTS
|
||||
undefined
|
||||
null
|
||||
false
|
||||
true
|
||||
4
|
||||
4.5
|
||||
Infinity
|
||||
-Infinity
|
||||
NaN
|
||||
test
|
||||
,,false,true,4,4.5,Infinity,-Infinity,NaN,test
|
||||
AMF0 TESTS
|
||||
undefined
|
||||
null
|
||||
false
|
||||
true
|
||||
4
|
||||
4.5
|
||||
Infinity
|
||||
-Infinity
|
||||
NaN
|
||||
test
|
||||
,,false,true,4,4.5,Infinity,-Infinity,NaN,test
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue