MCPcopy Create free account
hub / github.com/aria2/aria2 / testFloatNumberOptionHandler_min_max

Method testFloatNumberOptionHandler_min_max

test/OptionHandlerTest.cc:242–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

240}
241
242void OptionHandlerTest::testFloatNumberOptionHandler_min_max()
243{
244 FloatNumberOptionHandler handler(PREF_TIMEOUT, "", "", 0.0, 10.0);
245 Option option;
246 handler.parse(option, "0.0");
247 CPPUNIT_ASSERT_EQUAL(std::string("0.0"), option.get(PREF_TIMEOUT));
248 handler.parse(option, "10.0");
249 CPPUNIT_ASSERT_EQUAL(std::string("10.0"), option.get(PREF_TIMEOUT));
250 try {
251 handler.parse(option, "-0.1");
252 CPPUNIT_FAIL("exception must be thrown.");
253 }
254 catch (Exception& e) {
255 }
256 try {
257 handler.parse(option, "10.1");
258 CPPUNIT_FAIL("exception must be thrown.");
259 }
260 catch (Exception& e) {
261 }
262 CPPUNIT_ASSERT_EQUAL(std::string("0.0-10.0"),
263 handler.createPossibleValuesString());
264}
265
266void OptionHandlerTest::testHttpProxyOptionHandler()
267{

Callers

nothing calls this directly

Calls 3

parseMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected