2006-08-27 12:49:17 +00:00
|
|
|
#include "TimeSeedCriteria.h"
|
2009-02-10 14:53:32 +00:00
|
|
|
|
2006-08-27 12:49:17 +00:00
|
|
|
#include <cppunit/extensions/HelperMacros.h>
|
2008-02-08 15:53:45 +00:00
|
|
|
|
2009-10-22 15:35:33 +00:00
|
|
|
#include "util.h"
|
2009-02-10 14:53:32 +00:00
|
|
|
|
2008-02-08 15:53:45 +00:00
|
|
|
namespace aria2 {
|
2006-08-27 12:49:17 +00:00
|
|
|
|
|
|
|
class TimeSeedCriteriaTest:public CppUnit::TestFixture {
|
|
|
|
|
|
|
|
CPPUNIT_TEST_SUITE(TimeSeedCriteriaTest);
|
|
|
|
CPPUNIT_TEST(testEvaluate);
|
|
|
|
CPPUNIT_TEST_SUITE_END();
|
|
|
|
|
|
|
|
public:
|
|
|
|
void testEvaluate();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
CPPUNIT_TEST_SUITE_REGISTRATION(TimeSeedCriteriaTest);
|
|
|
|
|
|
|
|
void TimeSeedCriteriaTest::testEvaluate() {
|
|
|
|
TimeSeedCriteria cri(1);
|
2009-02-10 14:53:32 +00:00
|
|
|
// Seel 2seconds. 1 seconds are not enough in some systems.
|
2009-10-22 15:09:00 +00:00
|
|
|
util::sleep(2);
|
2006-08-27 12:49:17 +00:00
|
|
|
CPPUNIT_ASSERT(cri.evaluate());
|
|
|
|
cri.reset();
|
|
|
|
cri.setDuration(10);
|
|
|
|
CPPUNIT_ASSERT(!cri.evaluate());
|
|
|
|
}
|
2008-02-08 15:53:45 +00:00
|
|
|
|
|
|
|
} // namespace aria2
|