gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog testsuite/libamf.all/Makefile.a...


From: Rob Savoye
Subject: [Gnash-commit] gnash ChangeLog testsuite/libamf.all/Makefile.a...
Date: Fri, 16 Mar 2007 19:35:12 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Rob Savoye <rsavoye>    07/03/16 19:35:12

Modified files:
        .              : ChangeLog 
        testsuite/libamf.all: Makefile.am test_object.cpp 
        libamf         : amf.cpp amf.h 
Added files:
        testsuite/libamf.all: number-variable.amf string-variable.amf 
                              test_variable.cpp 

Log message:
                * testsuite/libamf.all/string-variable.amf:  Binary test case 
for
                string variables.
                * testsuite/libamf.all/number-variable.amf: Binary test case for
                numeric variables.
                * testsuite/libamf.all/test_variable.cpp: Test case for encoding
                and decoding variable assignments which as used in AMF objects.
                * libamf/amf.cpp, amf.h: Add support for encoding variables. 
Make
                extractVariables actually set the fields of the element so they
                have some value when returned.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2613&r2=1.2614
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/libamf.all/Makefile.am?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/libamf.all/test_object.cpp?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/libamf.all/number-variable.amf?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/libamf.all/string-variable.amf?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/libamf.all/test_variable.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/libamf/amf.cpp?cvsroot=gnash&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/gnash/libamf/amf.h?cvsroot=gnash&r1=1.12&r2=1.13

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2613
retrieving revision 1.2614
diff -u -b -r1.2613 -r1.2614
--- ChangeLog   16 Mar 2007 16:40:17 -0000      1.2613
+++ ChangeLog   16 Mar 2007 19:35:12 -0000      1.2614
@@ -1,3 +1,32 @@
+2007-03-16  Rob Savoye  <address@hidden>
+
+       * testsuite/libamf.all/string-variable.amf:  Binary test case for
+       string variables.
+       * testsuite/libamf.all/number-variable.amf: Binary test case for
+       numeric variables.
+       * testsuite/libamf.all/test_variable.cpp: Test case for encoding
+       and decoding variable assignments which as used in AMF objects.
+       * libamf/amf.cpp, amf.h: Add support for encoding variables. Make
+       extractVariables actually set the fields of the element so they
+       have some value when returned.
+       
+       * libamf/amf.cpp, amf.h: Use capitols for enum values. Fix
+       encoding and decoding of numbers, strings, and objects.
+       * libamf/rtmp.cpp, rtmp.h: Use capitols for enum values. 
+       * libamf/Makefile.am: Remove amftest.cpp, it's now in testsuites
+       where it belongs.
+       * testsuite/Makefile.am: Add libamf.all directory.
+       * testsuite/libamf.all/Makefile.am: Build test cases, do "make
+       check".
+       * testsuite/libamf.all/test_number.cpp: Test case for AMF numbers.
+       * testsuite/libamf.all/test_object.cpp: Test case for AMF objects.
+       * testsuite/libamf.all/test_string.cpp: Test case for AMF strings.
+       * testsuite/libamf.all/f03f.amf: Binary test file for number format.
+       * testsuite/libamf.all/connect-object.amf: Binary test file for
+       object format. 
+       * testsuite/libamf.all/connect-string.amf: Binary test file for
+       string format.
+
 2007-03-16 Sandro Santilli <address@hidden>
 
        * testsuite/actionscript.all/: Function.as, Inheritance.as:
@@ -11,7 +40,7 @@
 
 2007-03-16 Sandro Santilli <address@hidden>
 
-       * server/as_value.{cpp,h}: deprecate operator+=, implement valueOf
+       * server/as_value.{cpp,h}: depreciate operator+=, implement valueOf
          calling.
        * server/vm/ASHandlers.cpp (ActionNewAdd): pass environment over
          calls to as_value::to_number, for properly calling valueOf.
@@ -21,7 +50,7 @@
 
 2007-03-16 Zou Lunkai <address@hidden>
 
