本文整理汇总了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");