mirror of
https://github.com/aria2/aria2.git
synced 2025-01-24 10:41:18 +00:00
3cc1ed5e09
gcc 3.4.4 support: * src/DefaultBtContext.cc: int32_t -> int * src/main.cc: int -> int32_t, int32_t -> int * src/messageDigest.h: uint32_t -> unsigned int * src/NameResolver.h: int32_t -> int * src/PeerConnection.cc: int -> int32_t * src/SpeedCalc.cc: int32_t -> int * src/TrackerUpdateCommand.h: int -> int32_t * src/Util.cc: int32_t -> int * src/Util.h: int32_t -> int * src/Xml2MetalinkProcessor.cc: int -> uint32_t, int64_t -> uint64_t * test/AnnounceListTest.cc: int -> int32_t * test/ChunkedEncodingTest.cc: int -> int32_t * test/DataTest.cc: int -> int32_t * test/DefaultBtRequestFactoryTest.cc: int -> int32_t * test/DefaultPeerListProcessorTest.cc: int -> int32_t * test/DefaultPieceStorageTest.cc: int -> int32_t * test/FeatureConfigTest.cc: int -> int32_t * test/MetalinkEntryTest.cc: int -> int32_t * test/MockBtRequestFactory.h: int -> int32_t * test/MockPieceStorage.h: int -> int32_t * test/OptionTest.cc: int -> int32_t * test/RequestTest.cc: int -> int32_t * test/SegmentManTest.cc: int -> int32_t * test/Xml2MetalinkProcessorTest.cc: int -> int32_t
50 lines
990 B
C++
50 lines
990 B
C++
#include "Option.h"
|
|
#include <string>
|
|
#include <cppunit/extensions/HelperMacros.h>
|
|
|
|
using namespace std;
|
|
|
|
class OptionTest:public CppUnit::TestFixture {
|
|
|
|
CPPUNIT_TEST_SUITE(OptionTest);
|
|
CPPUNIT_TEST(testPutAndGet);
|
|
CPPUNIT_TEST(testPutAndGetAsInt);
|
|
CPPUNIT_TEST(testPutAndGetAsDouble);
|
|
CPPUNIT_TEST_SUITE_END();
|
|
private:
|
|
|
|
public:
|
|
void setUp() {
|
|
}
|
|
|
|
void testPutAndGet();
|
|
void testPutAndGetAsInt();
|
|
void testPutAndGetAsDouble();
|
|
};
|
|
|
|
|
|
CPPUNIT_TEST_SUITE_REGISTRATION( OptionTest );
|
|
|
|
void OptionTest::testPutAndGet() {
|
|
Option op;
|
|
op.put("key", "value");
|
|
|
|
CPPUNIT_ASSERT(op.defined("key"));
|
|
CPPUNIT_ASSERT_EQUAL(string("value"), op.get("key"));
|
|
}
|
|
|
|
void OptionTest::testPutAndGetAsInt() {
|
|
Option op;
|
|
op.put("key", "1000");
|
|
|
|
CPPUNIT_ASSERT(op.defined("key"));
|
|
CPPUNIT_ASSERT_EQUAL((int32_t)1000, op.getAsInt("key"));
|
|
}
|
|
|
|
void OptionTest::testPutAndGetAsDouble() {
|
|
Option op;
|
|
op.put("key", "10.0");
|
|
|
|
CPPUNIT_ASSERT_EQUAL(10.0, op.getAsDouble("key"));
|
|
}
|