-       * testsuite/misc-ming.all/action_execution_order_test4.c.
+       * tesrttsuite/misc-ming.all/action_execution_order_test4.c.
        * testsuite/misc-ming.all/action_execution_order_test5.c.
          add 2 more testcases to verify actions execution order.
          

Index: testsuite/libamf.all/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/testsuite/libamf.all/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- testsuite/libamf.all/Makefile.am    16 Mar 2007 15:00:49 -0000      1.1
+++ testsuite/libamf.all/Makefile.am    16 Mar 2007 19:35:12 -0000      1.2
@@ -15,7 +15,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-# $Id: Makefile.am,v 1.1 2007/03/16 15:00:49 rsavoye Exp $
+# $Id: Makefile.am,v 1.2 2007/03/16 19:35:12 rsavoye Exp $
 
 AUTOMAKE_OPTIONS = dejagnu
 
@@ -45,13 +45,15 @@
 # AM_LDFLAGS  = $(OPENGL_LIBNS) $(SDL_LIBS)
 
 
-check_PROGRAMS = test_number test_string test_object
+check_PROGRAMS = test_number test_string test_object test_variable
 test_number_SOURCES = test_number.cpp
 test_number_LDADD = $(AM_LDFLAGS)
 test_string_SOURCES = test_string.cpp
 test_string_LDADD = $(AM_LDFLAGS)
 test_object_SOURCES = test_object.cpp
 test_object_LDADD = $(AM_LDFLAGS)
+test_variable_SOURCES = test_variable.cpp
+test_variable_LDADD = $(AM_LDFLAGS)
 
 
 # Rebuild with GCC 4.x Mudflap support

Index: testsuite/libamf.all/test_object.cpp
===================================================================
RCS file: /sources/gnash/gnash/testsuite/libamf.all/test_object.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- testsuite/libamf.all/test_object.cpp        16 Mar 2007 15:00:49 -0000      
1.1
+++ testsuite/libamf.all/test_object.cpp        16 Mar 2007 19:35:12 -0000      
1.2
@@ -44,14 +44,6 @@
 
 TestState runtest;
 
-void test_Number(void);
-void test_Boolean(void);
-void test_String(void);
-
-void test_Header(void);
-void test_Body(void);
-void test_Packet(void);
-
 // These are used to print more intelligent debug messages
 const char *astype_str[] = {
     "Number",

Index: libamf/amf.cpp
===================================================================
RCS file: /sources/gnash/gnash/libamf/amf.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- libamf/amf.cpp      16 Mar 2007 15:00:49 -0000      1.25
+++ libamf/amf.cpp      16 Mar 2007 19:35:12 -0000      1.26
@@ -16,7 +16,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: amf.cpp,v 1.25 2007/03/16 15:00:49 rsavoye Exp $ */
+/* $Id: amf.cpp,v 1.26 2007/03/16 19:35:12 rsavoye Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -262,13 +262,6 @@
     return x;
 }
 
-bool
-AMF::readObject(void * /* in */)
-{
-    GNASH_REPORT_FUNCTION;
-               return true;
-    
-}
 
 /// \brief Write an AMF element
 ///
@@ -688,6 +681,91 @@
     return num;
 }
 
