本文整理匯總了C++中Nibbler::getDigit4方法的典型用法代碼示例。如果您正苦於以下問題:C++ Nibbler::getDigit4方法的具體用法?C++ Nibbler::getDigit4怎麽用?C++ Nibbler::getDigit4使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Nibbler
的用法示例。
在下文中一共展示了Nibbler::getDigit4方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: main
//.........這裏部分代碼省略.........
n = Nibbler ("\"one\\\"two\"");
t.ok (n.getQuoted ('"', s, false), "\"one\\\"two\" : getQuoted ('\"', true, false) -> true");
t.is (s, "one\\\"two", "getQuoted ('\"', false) -> one\\\"two");
n = Nibbler ("\"one\\\"two\"");
t.ok (n.getQuoted ('"', s, true), "\"one\\\"two\" : getQuoted ('\"', s, true) -> true");
t.is (s, "\"one\\\"two\"", "getQuoted ('\"', s, true) -> \"one\\\"two\"");
n = Nibbler ("\"one\\\\\"");
t.ok (n.getQuoted ('\"', s, true), "\"one\\\" : getQuoted ('\"', s, true) -> true");
t.is (s, "\"one\\\\\"", "getQuoted ('\"', s, true) -> \"one\\\\\"");
n = Nibbler ("\"one\\\\\"");
t.ok (n.getQuoted ('\"', s, false), "one\\ : getQuoted ('\"', s, false) -> true");
t.is (s, "one\\\\", "getQuoted ('\"', s, false) -> \"one\\\\\"");
// bool getDigit (int&);
t.diag ("Nibbler::getDigit");
n = Nibbler ("12x");
t.ok (n.getDigit (i), " '12x' : getDigit () -> true");
t.is (i, 1, " '12x' : getDigit () -> 1");
t.ok (n.getDigit (i), " '2x' : getDigit () -> true");
t.is (i, 2, " '2x' : getDigit () -> 2");
t.notok (n.getDigit (i), " 'x' : getDigit () -> false");
// bool getDigit6 (int&);
t.diag ("Nibbler::getDigit6");
n = Nibbler ("654321");
t.ok (n.getDigit6 (i), " 654321 : getDigit6 () -> true");
t.is (i, 654321, " 654321 : getDigit6 () -> 654321");
// bool getDigit4 (int&);
t.diag ("Nibbler::getDigit4");
n = Nibbler ("4321");
t.ok (n.getDigit4 (i), " 4321 : getDigit4 () -> true");
t.is (i, 4321, " 4321 : getDigit4 () -> 4321");
// bool getDigit2 (int&);
t.diag ("Nibbler::getDigit2");
n = Nibbler ("21");
t.ok (n.getDigit2 (i), " 21 : getDigit2 () -> true");
t.is (i, 21, " 21 : getDigit2 () -> 21");
// bool getInt (int&);
t.diag ("Nibbler::getInt");
n = Nibbler ("123 -4");
t.ok (n.getInt (i), " '123 -4' : getInt () -> true");
t.is (i, 123, " '123 -4' : getInt () -> '123'");
t.ok (n.skip (' '), " ' -4' : skip (' ') -> true");
t.ok (n.getInt (i), " '-4' : getInt () -> true");
t.is (i, -4, " '-4' : getInt () -> '-4'");
t.ok (n.depleted (), " '' : depleted () -> true");
// bool getUnsignedInt (int&i);
t.diag ("Nibbler::getUnsignedInt");
n = Nibbler ("123 4");
t.ok (n.getUnsignedInt (i), " '123 4' : getUnsignedInt () -> true");
t.is (i, 123, " '123 4' : getUnsignedInt () -> '123'");
t.ok (n.skip (' '), " ' 4' : skip (' ') -> true");
t.ok (n.getUnsignedInt (i), " '4' : getUnsignedInt () -> true");
t.is (i, 4, " '4' : getUnsignedInt () -> '4'");
t.ok (n.depleted (), " '' : depleted () -> true");
// bool getNumber (double&);
t.diag ("Nibbler::getNumber");