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

Method testBooleanOptionHandler

test/OptionHandlerTest.cc:50–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48CPPUNIT_TEST_SUITE_REGISTRATION(OptionHandlerTest);
49
50void OptionHandlerTest::testBooleanOptionHandler()
51{
52 BooleanOptionHandler handler(PREF_DAEMON);
53 Option option;
54 handler.parse(option, A2_V_TRUE);
55 CPPUNIT_ASSERT_EQUAL(std::string(A2_V_TRUE), option.get(PREF_DAEMON));
56 handler.parse(option, A2_V_FALSE);
57 CPPUNIT_ASSERT_EQUAL(std::string(A2_V_FALSE), option.get(PREF_DAEMON));
58 try {
59 handler.parse(option, "hello");
60 CPPUNIT_FAIL("exception must be thrown.");
61 }
62 catch (Exception& e) {
63 }
64 CPPUNIT_ASSERT_EQUAL(std::string("true, false"),
65 handler.createPossibleValuesString());
66}
67
68void OptionHandlerTest::testNumberOptionHandler()
69{

Callers

nothing calls this directly

Calls 3

parseMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected