2
// Copyright (C) 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
20
#include "gnashconfig.h"
39
#include <boost/cstdint.hpp>
55
using namespace gnash;
56
using namespace boost;
60
//LogFile& dbglogfile = LogFile::getDefaultInstance();
63
main (int /*argc*/, char** /*argv*/) {
64
gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
65
dbglogfile.setVerbosity();
70
// populate the buffer
71
boost::uint8_t *ptr = buf.reference();
72
for (size_t i=1; i< buf.size(); i++) {
76
// boost::uint8_t *test = new uint8_t[6];
77
// memcpy(test, "hell", 4);
79
// Push one buffer on the fifo. The default is the incoming fifo,
80
// which is the one where data flows from the network to the queue.
82
if (que.size() == 1) {
83
runtest.pass ("CQue::push(Buffer *)");
85
runtest.fail ("CQue::push(Buffer *)");
88
// Test push. When dumpimg, the second address should be different than the first,
89
// as well as the size. The outgoing queue should be uneffected.
93
if (que.size() == 2) {
94
runtest.pass ("CQue::pushin(Buffer *)");
96
runtest.fail ("CQue::pushin(Buffer *)");
101
if (que.size() == 0) {
102
runtest.pass ("CQue::clearall()");
104
runtest.fail ("CQue::clearall()");
109
Buffer *buf2 = que.peek();
110
if ((buf2 == &buf) && (que.size() == 1)) {
111
runtest.pass ("CQue::peek()");
113
runtest.fail ("CQue::peek()");
116
Buffer *buf3 = que.peek();
117
if ((buf3 == &buf) && (que.size() == 1)) {
118
runtest.pass ("CQue::pop()");
120
runtest.fail ("CQue::pop()");
125
size_t firstsize = que.size();
127
if (que.size() == firstsize - 1) {
128
runtest.pass ("CQue::remove()");
130
runtest.fail ("CQue::remove()");
133
// Make some test buffers
134
Buffer merge1, merge2, merge3;
136
ptr = merge1.reference();
137
for (i=0; i<gnash::NETBUFSIZE; i++) {
142
ptr = merge2.reference();
143
for (i=0; i<gnash::NETBUFSIZE; i++) {
149
ptr = merge3.reference();
150
for (i=0; i<96; i++) {
155
// A merge gives us one big buffer where there were several buffers
156
Buffer *foo = que.merge(&merge1);
157
if (foo->size() == (gnash::NETBUFSIZE * 2) + 96) {
158
runtest.pass ("CQue::merge()");
160
runtest.fail ("CQue::merge()");