2 // Copyright (C) 2005, 2006, 2007, 2008 Free Software,
3 // 2011 Foundation, Inc.// This program is free software; you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation; either version 3 of the License, or
6 // (at your option) any later version.
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 #include "gnashconfig.h"
21 #include "CodeStream.h"
34 using namespace gnash
;
39 main(int /*argc*/, char** /*argv*/)
41 char data
[10] = {0x4,0x1,0x2,0x3,0x4,0x5,0x6,0x7,0x8,0x9};
43 CodeStream
* stream
= new CodeStream(std::string(data
,10));
46 boost::uint8_t opcode
;
48 while(opcode
= stream
->read_as3op()){
49 check_equals(opcode
,data
[i
]);
53 //Make sure we stopped at the right spot.
63 opcode
= stream
->read_as3op();
64 check_equals(opcode
,data
[5]);
73 opcode
= stream
->read_u8();
74 check_equals(opcode
,data
[i
]);
78 char newData
[6] = {0x5,0xC5,0x0,0x0,0x1,0x2};
79 CodeStream
* streamA
= new CodeStream(std::string(newData
,6));
81 boost::uint8_t byteA
= streamA
->read_u8();
82 check_equals(byteA
,newData
[0]);
85 boost::int32_t byteB
= streamA
->read_S24();
86 check_equals(byteB
,197);