+void *
+AMF::encodeVariable(amf_element_t &el)
+{
+    GNASH_REPORT_FUNCTION;
+}
+
+void *
+AMF::encodeVariable(const char *name, amfnum_t bignum)
+{
+    GNASH_REPORT_FUNCTION;
+    int outsize = strlen(name) + AMF_NUMBER_SIZE + 5;
+    char *out = new char[outsize];
+    char *tmpptr = out;
+    short length;
+    amfnum_t newnum = bignum;
+    char *numptr = (char *)&newnum;
+
+    length = strlen(name);
+    swapBytes(&length, 2);
+    memcpy(tmpptr, &length, 2);
+    tmpptr += 2;
+    strcpy(tmpptr, name);
+    tmpptr += strlen(name);
+    *tmpptr = AMF::NUMBER;
+    tmpptr++;
+//    swapBytes(numptr, AMF_NUMBER_SIZE);
+    memcpy(tmpptr, numptr, AMF_NUMBER_SIZE);
+
+    return out;    
+}
+
+void *
+AMF::encodeVariable(const char *name, const char *val)
+{
+    GNASH_REPORT_FUNCTION;
+
+    int outsize = strlen(name) + strlen(val) + 5;
+    char *out = new char[outsize];
+    char *tmpptr = out;
+    short length;
+
+    length = strlen(name);
+    swapBytes(&length, 2);
+    memcpy(tmpptr, &length, 2);
+    tmpptr += 2;
+    strcpy(tmpptr, name);
+    tmpptr += strlen(name);
+    *tmpptr = AMF::STRING;
+    tmpptr++;
+    length = strlen(val);
+    swapBytes(&length, 2);
+    memcpy(tmpptr, &length, 2);
+    tmpptr += 2;
+    strcpy(tmpptr, val);
+
+    return out;
+}
+
+void *
+AMF::encodeVariable(std::string &name, std::string &val)
+{
+    GNASH_REPORT_FUNCTION;
+
+    int outsize = name.size() + val.size() + 5;
+    unsigned char *out = new unsigned char[outsize];
+    unsigned char *tmpptr = out;
+    short length;
+
+    length = name.size() && 0xffff;
+    swapBytes(&length, 2);
+    memcpy(tmpptr, &length, 2);
+    tmpptr += 2;
+    memcpy(tmpptr, name.c_str(), name.size());
+    tmpptr += name.size();
+    *tmpptr = AMF::STRING;
+    tmpptr++;
+    length = val.size() && 0xffff;
+    swapBytes(&length, 2);
+    memcpy(tmpptr, &length, 2);
+    tmpptr += 2;
+    memcpy(tmpptr, val.c_str(), name.size());
+
+    return out;
+}
+
 int
 AMF::headerSize(char header)
 {
@@ -898,7 +976,7 @@
               break;
           case OBJECT:
               do {
-                  tmpptr = extractVariables(el, tmpptr);
+                  tmpptr = extractVariables(&el, tmpptr);
               } while (el.type != AMF::OBJECT_END);
               break;
           case MOVIECLIP:
@@ -927,7 +1005,7 @@
 }
 
 unsigned char *
