CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/08/27 15:18:28
Modified files: . : ChangeLog testsuite/server: StreamTest.cpp Log message: * testsuite/server/StreamTest.cpp: more read_uint() tests. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4116&r2=1.4117 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/server/StreamTest.cpp?cvsroot=gnash&r1=1.3&r2=1.4 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.4116 retrieving revision 1.4117 diff -u -b -r1.4116 -r1.4117 --- ChangeLog 27 Aug 2007 12:44:27 -0000 1.4116 +++ ChangeLog 27 Aug 2007 15:18:27 -0000 1.4117 @@ -1,5 +1,9 @@ 2007-08-27 Sandro Santilli <[EMAIL PROTECTED]> + * testsuite/server/StreamTest.cpp: more read_uint() tests. + +2007-08-27 Sandro Santilli <[EMAIL PROTECTED]> + * server/cxform.cpp, server/font.cpp, server/matrix.cpp, server/stream.h, server/parser/button_character_def.cpp, server/parser/edit_text_character_def.cpp, Index: testsuite/server/StreamTest.cpp =================================================================== RCS file: /sources/gnash/gnash/testsuite/server/StreamTest.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -b -r1.3 -r1.4 --- testsuite/server/StreamTest.cpp 27 Aug 2007 12:09:05 -0000 1.3 +++ testsuite/server/StreamTest.cpp 27 Aug 2007 15:18:28 -0000 1.4 @@ -64,10 +64,13 @@ static int readFunc(void* dst, int bytes, void* appdata) { - assert(bytes == 1); ByteReader* br = (ByteReader*) appdata; - memcpy(dst, &(br->b), sizeof(unsigned char)); + unsigned char* ptr = static_cast<unsigned char*>(dst); + for (int i=0; i<bytes; ++i) + { + memcpy(ptr+i, &(br->b), sizeof(unsigned char)); + } return 1; } @@ -247,6 +250,45 @@ ret = s.read_bit(); check_equals(ret, 0); ret = s.read_bit(); check_equals(ret, 1); + /// bits: 10011001 10011001 (0x999999) + + int16_t s16 = s.read_s16(); check_equals(s16, (int16_t)0x9999); + uint16_t u16 = s.read_u16(); check_equals(u16, (uint16_t)0x9999); + int32_t s32 = s.read_s32(); check_equals(s32, (int32_t)0x99999999); + uint32_t u32 = s.read_u32(); check_equals(u32, (uint32_t)0x99999999); + + /// bits: 10011001 10011001 10011001 10011001 (0x99999999) + /// - + /// ------- -------- -- + /// -------- + + s.align(); + ret = s.read_bit(); check_equals(ret, 1); + u16 = s.read_uint(17); check_equals(u16, 26214); + u16 = s.read_uint(7); check_equals(u16, 51); + + /// bits: 10011001 10011001 10011001 10011001 (0x99999999) + /// - + /// ------- -------- + /// ---------- + + s.align(); + ret = s.read_bit(); check_equals(ret, 1); + u16 = s.read_uint(15); check_equals(u16, 6553); + u16 = s.read_uint(9); check_equals(u16, 307); + + /// bits: 10011001 10011001 10011001 10011001 (0x99999999) + /// - + /// ------- -------- --- + /// ----- ----- + /// --- + + s.align(); + ret = s.read_bit(); check_equals(ret, 1); + u32 = s.read_uint(18); check_equals(u32, 52428); + u16 = s.read_uint(10); check_equals(u16, 819); + u16 = s.read_uint(3); check_equals(u16, 1); + return 0; } _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit