summaryrefslogtreecommitdiffstats
path: root/utests
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2025-03-02 18:37:22 +0900
committerMichele Calgaro <[email protected]>2025-03-06 12:31:12 +0900
commit44ef0bd5fe47a43e47aec5f7981b6c1d728dd9a8 (patch)
tree2b29e921a9bccea53444ed9bbed06a25a5fe20cc /utests
parentd1f24dae035c506d945ca13f2be398aa0a4de8cc (diff)
downloadktorrent-44ef0bd5fe47a43e47aec5f7981b6c1d728dd9a8.tar.gz
ktorrent-44ef0bd5fe47a43e47aec5f7981b6c1d728dd9a8.zip
Restructure source files into 'src' subfolderHEADmaster
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'utests')
-rw-r--r--utests/Makefile.am12
-rw-r--r--utests/biginttest.cpp82
-rw-r--r--utests/biginttest.h42
-rw-r--r--utests/dhtmsgparsetest.cpp108
-rw-r--r--utests/dhtmsgparsetest.h44
-rw-r--r--utests/difflehellmantest.cpp58
-rw-r--r--utests/difflehellmantest.h44
-rw-r--r--utests/main.cpp52
-rw-r--r--utests/rc4test.cpp95
-rw-r--r--utests/rc4test.h46
-rw-r--r--utests/testrunner.cpp76
-rw-r--r--utests/testrunner.h45
-rw-r--r--utests/unittest.cpp33
-rw-r--r--utests/unittest.h47
-rw-r--r--utests/upnpparsedescriptiontest.cpp433
-rw-r--r--utests/upnpparsedescriptiontest.h44
-rw-r--r--utests/upnpparseresponsetest.cpp66
-rw-r--r--utests/upnpparseresponsetest.h44
18 files changed, 0 insertions, 1371 deletions
diff --git a/utests/Makefile.am b/utests/Makefile.am
deleted file mode 100644
index 78de5ad..0000000
--- a/utests/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-INCLUDES = -I$(srcdir)/../libktorrent -I$(srcdir)/.. $(all_includes)
-METASOURCES = AUTO
-noinst_HEADERS = unittest.h testrunner.h upnpparsedescriptiontest.h \
- upnpparseresponsetest.h dhtmsgparsetest.h biginttest.h rc4test.h difflehellmantest.h
-bin_PROGRAMS = ktutester
-ktutester_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_TQT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor
-ktutester_SOURCES = unittest.cpp testrunner.cpp main.cpp \
- upnpparsedescriptiontest.cpp upnpparseresponsetest.cpp dhtmsgparsetest.cpp biginttest.cpp \
- rc4test.cpp difflehellmantest.cpp
-ktutester_LDADD = ../plugins/upnp/libktupnp.la \
- ../libktorrent/libktorrent.la
-KDE_CXXFLAGS = $(USE_EXCEPTIONS) $(USE_RTTI)
diff --git a/utests/biginttest.cpp b/utests/biginttest.cpp
deleted file mode 100644
index 514663e..0000000
--- a/utests/biginttest.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2005 by Joris Guisson *
- * *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-#include <stdio.h>
-#include <mse/bigint.h>
-#include <util/log.h>
-#include <torrent/globals.h>
-#include "biginttest.h"
-
-using namespace bt;
-using namespace mse;
-
-namespace utest
-{
-
- BigIntTest::BigIntTest() : UnitTest("BigIntTest")
- {}
-
-
- BigIntTest::~BigIntTest()
- {}
-
- static void PrintBigInt(BigInt & b)
- {
- Uint8 buf[10];
- memset(buf,0,10);
- b.toBuffer(buf,10);
- for (Uint32 i = 0;i < 10;i++)
- {
- Out() << TQString("0x%1 ").arg(buf[i],0,16);
- }
- Out() << endl;
- }
-
- bool BigIntTest::doTest()
- {
- Out() << "First test : " << endl;
- BigInt a("0x1E");
- BigInt b("0x42");
- BigInt c("0xFFFFEE");
- BigInt d = BigInt::powerMod(a,b,c);
- PrintBigInt(a);
- PrintBigInt(b);
- PrintBigInt(c);
- PrintBigInt(d);
- Out() << "Second test : " << endl;
- Uint8 test[] = {0xAB,0x12,0x34,0xE4,0xF6};
- a = BigInt::fromBuffer(test,5);
- PrintBigInt(a);
- Uint8 foobar[5];
- a.toBuffer(foobar,5);
- for (Uint32 i = 0;i < 5;i++)
- {
- Out() << TQString("0x%1 ").arg(foobar[i],0,16);
- }
- Out() << endl;
- Out() << "Third test" << endl;
- a = BigInt("0xABCD1234");
- PrintBigInt(a);
- a.toBuffer(foobar,4);
- c = BigInt::fromBuffer(foobar,4);
- PrintBigInt(c);
- return true;
- }
-
-}
diff --git a/utests/biginttest.h b/utests/biginttest.h
deleted file mode 100644
index 2e4073b..0000000
--- a/utests/biginttest.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2005 by Joris Guisson *
- * *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-#ifndef UTESTBIGINTTEST_H
-#define UTESTBIGINTTEST_H
-
-#include "unittest.h"
-
-namespace utest
-{
-
- /**
- @author Joris Guisson <[email protected]>
- */
- class BigIntTest : public UnitTest
- {
- public:
- BigIntTest();
- virtual ~BigIntTest();
-
- virtual bool doTest();
- };
-
-}
-
-#endif
diff --git a/utests/dhtmsgparsetest.cpp b/utests/dhtmsgparsetest.cpp
deleted file mode 100644
index 38a0deb..0000000
--- a/utests/dhtmsgparsetest.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2005 by Joris Guisson *
- * *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-#include <torrent/bdecoder.h>
-#include <torrent/bnode.h>
-#include <kademlia/rpcmsg.h>
-#include <util/log.h>
-#include <torrent/globals.h>
-#include "dhtmsgparsetest.h"
-
-using namespace dht;
-using namespace bt;
-
-namespace utest
-{
-
-
- DHTMsgParseTest::DHTMsgParseTest() : UnitTest("DHTMsgParseTest")
- {}
-
-
- DHTMsgParseTest::~DHTMsgParseTest()
- {}
-
- bool DHTMsgParseTest::doTest(const TQString & data,int method)
- {
- TQByteArray bdata(data.length());
-
- for (int i = 0;i < data.length();i++)
- {
- bdata[i] = data[i];
- }
-
- BDecoder bdec(bdata,false);
-
- BNode* n = bdec.decode();
- if (n->getType() != BNode::DICT)
- {
- delete n;
- Out() << "Packet does not contain a dictionary" << endl;
- return false;
- }
-
- MsgBase* msg = MakeRPCMsgTest((BDictNode*)n,(dht::Method)method);
- if (!msg)
- {
- delete n;
- Out() << "Error parsing message : " << endl;
- return false;
- }
- delete msg;
- delete n;
- return true;
- }
-
-
-
- bool DHTMsgParseTest::doTest()
- {
-
- TQString test_str[] = {
- "d1:rd2:id20:####################5:token20:####################6:valuesl6:######6:######6:######6:######6:######6:######6:######6:######ee1:t1:#1:y1:re",
-
- "d1:ad2:id20:####################9:info_hash20:####################e1:q9:get_peers1:t1:#1:y1:qe",
-
- "d1:rd2:id20:####################5:nodes208:################################################################################################################################################################################################################5:token20:####################e1:t1:#1:y1:re",
-
- TQString()
- };
-
- int types[] = {dht::GET_PEERS,dht::NONE,dht::GET_PEERS};
-
- int i = 0;
- while (!test_str[i].isNull())
- {
- // read and decode the packet
- if (!doTest(test_str[i],types[i]))
- {
- Out() << "Testing packet " << i << " : Failed" << endl;
- return false;
- }
- else
- {
- Out() << "Testing packet " << i << " : OK" << endl;
- }
- i++;
- }
-
- return true;
- }
-
-}
diff --git a/utests/dhtmsgparsetest.h b/utests/dhtmsgparsetest.h
deleted file mode 100644
index 8e2c774..0000000
--- a/utests/dhtmsgparsetest.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2005 by Joris Guisson *
- * *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-#ifndef UTESTDHTMSGPARSETEST_H
-#define UTESTDHTMSGPARSETEST_H
-
-#include <unittest.h>
-
-namespace utest
-{
-
- /**
- @author Joris Guisson <[email protected]>
- */
- class DHTMsgParseTest : public UnitTest
- {
- public:
- DHTMsgParseTest();
- virtual ~DHTMsgParseTest();
-
- virtual bool doTest();
- private:
- bool doTest(const TQString & data,int method);
- };
-
-}
-
-#endif
diff --git a/utests/difflehellmantest.cpp b/utests/difflehellmantest.cpp
deleted file mode 100644
index b261d5a..0000000
--- a/utests/difflehellmantest.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2005 by Joris Guisson *
- * *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-
-#include <stdio.h>
-#include <mse/bigint.h>
-#include <mse/functions.h>
-#include <util/log.h>
-#include <torrent/globals.h>
-#include "difflehellmantest.h"
-
-using namespace bt;
-using namespace mse;
-
-namespace utest
-{
-
- DiffleHellmanTest::DiffleHellmanTest()
- : UnitTest("DiffleHellman")
- {}
-
-
- DiffleHellmanTest::~DiffleHellmanTest()
- {}
-
-
- bool DiffleHellmanTest::doTest()
- {
- BigInt xa,ya,xb,yb;
- mse::GeneratePublicPrivateKey(xa,ya);
- mse::GeneratePublicPrivateKey(xb,yb);
- mse::DumpBigInt("Xa",xa);
- mse::DumpBigInt("Ya",ya);
- mse::DumpBigInt("Xb",xb);
- mse::DumpBigInt("Yb",yb);
-
- mse::DumpBigInt("Sa",mse::DHSecret(xa,yb));
- mse::DumpBigInt("Sb",mse::DHSecret(xb,ya));
- return true;
- }
-
-}
diff --git a/utests/difflehellmantest.h b/utests/difflehellmantest.h
deleted file mode 100644
index c065894..0000000
--- a/utests/difflehellmantest.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2005 by Joris Guisson *
- * *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-#ifndef UTESTDIFFLEHELLMANTEST_H
-#define UTESTDIFFLEHELLMANTEST_H
-
-#include "unittest.h"
-
-namespace utest
-{
-
- /**
- @author Joris Guisson <[email protected]>
- */
- class DiffleHellmanTest : public UnitTest
- {
- public:
- DiffleHellmanTest();
-
- ~DiffleHellmanTest();
-
- virtual bool doTest();
-
- };
-
-}
-
-#endif
diff --git a/utests/main.cpp b/utests/main.cpp
deleted file mode 100644
index 7618cac..0000000
--- a/utests/main.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2005 by Joris Guisson *
- * *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-#include <stdio.h>
-#include <stdlib.h>
-#include <libktorrent/util/log.h>
-#include <libktorrent/torrent/globals.h>
-#include "testrunner.h"
-#include "upnpparsedescriptiontest.h"
-#include "upnpparseresponsetest.h"
-#include "dhtmsgparsetest.h"
-#include "biginttest.h"
-#include "rc4test.h"
-#include "difflehellmantest.h"
-
-using namespace kt;
-using namespace bt;
-using namespace utest;
-
-
-
-int main(int argc,char** argv)
-{
- Globals::instance().setDebugMode(true);
- Globals::instance().initLog("ktutester.log");
- TestRunner tr;
- tr.addTest(new UPnPParseDescriptionTest());
- tr.addTest(new UPnPParseResponseTest());
- tr.addTest(new DHTMsgParseTest());
- tr.addTest(new BigIntTest());
- tr.addTest(new RC4Test());
- tr.addTest(new DiffleHellmanTest());
- tr.doAllTests();
- Globals::cleanup();
- return 0;
-}
diff --git a/utests/rc4test.cpp b/utests/rc4test.cpp
deleted file mode 100644
index add45ff..0000000
--- a/utests/rc4test.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2005 by Joris Guisson *
- * *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-#include <stdio.h>
-#include <mse/rc4encryptor.h>
-#include <util/log.h>
-#include <torrent/globals.h>
-#include "rc4test.h"
-
-using namespace bt;
-using namespace mse;
-
-namespace utest
-{
-
- RC4Test::RC4Test() : UnitTest("RC4")
- {}
-
-
- RC4Test::~RC4Test()
- {}
-
-
- bool RC4Test::doTest()
- {
- bool ret1 = firstTest();
- bool ret2 = secondTest();
- return ret1 && ret2;
- }
-
- bool RC4Test::firstTest()
- {
- Out() << "First RC4 test" << endl;
- SHA1Hash a = SHA1Hash::generate((Uint8*)"keyA",4);
- SHA1Hash b = SHA1Hash::generate((Uint8*)"keyB",4);
-
- RC4Encryptor as(b,a);
- RC4Encryptor bs(a,b);
- char* test = "Dit is een test";
- int tlen = strlen(test);
- Uint8* dec = (Uint8*)as.encrypt((Uint8*)test,tlen);
- bs.decrypt(dec,tlen);
- if (memcmp(dec,test,tlen) == 0)
- {
- Out() << "Test succesfull" << endl;
- Out() << TQString(test) << endl;
- Out() << TQString((char*)dec) << endl;
- return true;
- }
- else
- {
- Out() << "Test not succesfull" << endl;
- Out() << TQString(test) << endl;
- Out() << TQString((char*)dec) << endl;
- return false;
- }
- }
-
- bool RC4Test::secondTest()
- {
- Out() << "Second RC4 test" << endl;
- Uint8 output[100];
- Uint8 result[] = {0xbb,0xf3,0x16, 0xe8 , 0xd9, 0x40, 0xaf,0x0a ,0xd3 };
- // RC4( "Key", "Plaintext" ) == "bbf316e8 d940af0a d3"
- char* key = "Key";
- char* pt = "Plaintext";
- RC4 enc((const Uint8*)key,3);
- enc.process((const Uint8*)pt,output,strlen(pt));
-
- for (Uint32 i = 0;i < strlen(pt);i++)
- {
- if (output[i] != result[i])
- return false;
- }
-
- return true;
- }
-
-}
diff --git a/utests/rc4test.h b/utests/rc4test.h
deleted file mode 100644
index b92afae..0000000
--- a/utests/rc4test.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2005 by Joris Guisson *
- * *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-#ifndef UTESTRC4TEST_H
-#define UTESTRC4TEST_H
-
-#include "unittest.h"
-
-namespace utest
-{
-
- /**
- @author Joris Guisson <[email protected]>
- */
- class RC4Test : public UnitTest
- {
- public:
- RC4Test();
- virtual ~RC4Test();
-
- virtual bool doTest();
-
- private:
- bool firstTest();
- bool secondTest();
- };
-
-}
-
-#endif
diff --git a/utests/testrunner.cpp b/utests/testrunner.cpp
deleted file mode 100644
index 3e0c2aa..0000000
--- a/utests/testrunner.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2005 by Joris Guisson *
- * *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-#include <util/log.h>
-#include <util/error.h>
-#include <torrent/globals.h>
-#include "testrunner.h"
-
-using namespace bt;
-
-namespace utest
-{
-
- TestRunner::TestRunner()
- {
- tests.setAutoDelete(true);
- }
-
-
- TestRunner::~TestRunner()
- {}
-
- void TestRunner::addTest(UnitTest* ut)
- {
- tests.append(ut);
- }
-
- void TestRunner::doAllTests()
- {
- int succes = 0;
- int failure = 0;
- TQPtrList<UnitTest>::iterator i = tests.begin();
- while (i != tests.end())
- {
- Out() << "======================" << endl;
- UnitTest* t = *i;
- bool res = false;
- try
- {
- res = t->doTest();
- }
- catch (bt::Error & err)
- {
- Out() << "Caught Error : " << err.toString() << endl;
- res = false;
- }
- bt::Out() << "Doing test " << t->getName() << " : " << (res ? "SUCCES" : "FAILURE") << endl;
- if (res)
- succes++;
- else
- failure++;
- i++;
- }
-
- Out() << "======================" << endl;
- Out() << "Summary : " << endl;
- Out() << "\t" << succes << " succesfull tests" << endl;
- Out() << "\t" << failure << " failed tests" << endl;
- }
-}
diff --git a/utests/testrunner.h b/utests/testrunner.h
deleted file mode 100644
index edc56b4..0000000
--- a/utests/testrunner.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2005 by Joris Guisson *
- * *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-#ifndef UTESTTESTRUNNER_H
-#define UTESTTESTRUNNER_H
-
-#include <tqptrlist.h>
-#include "unittest.h"
-
-namespace utest
-{
-
- /**
- @author Joris Guisson <[email protected]>
- */
- class TestRunner
- {
- TQPtrList<UnitTest> tests;
- public:
- TestRunner();
- virtual ~TestRunner();
-
- void addTest(UnitTest* ut);
- void doAllTests();
- };
-
-}
-
-#endif
diff --git a/utests/unittest.cpp b/utests/unittest.cpp
deleted file mode 100644
index 2aaa2d6..0000000
--- a/utests/unittest.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2005 by Joris Guisson *
- * *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-#include "unittest.h"
-
-namespace utest
-{
-
- UnitTest::UnitTest(const TQString & name) : name(name)
- {}
-
-
- UnitTest::~UnitTest()
- {}
-
-
-}
diff --git a/utests/unittest.h b/utests/unittest.h
deleted file mode 100644
index 02889a5..0000000
--- a/utests/unittest.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2005 by Joris Guisson *
- * *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-#ifndef UTESTUNITTEST_H
-#define UTESTUNITTEST_H
-
-#include <tqstring.h>
-
-namespace utest
-{
-
- /**
- @author Joris Guisson <[email protected]>
-
- Base class for all unit tests
- */
- class UnitTest
- {
- TQString name;
- public:
- UnitTest(const TQString & name);
- virtual ~UnitTest();
-
- TQString getName() const {return name;}
-
- virtual bool doTest() = 0;
- };
-
-}
-
-#endif
diff --git a/utests/upnpparsedescriptiontest.cpp b/utests/upnpparsedescriptiontest.cpp
deleted file mode 100644
index 787378f..0000000
--- a/utests/upnpparsedescriptiontest.cpp
+++ /dev/null
@@ -1,433 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2005 by Joris Guisson *
- * *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-#include <tqfile.h>
-#include <plugins/upnp/upnprouter.h>
-#include <plugins/upnp/upnpdescriptionparser.h>
-#include <util/fileops.h>
-#include <util/error.h>
-#include <util/log.h>
-#include <torrent/globals.h>
-#include "upnpparsedescriptiontest.h"
-
-using namespace kt;
-using namespace bt;
-
-namespace utest
-{
- static char* test_data1 = "<?xml version=\"1.0\"?>\n"
- "<root xmlns=\"urn:schemas-upnp-org:device-1-0\">\n"
- "<specVersion>\n"
- "<major>1</major>\n"
- "<minor>0</minor>\n"
- "</specVersion>\n"
- "<URLBase>http://192.168.0.1:5678</URLBase>\n"
- "<device>\n"
- "<deviceType>urn:schemas-upnp-org:device:InternetGatewayDevice:1</deviceType>\n"
- "<presentationURL>http://192.168.0.1:80</presentationURL>\n"
- "<friendlyName>D-Link Router</friendlyName>\n"
- "<manufacturer>D-Link</manufacturer>\n"
- "<manufacturerURL>http://www.dlink.com</manufacturerURL>\n"
- "<modelDescription>Internet Access Router</modelDescription>\n"
- "<modelName>D-Link Router</modelName>\n"
- "<UDN>uuid:upnp-InternetGatewayDevice-1_0-12345678900001</UDN>\n"
- "<UPC>123456789001</UPC>\n"
- "<serviceList>\n"
- "<service>\n"
- "<serviceType>urn:schemas-upnp-org:service:Layer3Forwarding:1</serviceType>\n"
- "<serviceId>urn:upnp-org:serviceId:L3Forwarding1</serviceId>\n"
- "<controlURL>/Layer3Forwarding</controlURL>\n"
- "<eventSubURL>/Layer3Forwarding</eventSubURL>\n"
- "<SCPDURL>/Layer3Forwarding.xml</SCPDURL>\n"
- "</service>\n"
- "</serviceList>\n"
- "<deviceList>\n"
- "<device>\n"
- "<deviceType>urn:schemas-upnp-org:device:WANDevice:1</deviceType>\n"
- "<friendlyName>WANDevice</friendlyName>\n"
- "<manufacturer>D-Link</manufacturer>\n"
- "<manufacturerURL>http://www.dlink.com</manufacturerURL>\n"
- "<modelDescription>Internet Access Router</modelDescription>\n"
- "<modelName>D-Link Router</modelName>\n"
- "<modelNumber>1</modelNumber>\n"
- "<modelURL>http://support.dlink.com</modelURL>\n"
- "<serialNumber>12345678900001</serialNumber>\n"
- "<UDN>uuid:upnp-WANDevice-1_0-12345678900001</UDN>\n"
- "<UPC>123456789001</UPC>\n"
- "<serviceList>\n"
- "<service>\n"
- "<serviceType>urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1</serviceType>\n"
- "<serviceId>urn:upnp-org:serviceId:WANCommonInterfaceConfig</serviceId>\n"
- "<controlURL>/WANCommonInterfaceConfig</controlURL>\n"
- "<eventSubURL>/WANCommonInterfaceConfig</eventSubURL>\n"
- "<SCPDURL>/WANCommonInterfaceConfig.xml</SCPDURL>\n"
- "</service>\n"
- "</serviceList>\n"
- "<deviceList>\n"
- "<device>\n"
- "<deviceType>urn:schemas-upnp-org:device:WANConnectionDevice:1</deviceType>\n"
- "<friendlyName>WAN Connection Device</friendlyName>\n"
- "<manufacturer>D-Link</manufacturer>\n"
- "<manufacturerURL>http://www.dlink.com</manufacturerURL>\n"
- "<modelDescription>Internet Access Router</modelDescription>\n"
- "<modelName>D-Link Router</modelName> \n"
- "<modelNumber>1</modelNumber>\n"
- "<modelURL>http://support.dlink.com</modelURL>\n"
- "<serialNumber>12345678900001</serialNumber>\n"
- "<UDN>uuid:upnp-WANConnectionDevice-1_0-12345678900001</UDN>\n"
- "<UPC>123456789001</UPC>\n"
- "<serviceList>\n"
- "<service>\n"
- "<serviceType>urn:schemas-upnp-org:service:WANIPConnection:1</serviceType>\n"
- "<serviceId>urn:upnp-org:serviceId:WANIPConnection</serviceId> \n"
- "<controlURL>/WANIPConnection</controlURL>\n"
- "<eventSubURL>/WANIPConnection</eventSubURL>\n"
- "<SCPDURL>/WANIPConnection.xml</SCPDURL>\n"
- "</service>\n"
- "</serviceList>\n"
- "</device>\n"
- "</deviceList>\n"
- "</device>\n"
- "</deviceList>\n"
- "</device>\n"
- "</root>";
-
- static const char* test_data2 = "<?xml version=\"1.0\"?> \n"
- "<root xmlns=\"urn:schemas-upnp-org:device-1-0\"> \n"
- "<specVersion> \n"
- "<major>1</major> \n"
- "<minor>0</minor> \n"
- "</specVersion> \n"
- "<URLBase>http://192.168.1.1:52869</URLBase> \n"
- "<device> \n"
- "<deviceType>urn:schemas-upnp-org:device:InternetGatewayDevice:1</deviceType> \n"
- "<friendlyName>DLINK Internet Gateway Device</friendlyName> \n"
- "<manufacturer>DLINK</manufacturer> \n"
- "<manufacturerURL>http://www.dlink.com</manufacturerURL> \n"
- "<modelName>DLINK IGD</modelName> \n"
- "<UDN>uuid:75802409-bccb-40e7-8e6c-fa095ecce13e</UDN> \n"
- "<iconList> \n"
- "<icon> \n"
- "<mimetype>image/gif</mimetype> \n"
- "<width>118</width> \n"
- "<height>119</height> \n"
- "<depth>8</depth> \n"
- "<url>/ligd.gif</url> \n"
- "</icon> \n"
- "</iconList> \n"
- "<serviceList> \n"
- "<service> \n"
- "<serviceType>urn:schemas-microsoft-com:service:OSInfo:1</serviceType> \n"
- "<serviceId>urn:microsoft-com:serviceId:OSInfo1</serviceId> \n"
- "<controlURL>/upnp/control/OSInfo1</controlURL> \n"
- "<eventSubURL>/upnp/event/OSInfo1</eventSubURL> \n"
- "<SCPDURL>/gateinfoSCPD.xml</SCPDURL> \n"
- "</service> \n"
- "</serviceList> \n"
- "<deviceList> \n"
- "<device> \n"
- "<deviceType>urn:schemas-upnp-org:device:WANDevice:1</deviceType> \n"
- "<friendlyName>WANDevice</friendlyName> \n"
- "<manufacturer>DLINK</manufacturer> \n"
- "<manufacturerURL>http://www.dlink.com</manufacturerURL> \n"
- "<modelDescription>WAN Device on DLINK IGD</modelDescription> \n"
- "<modelName>DLINK IGD</modelName> \n"
- "<modelNumber>0.92</modelNumber> \n"
- "<modelURL>http://www.dlink.com</modelURL> \n"
- "<serialNumber>0.92</serialNumber> \n"
- "<UDN>uuid:75802409-bccb-40e7-8e6c-fa095ecce13e</UDN> \n"
- "<UPC>DLINK IGD</UPC> \n"
- "<serviceList> \n"
- "<service> \n"
- "<serviceType>urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1</serviceType> \n"
- "<serviceId>urn:upnp-org:serviceId:WANCommonIFC1</serviceId> \n"
- "<controlURL>/upnp/control/WANCommonIFC1</controlURL> \n"
- "<eventSubURL>/upnp/control/WANCommonIFC1</eventSubURL> \n"
- "<SCPDURL>/gateicfgSCPD.xml</SCPDURL> \n"
- "</service> \n"
- "</serviceList> \n"
- "<deviceList> \n"
- "<device> \n"
- "<deviceType>urn:schemas-upnp-org:device:WANConnectionDevice:1</deviceType> \n"
- "<friendlyName>WANConnectionDevice</friendlyName> \n"
- "<manufacturer>DLINK</manufacturer> \n"
- "<manufacturerURL>http://www.dlink.com</manufacturerURL> \n"
- "<modelDescription>WanConnectionDevice on DLINK IGD</modelDescription> \n"
- "<modelName>DLINK IGD</modelName> \n"
- "<modelNumber>0.92</modelNumber> \n"
- "<modelURL>http://www.dlink.com</modelURL> \n"
- "<serialNumber>0.92</serialNumber> \n"
- "<UDN>uuid:75802409-bccb-40e7-8e6c-fa095ecce13e</UDN> \n"
- "<UPC>DLINK IGD</UPC> \n"
- "<serviceList> \n"
- "<service> \n"
- "<serviceType>urn:schemas-upnp-org:service:WANIPConnection:1</serviceType> \n"
- "<serviceId>urn:upnp-org:serviceId:WANIPConn1</serviceId> \n"
- "<controlURL>/upnp/control/WANIPConn1</controlURL> \n"
- "<eventSubURL>/upnp/control/WANIPConn1</eventSubURL> \n"
- "<SCPDURL>/gateconnSCPD.xml</SCPDURL> \n"
- "</service> \n"
- "</serviceList> \n"
- "</device> \n"
- "</deviceList> \n"
- "</device> \n"
- "</deviceList> \n"
- "<presentationURL>http://192.168.1.1/</presentationURL> \n"
- "</device> \n"
- "</root> ";
-
- static const char* test_data3 = "<?xml version=\"1.0\"?> \
- <root xmlns=\"urn:schemas-upnp-org:device-1-0\"> \
- <specVersion> \
- <major>1</major> \
- <minor>0</minor> \
- </specVersion> \
- <URLBase>http://192.168.0.5:5431/</URLBase> \
- <device> \
- <deviceType>urn:schemas-upnp-org:device:InternetGatewayDevice:1</deviceType> \
- <presentationURL>http://192.168.0.5:80/</presentationURL> \
- <friendlyName>Dynalink Wireless ADSL Router</friendlyName> \
- <manufacturer>Danalink</manufacturer> \
- <manufacturerURL>http://www.dynalink.co.nz/</manufacturerURL> \
- <modelDescription>Broadcom single-chip ADSL router</modelDescription> \
- <modelName>BCM6345+BCM4306</modelName> \
- <modelNumber>1.0</modelNumber> \
- <modelURL>http://www.dynalink.co.nz/</modelURL> \
- <UDN>uuid:10740000-0000-1000-b710-107c0032dca6</UDN> \
- <serviceList> \
- <service> \
- <serviceType>urn:schemas-upnp-org:service:Layer3Forwarding:1</serviceType> \
- <serviceId>urn:upnp-org:serviceId:Layer3Forwarding:11</serviceId> \
- <controlURL>/uuid:10740000-0000-1000-b710-107c0032dca6/Layer3Forwarding:1</controlURL> \
- <eventSubURL>/uuid:10740000-0000-1000-b710-107c0032dca6/Layer3Forwarding:1</eventSubURL> \
- <SCPDURL>/dynsvc/Layer3Forwarding:1.xml</SCPDURL> \
- </service> \
- </serviceList> \
- <deviceList> \
- <device> \
- <deviceType>urn:schemas-upnp-org:device:WANDevice:1</deviceType> \
- <friendlyName>urn:schemas-upnp-org:device:WANDevice:1</friendlyName> \
- <manufacturer>Danalink</manufacturer> \
- <manufacturerURL>http://www.dynalink.co.nz/</manufacturerURL> \
- <modelDescription>Broadcom single-chip ADSL router</modelDescription> \
- <modelName>BCM6345+BCM4306</modelName> \
- <modelNumber>1.0</modelNumber> \
- <modelURL>http://www.dynalink.co.nz/</modelURL> \
- <UDN>uuid:10740000-0000-1000-b710-107c0132dca6</UDN> \
- <serviceList> \
- <service> \
- <serviceType>urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1</serviceType> \
- <serviceId>urn:upnp-org:serviceId:WANCommonIFC1</serviceId> \
- <controlURL>/uuid:10740000-0000-1000-b710-107c0132dca6/WANCommonInterfaceConfig:1</controlURL> \
- <eventSubURL>/uuid:10740000-0000-1000-b710-107c0132dca6/WANCommonInterfaceConfig:1</eventSubURL> \
- <SCPDURL>/dynsvc/WANCommonInterfaceConfig:1.xml</SCPDURL> \
- </service> \
- </serviceList> \
- <deviceList> \
- <device> \
- <deviceType>urn:schemas-upnp-org:device:WANConnectionDevice:1</deviceType> \
- <friendlyName>urn:schemas-upnp-org:device:WANConnectionDevice:1</friendlyName> \
- <manufacturer>Danalink</manufacturer> \
- <manufacturerURL>http://www.dynalink.co.nz/</manufacturerURL> \
- <modelDescription>Broadcom single-chip ADSL router</modelDescription> \
- <modelName>BCM6345+BCM4306</modelName> \
- <modelNumber>1.0</modelNumber> \
- <modelURL>http://www.dynalink.co.nz/</modelURL> \
- <UDN>uuid:10740000-0000-1000-b710-107c0232dca6</UDN> \
- <serviceList> \
- <service> \
- <serviceType>urn:schemas-upnp-org:service:WANPPPConnection:1</serviceType> \
- <serviceId>urn:upnp-org:serviceId:WANPPPConn1</serviceId> \
- <controlURL>/uuid:10740000-0000-1000-b710-107c0232dca6/WANPPPConnection:1</controlURL> \
- <eventSubURL>/uuid:10740000-0000-1000-b710-107c0232dca6/WANPPPConnection:1</eventSubURL> \
- <SCPDURL>/dynsvc/WANPPPConnection:1.xml</SCPDURL> \
- </service> \
- </serviceList> \
- </device> \
- </deviceList> \
- </device> \
- </deviceList> \
- </device> \
- </root> ";
-
- const char* test_data4 = "<?xml version=\"1.0\"?> \
- <root xmlns=\"urn:schemas-upnp-org:device-1-0\"> \
- <specVersion> \
- <major>1</major> \
- <minor>0</minor> \
- </specVersion> \
- <URLBase>http://192.168.1.1:2869</URLBase> \
- <device> \
- <deviceType>urn:schemas-upnp-org:device:InternetGatewayDevice:1</deviceType> \
- <friendlyName>OpenWrt Linux Internet Gateway Device</friendlyName> \
- <manufacturer>OpenWrt Project</manufacturer> \
- <manufacturerURL>http://www.openwrt.org</manufacturerURL> \
- <modelName>WRT54G(S)</modelName> \
- <UDN>uuid:75802409-bccb-40e7-8e6c-fa095ecce13e</UDN> \
- <iconList> \
- <icon> \
- <mimetype>image/gif</mimetype> \
- <width>118</width> \
- <height>119</height>\
- <depth>8</depth> \
- <url>/ligd.gif</url> \
- </icon> \
- </iconList> \
- <serviceList> \
- <service> \
- <serviceType>urn:schemas-microsoft-com:service:OSInfo:1</serviceType> \
- <serviceId>urn:microsoft-com:serviceId:OSInfo1</serviceId> \
- <controlURL>/upnp/control/OSInfo1</controlURL> \
- <eventSubURL>/upnp/event/OSInfo1</eventSubURL> \
- <SCPDURL>/gateinfoSCPD.xml</SCPDURL> \
- </service> \
- </serviceList> \
- <deviceList> \
- <device> \
- <deviceType>urn:schemas-upnp-org:device:WANDevice:1</deviceType> \
- <friendlyName>WANDevice</friendlyName> \
- <manufacturer>OpenWrt Project</manufacturer> \
- <manufacturerURL>http://www.openwrt.org</manufacturerURL> \
- <modelDescription>WAN Device on OpenWrt Router</modelDescription> \
- <modelName>WRT54G(S)</modelName> \
- <modelNumber>1.0</modelNumber> \
- <modelURL>http://www.linksys.com</modelURL> \
- <serialNumber>XXXXXXXXXX</serialNumber> \
- <UDN>uuid:75802409-bccb-40e7-8e6c-fa095ecce13e</UDN> \
- <UPC>Linux IGD</UPC> \
- <serviceList> \
- <service> \
- <serviceType>urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1</serviceType> \
- <serviceId>urn:upnp-org:serviceId:WANCommonIFC1</serviceId> \
- <controlURL>/upnp/control/WANCommonIFC1</controlURL> \
- <eventSubURL>/upnp/control/WANCommonIFC1</eventSubURL> \
- <SCPDURL>/gateicfgSCPD.xml</SCPDURL> \
- </service> \
- </serviceList> \
- <deviceList> \
- <device> \
- <deviceType>urn:schemas-upnp-org:device:WANConnectionDevice:1</deviceType> \
- <friendlyName>WANConnectionDevice</friendlyName> \
- <manufacturer>OpenWrt Project</manufacturer> \
- <manufacturerURL>http://www.openwrt.org</manufacturerURL> \
- <modelDescription>WanConnectionDevice on OpenWrt Router</modelDescription> \
- <modelName>WRT54G(S)</modelName> \
- <modelNumber>1.0</modelNumber> \
- <modelURL>http://www.linksys.com</modelURL> \
- <serialNumber>XXXXXXXXXX</serialNumber> \
- <UDN>uuid:75802409-bccb-40e7-8e6c-fa095ecce13e</UDN> \
- <UPC>Linux IGD</UPC> \
- <serviceList> \
- <service> \
- <serviceType>urn:schemas-upnp-org:service:WANIPConnection:1</serviceType> \
- <serviceId>urn:upnp-org:serviceId:WANIPConn1</serviceId> \
- <controlURL>/upnp/control/WANIPConn1</controlURL> \
- <eventSubURL>/upnp/control/WANIPConn1</eventSubURL> \
- <SCPDURL>/gateconnSCPD.xml</SCPDURL> \
- </service> \
- </serviceList> \
- </device> \
- </deviceList> \
- </device> \
- </deviceList> \
- <presentationURL>http://192.168.1.1/</presentationURL> \
- </device> \
- </root> ";
-
-
- UPnPParseDescriptionTest::UPnPParseDescriptionTest() : UnitTest("UPnPParseDescriptionTest")
- {}
-
-
- UPnPParseDescriptionTest::~UPnPParseDescriptionTest()
- {}
-
- bool UPnPParseDescriptionTest::doParse(const char* data,bool forward_test)
- {
- TQString fn = "/tmp/UPnPParseDescriptionTest";
- TQFile fptr(fn);
- if (!fptr.open(IO_WriteOnly))
- {
- Out() << "Cannot open " << fn << " : " << fptr.errorString() << endl;
- return false;
- }
- fptr.writeBlock(data,strlen(data));
- fptr.close();
-
- kt::UPnPRouter router(TQString(),"http://foobar.com");
- kt::UPnPDescriptionParser dp;
-
- if (!dp.parse(fn,&router))
- {
- bt::Delete(fn,true);
- return false;
- }
- else
- {
- Out() << "Succesfully parsed the UPnP contents" << endl;
- bt::Delete(fn,true);
- if (forward_test)
- {
- try
- {
- Out() << "Attempting to forward port 9999" << endl;
- router.forward(net::Port(9999,net::TCP,true));
- }
- catch (Error & e)
- {
- Out() << "Error forwarding : "<< e.toString() << endl;
- return false;
- }
- }
- // router.debugPrintData();
- return true;
- }
- }
-
- bool UPnPParseDescriptionTest::doTest()
- {
- bool ret = true;
- if (!doParse(test_data1,false))
- {
- Out() << "Test data 1 failed" << endl;
- ret = false;
- }
-
- if (!doParse(test_data2,false))
- {
- Out() << "Test data 2 failed" << endl;
- ret = false;
- }
-
- if (!doParse(test_data3,false))
- {
- Out() << "Test data 3 failed" << endl;
- ret = false;
- }
-
- if (!doParse(test_data4,false))
- {
- Out() << "Test data 4 failed" << endl;
- ret = false;
- }
-
- return ret;
- }
-
-}
diff --git a/utests/upnpparsedescriptiontest.h b/utests/upnpparsedescriptiontest.h
deleted file mode 100644
index 29d4e1e..0000000
--- a/utests/upnpparsedescriptiontest.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2005 by Joris Guisson *
- * *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-#ifndef UTESTUPNPPARSEDESCRIPTIONTEST_H
-#define UTESTUPNPPARSEDESCRIPTIONTEST_H
-
-#include <unittest.h>
-
-namespace utest
-{
-
- /**
- @author Joris Guisson <[email protected]>
- */
- class UPnPParseDescriptionTest : public UnitTest
- {
- public:
- UPnPParseDescriptionTest();
- virtual ~UPnPParseDescriptionTest();
-
- virtual bool doTest();
- private:
- bool doParse(const char* data,bool forward_test);
- };
-
-}
-
-#endif
diff --git a/utests/upnpparseresponsetest.cpp b/utests/upnpparseresponsetest.cpp
deleted file mode 100644
index 97102cf..0000000
--- a/utests/upnpparseresponsetest.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2005 by Joris Guisson *
- * *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-#include <plugins/upnp/upnprouter.h>
-#include <plugins/upnp/upnpdescriptionparser.h>
-#include <plugins/upnp/upnpmcastsocket.h>
-#include "upnpparseresponsetest.h"
-
-using namespace kt;
-using namespace bt;
-
-namespace utest
-{
-
- UPnPParseResponseTest::UPnPParseResponseTest() : UnitTest("UPnPParseResponseTest")
- {}
-
-
- UPnPParseResponseTest::~UPnPParseResponseTest()
- {}
-
-
- bool UPnPParseResponseTest::doTest()
- {
- static const char* test_ps = "M-SEARCH * HTTP/1.1\r\n"
- "HOST: 239.255.255.250:1900\r\n"
- "ST:urn:schemas-upnp-org:device:InternetGatewayDevice:1\r\n"
- "MAN:\"ssdp:discover\"\r\n"
- "MX:3\r\n"
- "HTTP/1.1 200 OK\r\n"
- "CACHE-CONTROL: max-age=1800\r\n"
- "DATE: Mon, 13 Mar 2006 19:55:10 GMT \r\n"
- "EXT:\r\n"
- "LOCATION: http://192.168.1.1:52869/gatedesc.xml\r\n"
- "SERVER: Linux/2.4.17_mvl21-malta-mips_fp_le, UPnP/1.0, Intel SDK for UPnP devices /1.2\r\n"
- "ST: urn:schemas-upnp-org:device:InternetGatewayDevice:1\r\n"
- "USN: uuid:75802409-bccb-40e7-8e6c-fa095ecce13e::urn:schemas-upnp-org:device:InternetGatewayDevice:1\r\n\r\n";
-
- UPnPMCastSocket mcast;
- UPnPRouter* r = mcast.parseResponse(TQCString(test_ps));
- if (r)
- {
- delete r;
- return true;
- }
-
- return false;
- }
-
-}
diff --git a/utests/upnpparseresponsetest.h b/utests/upnpparseresponsetest.h
deleted file mode 100644
index 5186fd5..0000000
--- a/utests/upnpparseresponsetest.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2005 by Joris Guisson *
- * *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-#ifndef UTESTUPNPPARSERESPONSETEST_H
-#define UTESTUPNPPARSERESPONSETEST_H
-
-#include <unittest.h>
-
-namespace utest
-{
-
- /**
- @author Joris Guisson <[email protected]>
- */
- class UPnPParseResponseTest : public UnitTest
- {
- public:
- UPnPParseResponseTest();
-
- ~UPnPParseResponseTest();
-
- virtual bool doTest();
-
- };
-
-}
-
-#endif