Changeset 1846
- Timestamp:
- 09/07/05 09:42:46 (3 years ago)
- Files:
-
- hydranode-oldbld/tests/test-dynload/test-dynload.cpp (deleted)
- hydranode-oldbld/tests/test-dynload/test-dynload.h (deleted)
- hydranode-oldbld/tests/test-hasher/test-hasher.cpp (deleted)
- hydranode/hnbase/test/Jamfile (modified) (1 diff)
- hydranode/hnbase/test/test-config.cpp (moved) (moved from hydranode-oldbld/tests/test-config/test-config.cpp) (1 diff)
- hydranode/hnbase/test/test-event.cpp (moved) (moved from hydranode-oldbld/tests/test-event/test-event.cpp) (2 diffs)
- hydranode/hnbase/test/test-hash.cpp (moved) (moved from hydranode-oldbld/tests/test-hash/test-hash.cpp) (3 diffs)
- hydranode/hnbase/test/test-log.cpp (moved) (moved from hydranode-oldbld/tests/test-log/test-log.cpp) (2 diffs)
- hydranode/hnbase/test/test-object.cpp (moved) (moved from hydranode-oldbld/tests/test-object/test-object.cpp) (2 diffs)
- hydranode/hnbase/test/test-range.cpp (modified) (1 diff)
- hydranode/hnbase/test/test-sockets.cpp (moved) (moved from hydranode-oldbld/tests/test-sockets/test-sockets.cpp) (7 diffs)
- hydranode/hnbase/test/test-ssocket.cpp (moved) (moved from hydranode-oldbld/tests/test-ssocket/test-ssocket.cpp) (2 diffs)
- hydranode/hnbase/test/test-utils.cpp (modified) (1 diff)
- hydranode/hnbase/test/test-utils2.cpp (moved) (moved from hydranode-oldbld/tests/test-utils/test-utils.cpp) (3 diffs)
- hydranode/hncore/test/Jamfile (modified) (1 diff)
- hydranode/hncore/test/test-hasher.cpp (modified) (2 diffs)
- hydranode/hncore/test/test-ipfilter.cpp (moved) (moved from hydranode-oldbld/tests/test-ipfilter/test-ipfilter.cpp) (2 diffs)
- hydranode/hncore/test/test-metadata.cpp (moved) (moved from hydranode-oldbld/tests/test-metadata/test-metadata.cpp) (12 diffs)
- hydranode/hncore/test/test-partdata.cpp (moved) (moved from hydranode-oldbld/tests/test-partdata/test-partdata.cpp) (5 diffs)
- hydranode/hncore/test/test-workthread.cpp (moved) (moved from hydranode-oldbld/tests/test-workthread/test-workthread.cpp) (2 diffs)
- hydranode/project-root.jam (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
hydranode/hnbase/test/Jamfile
r1831 r1846 1 exe utils : test-utils.cpp ; 1 exe config : test-config.cpp ..//hnbase ../../extra ; 2 exe event : test-event.cpp ..//hnbase ../../extra ; 3 exe hash : test-hash.cpp ..//hnbase ../../extra ; 4 exe log : test-log.cpp ..//hnbase ../../extra ; 5 exe object : test-object.cpp ..//hnbase ../../extra ; 2 6 exe range : test-range.cpp ../../extra/test ; 7 exe resolver : test-resolver.cpp ..//hnbase ../../extra ; 8 exe sockets : test-sockets.cpp ..//hnbase ../../extra ; 9 exe ssocket : test-ssocket.cpp ..//hnbase ../../extra ; 3 10 exe timed_callback : test-timed_callback.cpp ..//hnbase ../../extra ; 4 exe resolver : test-resolver.cpp ..//hnbase ../../extra ; 11 exe utils : test-utils.cpp ..//hnbase ../../extra ; 12 exe utils2 : test-utils2.cpp ..//hnbase ../../extra ../../extra/test ; 5 13 6 stage bin : utils range resolver timed_callback : <location>bin <hardcode-dll-paths>true ; 14 stage bin 15 : config event hash log object range resolver sockets ssocket 16 timed_callback utils utils2 17 : <location>bin <hardcode-dll-paths>true ; hydranode/hnbase/test/test-config.cpp
r1024 r1846 17 17 */ 18 18 19 #include <hn /config.h>19 #include <hnbase/config.h> 20 20 #include <iostream> 21 21 #include <boost/timer.hpp> hydranode/hnbase/test/test-event.cpp
r1203 r1846 1 /* *1 /* 2 2 * Copyright (C) 2004-2005 Alo Sarv <madcat_@users.sourceforge.net> 3 3 * … … 17 17 */ 18 18 19 #include <hn /event.h>19 #include <hnbase/event.h> 20 20 #include <iostream> 21 21 #include <boost/shared_ptr.hpp> hydranode/hnbase/test/test-hash.cpp
r832 r1846 1 /* *1 /* 2 2 * Copyright (C) 2004-2005 Alo Sarv <madcat_@users.sourceforge.net> 3 3 * … … 21 21 #ifndef DOXYGEN_SHOULD_SKIP_THIS 22 22 23 #include <hn /hash.h>23 #include <hnbase/hash.h> 24 24 #include <boost/progress.hpp> 25 25 #include <boost/test/minimal.hpp> … … 46 46 void test_hash() { 47 47 Hash<MD4Hash> h(TestData1); 48 BOOST_CHECK(h. getLength() == 16);48 BOOST_CHECK(h.size() == 16); 49 49 BOOST_CHECK(!memcmp(h.getData().get(), TestData1, 16)); 50 BOOST_CHECK(TestDecoded == Utils::decode(h.getData(), h. getLength()));50 BOOST_CHECK(TestDecoded == Utils::decode(h.getData(), h.size())); 51 51 52 52 std::string htmd4("MD4Hash"); hydranode/hnbase/test/test-log.cpp
r504 r1846 1 /* *1 /* 2 2 * Copyright (C) 2004-2005 Alo Sarv <madcat_@users.sourceforge.net> 3 3 * … … 27 27 #include <string> 28 28 #include <boost/format.hpp> 29 #include <hn /log.h>29 #include <hnbase/log.h> 30 30 31 31 int main() { hydranode/hnbase/test/test-object.cpp
r504 r1846 1 /* *1 /* 2 2 * Copyright (C) 2004-2005 Alo Sarv <madcat_@users.sourceforge.net> 3 3 * … … 19 19 #ifndef DOXYGEN_SHOULD_SKIP_THIS 20 20 21 #include <hn /object.h>22 #include <hn /log.h>21 #include <hnbase/object.h> 22 #include <hnbase/log.h> 23 23 #include <boost/lexical_cast.hpp> 24 24 hydranode/hnbase/test/test-range.cpp
r1787 r1846 1 /* *1 /* 2 2 * Copyright (C) 2004-2005 Alo Sarv <madcat_@users.sourceforge.net> 3 3 * hydranode/hnbase/test/test-sockets.cpp
r504 r1846 1 /* *1 /* 2 2 * Copyright (C) 2004-2005 Alo Sarv <madcat_@users.sourceforge.net> 3 3 * … … 30 30 #ifndef DOXYGEN_SHOULD_SKIP_THIS 31 31 32 #include <hn /log.h>33 #include <hn /sockets.h>32 #include <hnbase/log.h> 33 #include <hnbase/sockets.h> 34 34 #include <map> 35 35 #include <vector> … … 76 76 for (int i = 0; i < SERVCOUNT; i++) { 77 77 SocketServer *serv = new SocketServer( 78 makeFunctor( 79 (SSEventHandler*)0, 80 *this, 81 &TestSockets::onServSockEvent 82 ) 78 boost::bind(&TestSockets::onServSockEvent, this, _1, _2) 83 79 ); 84 80 IPV4Address addr(0, 2000+i); … … 89 85 while (true) { 90 86 SocketWatcher::poll(); 91 EventMain:: getInstance().handlePending();87 EventMain::instance().handlePending(); 92 88 } 93 89 … … 95 91 96 92 // Handle any leftover events 97 EventMain:: getInstance().handlePending();93 EventMain::instance().handlePending(); 98 94 99 95 // Return to system … … 107 103 char msg[] = "Hello from server!"; 108 104 SocketClient *client = server->accept( 109 makeFunctor((SCEventHandler*)0, *this, 110 &TestSockets::onClieSockEvent) 105 boost::bind( 106 &TestSockets::onClieSockEvent, 107 this, _1, _2 108 ) 111 109 ); 112 110 client->write(msg, 18); … … 145 143 logMsg("[TestSockets] Client lost."); 146 144 m_clients.remove(client); 147 delete client;145 client->destroy(); 148 146 break; 149 147 } hydranode/hnbase/test/test-ssocket.cpp
r201 r1846 1 #include <hn/ssocket.h> 2 #include <hn/log.h> 1 /* 2 * Copyright (C) 2004-2005 Alo Sarv <madcat_@users.sourceforge.net> 3 * 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 2 of the License, or 7 * (at your option) any later version. 8 * 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. 13 * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 */ 18 19 #include <hnbase/ssocket.h> 20 #include <hnbase/log.h> 3 21 class ED2K { 4 22 public: … … 64 82 while (true) { 65 83 SocketWatcher::poll(); 66 EventMain:: getInstance().handlePending();84 EventMain::instance().handlePending(); 67 85 } 68 86 } hydranode/hnbase/test/test-utils.cpp
r1774 r1846 1 /* 2 * Copyright (C) 2004-2005 Alo Sarv <madcat_@users.sourceforge.net> 3 * 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 2 of the License, or 7 * (at your option) any later version. 8 * 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. 13 * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 */ 18 1 19 #include <hnbase/utils.h> 2 20 void logMsg(const boost::format &msg) { hydranode/hnbase/test/test-utils2.cpp
r504 r1846 1 /* *1 /* 2 2 * Copyright (C) 2004-2005 Alo Sarv <madcat_@users.sourceforge.net> 3 3 * … … 20 20 #ifndef DOXYGEN_SHOULD_SKIP_THIS 21 21 22 #include <hn/utils.h> 22 #include <hnbase/utils.h> 23 #include <hnbase/log.h> 23 24 #include <boost/test/unit_test.hpp> 25 24 26 using boost::unit_test_framework::test_suite; 25 27 using namespace boost::unit_test_framework; … … 52 54 BOOST_CHECK(!strcmp(src, dest)); 53 55 } 54 #include <hn/log.h>55 56 void test_hexdump() { 56 57 // std::string data(10024, '\0'); hydranode/hncore/test/Jamfile
r1757 r1846 13 13 : 14 14 ; 15 stage bin : hasher : <location>bin <hardcode-dll-paths>true ; 15 exe ipfilter : test-ipfilter.cpp ..//hncore ../../hnbase ../../extra $(extra_deps) ; 16 exe metadata : test-metadata.cpp ..//hncore ../../hnbase ../../extra $(extra_deps) 17 ../../extra ../../extra/test ; 18 exe partdata : test-partdata.cpp ..//hncore ../../hnbase ../../extra $(extra_deps) ; 19 exe workthread : test-workthread.cpp ..//hncore ../../hnbase ../../extra $(extra_deps) ; 20 21 stage bin : hasher ipfilter metadata partdata workthread 22 : <location>bin <hardcode-dll-paths>true 23 ; hydranode/hncore/test/test-hasher.cpp
r1757 r1846 1 /* *1 /* 2 2 * Copyright (C) 2004-2005 Alo Sarv <madcat_@users.sourceforge.net> 3 3 * … … 17 17 */ 18 18 19 /** @file test-hasher.cpp Regress-test for Files Identification Subsystem */ 19 /** 20 * \file test-hasher.cpp Regress-test for Files Identification Subsystem 21 */ 20 22 21 23 #ifndef DOXYGEN_SHOULD_SKIP_THIS hydranode/hncore/test/test-ipfilter.cpp
r541 r1846 1 /* *1 /* 2 2 * Copyright (C) 2004-2005 Alo Sarv <madcat_@users.sourceforge.net> 3 3 * … … 17 17 */ 18 18 19 //! @file test-ipfilter.cpp Tests IpFilter API 19 /** 20 * \file test-ipfilter.cpp Tests IpFilter API 21 */ 20 22 21 #include <hn /ipfilter.h>22 #include <hn /log.h>23 #include <hn /ipv4addr.h>24 #include <hn /utils.h>23 #include <hncore/ipfilter.h> 24 #include <hnbase/log.h> 25 #include <hnbase/ipv4addr.h> 26 #include <hnbase/utils.h> 25 27 #include <boost/test/minimal.hpp> 26 28 hydranode/hncore/test/test-metadata.cpp
r1361 r1846 1 /* *1 /* 2 2 * Copyright (C) 2004-2005 Alo Sarv <madcat_@users.sourceforge.net> 3 3 * … … 17 17 */ 18 18 19 /** @file test-metadata.cpp Test app for MetaData Subsystem */ 19 /** 20 * \file test-metadata.cpp Test app for MetaData Subsystem 21 */ 20 22 21 23 #ifndef DOXYGEN_SHOULD_SKIP_THIS 22 24 23 25 24 #include <hn /metadata.h>25 #include <hn /hash.h>26 #include <hn /metadb.h>26 #include <hncore/metadata.h> 27 #include <hnbase/hash.h> 28 #include <hncore/metadb.h> 27 29 #include <stdexcept> 28 30 #include <fstream> 29 31 #include <boost/test/unit_test.hpp> 32 #include <boost/test/unit_test_log.hpp> 33 30 34 using boost::unit_test_framework::test_suite; 31 35 using namespace boost::unit_test_framework; … … 75 79 uint8_t opcode = Utils::getVal<uint8_t>(i); 76 80 BOOST_CHECK(opcode == OP_AMD); 77 Utils::getVal<uint16_t>(i); // length81 (void)Utils::getVal<uint16_t>(i); // length 78 82 79 83 AudioMetaData *amd1 = new AudioMetaData(i); … … 140 144 uint8_t opcode = Utils::getVal<uint8_t>(i); 141 145 BOOST_CHECK(opcode == OP_VMD); 142 Utils::getVal<uint16_t>(i); // length146 (void)Utils::getVal<uint16_t>(i); // length 143 147 144 148 VideoMetaData *vmd2 = new VideoMetaData(i); … … 198 202 uint8_t opcode = Utils::getVal<uint8_t>(i); 199 203 BOOST_CHECK(opcode == OP_ARMD); 200 Utils::getVal<uint16_t>(i); // length204 (void)Utils::getVal<uint16_t>(i); // length 201 205 202 206 ArchiveMetaData *armd2 = new ArchiveMetaData(i); … … 245 249 uint8_t opcode = Utils::getVal<uint8_t>(i); 246 250 BOOST_CHECK(opcode == OP_IMD); 247 Utils::getVal<uint16_t>(i); // length251 (void)Utils::getVal<uint16_t>(i); // length 248 252 249 253 ImageMetaData *imd2 = new ImageMetaData(i); … … 332 336 uint8_t opcode = Utils::getVal<uint8_t>(i); 333 337 BOOST_CHECK(opcode == OP_HASHSET); 334 Utils::getVal<uint16_t>(i); // length338 (void)Utils::getVal<uint16_t>(i); // length 335 339 uint8_t fhtype = Utils::getVal<uint8_t>(i); 336 340 BOOST_CHECK(fhtype == OP_HT_MD4); … … 391 395 md->setImageData(imd); 392 396 BOOST_CHECK_NO_THROW(md->getImageData()); 393 md->set FileSize(123123123);397 md->setSize(123123123); 394 398 md->setModDate(123123); 395 399 md->setFileType(FT_UNKNOWN); … … 409 413 BOOST_CHECK(md->getArchiveData()->getComment() == "Very wierd archive."); 410 414 BOOST_CHECK(md->getImageData()->getComment() == "This is an odd picture."); 411 BOOST_CHECK(md->get FileSize() == 123123123);415 BOOST_CHECK(md->getSize() == 123123123); 412 416 BOOST_CHECK(md->getModDate() == 123123); 413 417 BOOST_CHECK(md->getFileType() == FT_UNKNOWN); … … 443 447 uint8_t opcode = Utils::getVal<uint8_t>(i); 444 448 BOOST_CHECK(opcode == OP_METADATA); 445 Utils::getVal<uint16_t>(i); // length449 (void)Utils::getVal<uint16_t>(i); // length 446 450 447 451 MetaData *md1 = new MetaData(i); … … 455 459 BOOST_CHECK(md1->getArchiveData()->getComment() == "Very wierd archive."); 456 460 BOOST_CHECK(md1->getImageData()->getComment() == "This is an odd picture."); 457 BOOST_CHECK(md1->get FileSize() == 123123123);461 BOOST_CHECK(md1->getSize() == 123123123); 458 462 BOOST_CHECK(md1->getModDate() == 123123); 459 463 BOOST_CHECK(md1->getFileType() == FT_UNKNOWN); … … 519 523 logMsg("Run with `-v` argument for verbose trace output."); 520 524 521 unit_test_log ::instance().set_log_threshold_level(log_all_errors);525 unit_test_log.set_threshold_level(log_all_errors); 522 526 test_suite *rms = BOOST_TEST_SUITE("MetaData Structures I/O Test"); 523 527 hydranode/hncore/test/test-partdata.cpp
r556 r1846 1 /* *1 /* 2 2 * Copyright (C) 2004-2005 Alo Sarv <madcat_@users.sourceforge.net> 3 3 * … … 17 17 */ 18 18 19 /** \file test-partdata.cpp Simulation and regress-test for PartData class */ 19 /** 20 * \file test-partdata.cpp Simulation and regress-test for PartData class 21 */ 20 22 21 23 #ifndef DOXYGEN_SHOULD_SKIP_THIS 22 24 23 #include <hn/partdata.h> 24 #include <hn/log.h> 25 #include <hn/metadata.h> 25 #include <hncore/partdata.h> 26 #include <hnbase/log.h> 27 #include <hncore/metadata.h> 28 26 29 uint32_t file_size(50*1024*1024); 27 30 uint32_t chunk_size(9500*1024); 28 void writeRange(UsedRangePtr ur) { 31 32 void writeRange(Detail::UsedRangePtr ur) { 29 33 logDebug(boost::format("Writing range %d..%d") % ur->begin() % ur->end()); 30 34 while (!ur->isComplete()) try { 31 LockedRangePtr lr = ur->getLock(chunk_size/4);35 Detail::LockedRangePtr lr = ur->getLock(chunk_size/4); 32 36 lr->write(lr->begin(), std::string(lr->length(), '#')); 33 37 } catch (std::runtime_error &e) { … … 35 39 } 36 40 } 41 37 42 void onFileEvent(PartData *, int evt) { 38 43 if (evt == PD_COMPLETE) { … … 40 45 } 41 46 } 47 42 48 void onHashEvent(HashWorkPtr p, HashEvent) { 43 49 PartData *pd = new PartData(file_size, "test.tmp", "final.file"); … … 75 81 } 76 82 } 83 77 84 int main(int, char*[]) { 78 85 std::ofstream ofs("test.ref", std::ios::out); hydranode/hncore/test/test-workthread.cpp
r681 r1846 1 /* *1 /* 2 2 * Copyright (C) 2004-2005 Alo Sarv <madcat_@users.sourceforge.net> 3 3 * … … 17 17 */ 18 18 19 /** @file test-workthread.cpp WorkThread API regress test */ 19 /** 20 * \file test-workthread.cpp WorkThread API regress test 21 */ 20 22 21 #include <hn /workthread.h>22 #include <hn /event.h>23 #include <hncore/workthread.h> 24 #include <hnbase/event.h> 23 25 #include <boost/enable_shared_from_this.hpp> 24 26 hydranode/project-root.jam
r1746 r1846 16 16 toolset.using darwin ; 17 17 } else { 18 using gcc ;18 using gcc : : distcc g++ ; 19 19 } 20 20 }
