2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 // Free Software Foundation, Inc.
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 #include "gnashconfig.h"
23 #include "CodeStream.h"
36 using namespace gnash
;
41 main(int /*argc*/, char** /*argv*/)
43 char data
[10] = {0x4,0x1,0x2,0x3,0x4,0x5,0x6,0x7,0x8,0x9};
45 CodeStream
* stream
= new CodeStream(std::string(data
,10));
50 while(opcode
= stream
->read_as3op()){
51 check_equals(opcode
,data
[i
]);
55 //Make sure we stopped at the right spot.
65 opcode
= stream
->read_as3op();
66 check_equals(opcode
,data
[5]);
75 opcode
= stream
->read_u8();
76 check_equals(opcode
,data
[i
]);
80 char newData
[6] = {0x5,0xC5,0x0,0x0,0x1,0x2};
81 CodeStream
* streamA
= new CodeStream(std::string(newData
,6));
83 std::uint8_t byteA
= streamA
->read_u8();
84 check_equals(byteA
,newData
[0]);
87 std::int32_t byteB
= streamA
->read_S24();
88 check_equals(byteB
,197);