2
// Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
4
// This program is free software; you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation; either version 3 of the License, or
7
// (at your option) any later version.
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
// GNU General Public License for more details.
14
// You should have received a copy of the GNU General Public License
15
// along with this program; if not, write to the Free Software
16
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
#include "gnashconfig.h"
24
//#include <netinet/in.h>
26
#include <sys/types.h>
35
extern int optind, getopt(int, char *const *, const char *);
39
#include <sys/types.h>
51
using namespace gnash;
54
static void usage (void);
58
static TestState runtest;
63
main(int argc, char *argv[])
67
while ((c = getopt (argc, argv, "hdvsm:")) != -1) {
95
char *buf[AMF_NUMBER_SIZE+1];
96
memset(buf, 0, AMF_NUMBER_SIZE+1);
97
string filespec = SRCDIR;
98
filespec += "/f03f.amf";
99
fd = open(filespec.c_str(), O_RDONLY);
100
ret = read(fd, buf, AMF_NUMBER_SIZE);
103
// num = amf_obj.extractNumber(buf);
104
ptr = amf_obj.extractVariable(&el, reinterpret_cast<boost::uint8_t *>(buf));
106
if (el.getType() == Element::NUMBER) {
107
runtest.pass("Extracted Number AMF object");
109
runtest.fail("Extracted Number AMF object");
112
void *out = amf_obj.encodeNumber(num);
114
if (memcmp(out, buf, 9) == 0) {
115
runtest.pass("Encoded AMF Number");
117
runtest.fail("Encoded AMF Number");
124
cerr << "This program tests Number support in the AMF library." << endl;
125
cerr << "Usage: test_number [hv]" << endl;
126
cerr << "-h\tHelp" << endl;
127
cerr << "-v\tVerbose" << endl;
134
main(int /*argc*/, char /* *argv[]*/)