-AMF::extractVariables(amf_element_t &el, unsigned char *in)
+AMF::extractVariables(amf_element_t *el, unsigned char *in)
 {
     GNASH_REPORT_FUNCTION;
     
@@ -935,22 +1013,22 @@
     unsigned char *tmpptr = in;
     short length = 0;
 
-    el.length = 0;
-    el.name.erase();
-    if (el.data) {
-        el.data = 0;
+    el->length = 0;
+    el->name.erase();
+    if (el->data) {
+        el->data = 0;
     }
     
     memset(buffer, 0, 300);
     // @@ casting generic pointers to bigger types may be dangerous
     //    due to memory alignment constraints
     length = ntohs((*(const short *)tmpptr) & 0xffff);
-    el.length = length;
+    el->length = length;
     if (length == 0) {
         if (*(tmpptr+2) == AMF::OBJECT_END) {
             dbglogfile << "End of Object definition." << endl;
-            el.length = 0;
-            el.type = AMF::OBJECT_END;
+            el->length = 0;
+            el->type = AMF::OBJECT_END;
             tmpptr+=3;
             return tmpptr;
         }
@@ -966,40 +1044,45 @@
     if (length > 0) {
         dbglogfile << "AMF element length is: " << length << endl;
         memcpy(buffer, tmpptr, length);
-        el.name = reinterpret_cast<char *>(buffer);
+        el->name = reinterpret_cast<char *>(buffer);
         tmpptr += length;
     }
     
 //    dbglogfile << "AMF element name is: " << buffer << endl;
-    char type = *(const astype_e *)tmpptr++;
+    astype_e type = (astype_e)((*tmpptr++) & 0xff);
 
     if (type <= AMF::TYPED_OBJECT) {
         dbglogfile << "AMF type is: " << astype_str[(int)type] << endl;
+       el->type = type;
     }
     
-    switch ((astype_e)type) {
+    
+    switch (type) {
       case NUMBER:
           memcpy(buffer, tmpptr, AMF_NUMBER_SIZE);
           swapBytes(buffer, AMF_NUMBER_SIZE);
+          el->data = new unsigned char[AMF_NUMBER_SIZE+1];
+         memset((void *)el->data, 0, AMF_NUMBER_SIZE+1);
+          memcpy((void *)el->data, buffer, AMF_NUMBER_SIZE);
           unsigned char hexint[AMF_NUMBER_SIZE*3];
-          hexify((unsigned char *)hexint, (unsigned char *)tmpptr, 
AMF_NUMBER_SIZE, false);
-          dbglogfile << "Number \"" << el.name.c_str() << "\" is: 0x" << 
hexint << endl;
+          hexify((unsigned char *)hexint, (unsigned char *)buffer, 
AMF_NUMBER_SIZE, false);
+          dbglogfile << "Number \"" << el->name.c_str() << "\" is: 0x" << 
hexint << endl;
 //          amfnum_t *num = extractNumber(tmpptr);
           tmpptr += 8;
           break;
       case BOOLEAN:
 //          int value = *tmpptr;
-           el.data = (const unsigned char*)tmpptr; 
-           dbglogfile << "Boolean \"" << el.name.c_str() << "\" is: " << ( 
(*tmpptr == 0) ? "true" :"false") << endl;
+           el->data = (const unsigned char*)tmpptr; 
+           dbglogfile << "Boolean \"" << el->name.c_str() << "\" is: " << ( 
(*tmpptr == 0) ? "true" :"false") << endl;
            tmpptr += 1;
            break;
       case STRING:
-          length = ntohs(*reinterpret_cast<const short *>(tmpptr)); // @@ this 
cast is dangerous due to memory alignment constraints
+         length = ntohs((*(const short *)tmpptr) & 0xffff);
           tmpptr += sizeof(short);
-          el.data = (const unsigned char*)tmpptr; 
-          dbglogfile << "Variable \"" << el.name.c_str() << "\" is: " << 
el.data << endl;
+          el->data = (const unsigned char*)tmpptr; 
+          dbglogfile << "Variable \"" << el->name.c_str() << "\" is: " << 
el->data << endl;
           tmpptr += length;
-          el.length = length;
+          el->length = length;
           break;
       case OBJECT:
       case MOVIECLIP:
@@ -1009,10 +1092,10 @@
       case ECMA_ARRAY:
       case OBJECT_END:
           dbglogfile << "End of Object definition." << endl;
-          el.name.erase();
-          el.length = 0;
-          el.data = 0;
-          el.type = AMF::OBJECT_END;
+          el->name.erase();
+          el->length = 0;
+          el->data = 0;
+          el->type = AMF::OBJECT_END;
           break;
       case STRICT_ARRAY:
       case DATE:

Index: libamf/amf.h
===================================================================
RCS file: /sources/gnash/gnash/libamf/amf.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- libamf/amf.h        16 Mar 2007 15:00:49 -0000      1.12
+++ libamf/amf.h        16 Mar 2007 19:35:12 -0000      1.13
@@ -188,12 +188,16 @@
         return encodeElement (NUMBER, &num, AMF_NUMBER_SIZE);
     };
     
+    void *encodeVariable(amf_element_t &el);
+    void *encodeVariable(const char *name, amfnum_t num);
+    void *encodeVariable(std::string &name, std::string &val);
+    void *encodeVariable(const char *name, const char *val);
+    
 //     amfhead_t *encodeHeader(amfutf8_t *name, bool required, int nbytes, 
void *data);
 //     amfbody_t *encodeBody(amfutf8_t *target, amfutf8_t *response, int 
nbytes, void *data);
 //    amfpacket_t *encodePacket(std::vector<amfhead_t *> messages);
 
     char *readElement(void *in);
-    bool readObject(void *in);
     
     astype_e extractElementHeader(void *in);
     int extractElementLength(void *in);
@@ -201,7 +205,8 @@
     amfnum_t *extractNumber(const char *in);
     amf_element_t *extractObject(const char *in);
 
-    unsigned char *extractVariables(amf_element_t &el, unsigned char *in);
+    
+    unsigned char *extractVariables(amf_element_t *el, unsigned char *in);
     
     bool parseAMF(char *in);
     static int headerSize(char header);
@@ -224,7 +229,7 @@
     
  private:
     content_types_e     _type;
-//    std::map<std::string, amf_element_t &> _elements;
+    std::map<std::string, amf_element_t *> _elements;
     int                 _amf_index;
     int                 _header_size;
     int                 _total_size;

Index: testsuite/libamf.all/number-variable.amf
===================================================================
RCS file: testsuite/libamf.all/number-variable.amf
diff -N testsuite/libamf.all/number-variable.amf
Binary files /dev/null and /tmp/cvs8Rw0Xc differ

Index: testsuite/libamf.all/string-variable.amf
===================================================================
RCS file: testsuite/libamf.all/string-variable.amf
diff -N testsuite/libamf.all/string-variable.amf
Binary files /dev/null and /tmp/cvs57uWRf differ

Index: testsuite/libamf.all/test_variable.cpp
===================================================================
RCS file: testsuite/libamf.all/test_variable.cpp
diff -N testsuite/libamf.all/test_variable.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ testsuite/libamf.all/test_variable.cpp      16 Mar 2007 19:35:12 -0000      
1.1
@@ -0,0 +1,231 @@
+// 
+//   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef HAVE_DEJAGNU_H
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <log.h>
+#include <string>
+#include <iostream>
+#include <string>
+
+#include "dejagnu.h"
+#include "rtmp.h"
+#include "amf.h"
+
+using namespace amf;
+using namespace gnash;
+using namespace std;
+
+static void usage (void);
+
+static int verbosity;
+
+TestState runtest;
+
+// These are used to print more intelligent debug messages
+const char *astype_str[] = {
+    "Number",
+    "Boolean",
+    "String",
+    "Object",
+    "MovieClip",
+    "Null",
+    "Undefined",
+    "Reference",
+    "ECMAArray",
+    "ObjectEnd",
+    "StrictArray",
+    "Date",
+    "LongString",
+    "Unsupported",
+    "Recordset",
+    "XMLObject",
+    "TypedObject"
+};
+
+int
+main(int argc, char *argv[])
+{
+    bool dump = false;
+    char buffer[300];
+    int c, retries = 3;
+
+    memset(buffer, 0, 300);
+    
+    while ((c = getopt (argc, argv, "hdvsm:")) != -1) {
+        switch (c) {
+          case 'h':
+            usage ();
+            break;
+            
+          case 'v':
+            verbosity++;
+            break;
+            
+          default:
+            usage ();
+            break;
+        }
+    }
+
+    // get the file name from the command line
+    if (optind < argc) {
+        string filespec = argv[optind];
+        cout << "Will use \"" << filespec << "\" for test " << endl;
+    }
+
+    AMF amf_obj;
+    int fd, ret;
+    unsigned char buf[AMF_PACKET_SIZE+1];
+    unsigned char *tmpptr;
+    short length;
+    AMF::amf_element_t el;
+
+    // First see if we can read variables. This file is produced by
+    // using a network packet sniffer, and should be binary correct.
+    memset(buf, 0, AMF_PACKET_SIZE+1);
+    string filespec = SRCDIR;
+    filespec += "/string-variable.amf";
+    fd = open(filespec.c_str(), O_RDONLY);
+    if (fd <= 0) {
+        cerr << "Couldn't open the binary test file!" << endl;
+        exit(1);
+    }
+    
+    ret = read(fd, buf, AMF_PACKET_SIZE);
+    close(fd);
+
+    if (amf_obj.extractVariables(&el, buf)) {
+        runtest.pass("Got String element");
+    } else {
+        runtest.fail("Got String element");
+    }  
+
+    if ((el.type == amf::AMF::STRING) && (el.length == 25) && (el.name == 
"tcUrl")) {
+        runtest.pass("Got String element data");
+    } else {
+        runtest.fail("Got String element data");
+    }  
+
+    char *out = (char *)amf_obj.encodeVariable("tcUrl", 
"rtmp://localhost/oflaDemo");
+    if ((out[1] == 0x5)
+        && (out[2] == 't')
+        && (out[3] == 'c')
+        && (out[4] == 'U')
+        && (out[5] == 'r')
+        && (out[6] == 'l')) {
+        runtest.pass("String Variable name correct");
+    } else {
+        runtest.fail("String Variable name correct");
+    }    
+
+    if ((out[7] == AMF::STRING)
+        && (out[8] == 0x0)
+        && (out[9] == 25)
+        && (out[10] == 'r')
+        && (out[11] == 't')
+        && (out[12] == 'm')
+        && (out[13] == 'p')
+        && (out[14] == ':')) {
+        runtest.pass("Variable String data correct");
+    } else {
+        runtest.fail("Variable String data correct");
+    }
+
+    if (memcmp(buf, out, 0x15) == 0) {
+        runtest.pass("String Packets match");
+    } else {
+        runtest.fail("String Packets match");
+    }
+    
+    delete out;
+    
+    // Test number fields
+    memset(buf, 0, AMF_PACKET_SIZE+1);
+    filespec = SRCDIR;
+    filespec += "/number-variable.amf";
+    fd = open(filespec.c_str(), O_RDONLY);
+    ret = read(fd, buf, AMF_PACKET_SIZE);
+    close(fd);
+
+    if (amf_obj.extractVariables(&el, buf)) {
+        runtest.pass("Got Number element");
+    } else {
+        runtest.fail("Got Number element");
+    }  
+
+    if ((el.type == amf::AMF::NUMBER)
+        && (el.name == "audioCodecs")
+        && (el.data[5] == 0x38)
+        && (el.data[6] == 0x83)
+        && (el.data[7] == 0x40)) {
+        runtest.pass("Got Number element data");
+    } else {
+        runtest.fail("Got Number element data");
+    }
+    
+    amfnum_t bignum = 0x388340L;
+    char *numptr = (char *)&bignum;
+    out = (char *)amf_obj.encodeVariable("audioCodecs", bignum);
+    if ((out[1] == 11)
+        && (out[2] == 'a')
+        && (out[3] == 'u')
+        && (out[4] == 'd')
+        && (out[5] == 'i')
+        && (out[6] == 'o')) {
+        runtest.pass("Number Variable name correct");
+    } else {
+        runtest.fail("Number Variable name correct");
+    }
+    
+    if ((out[13] == AMF::NUMBER)
+        && (out[14] == 0x40)
+        && (out[15] == -125)
+        && (out[16] == 0x38)) {
+        runtest.pass("Variable Number data correct");
+    } else {
+        runtest.fail("Variable Number data correct");
+    }
+
+    if (memcmp(buf, out, 0x15) == 0) {
+        runtest.pass("Number Packets match");
+    } else {
+        runtest.fail("Number Packets match");
+    }
+
+    delete out;
+}
+
+static void
+usage (void)
+{
+    cerr << "This program tests AMF variables in the AMF library." << endl;
+    cerr << "Usage: test_variable [hv]" << endl;
+    cerr << "-h\tHelp" << endl;
+    cerr << "-v\tVerbose" << endl;
+    exit (-1);
+}
+
+#endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]