Nibbler: Removed unused ::getDigit6 method

This commit is contained in:
Paul Beckingham 2015-10-29 23:46:48 -04:00
parent 88469fc5f9
commit 119827e4e1
3 changed files with 1 additions and 31 deletions

View file

@ -252,29 +252,6 @@ bool Nibbler::getDigit (int& result)
return false; return false;
} }
////////////////////////////////////////////////////////////////////////////////
bool Nibbler::getDigit6 (int& result)
{
auto i = _cursor;
if (i < _length &&
_length - i >= 6)
{
if (Lexer::isDigit ((*_input)[i + 0]) &&
Lexer::isDigit ((*_input)[i + 1]) &&
Lexer::isDigit ((*_input)[i + 2]) &&
Lexer::isDigit ((*_input)[i + 3]) &&
Lexer::isDigit ((*_input)[i + 4]) &&
Lexer::isDigit ((*_input)[i + 5]))
{
result = strtoimax (_input->substr (_cursor, 6).c_str (), NULL, 10);
_cursor += 6;
return true;
}
}
return false;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool Nibbler::getDigit4 (int& result) bool Nibbler::getDigit4 (int& result)
{ {

View file

@ -50,7 +50,6 @@ public:
bool getN (const int, std::string&); bool getN (const int, std::string&);
bool getQuoted (char, std::string&, bool quote = false); bool getQuoted (char, std::string&, bool quote = false);
bool getDigit (int&); bool getDigit (int&);
bool getDigit6 (int&);
bool getDigit4 (int&); bool getDigit4 (int&);
bool getDigit3 (int&); bool getDigit3 (int&);
bool getDigit2 (int&); bool getDigit2 (int&);

View file

@ -35,7 +35,7 @@ Context context;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
int main (int, char**) int main (int, char**)
{ {
UnitTest t (254); UnitTest t (252);
// Ensure environment has no influence. // Ensure environment has no influence.
unsetenv ("TASKDATA"); unsetenv ("TASKDATA");
@ -219,12 +219,6 @@ int main (int, char**)
t.is (i, 2, " '2x' : getDigit () -> 2"); t.is (i, 2, " '2x' : getDigit () -> 2");
t.notok (n.getDigit (i), " 'x' : getDigit () -> false"); 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&); // bool getDigit4 (int&);
t.diag ("Nibbler::getDigit4"); t.diag ("Nibbler::getDigit4");
n = Nibbler ("4321"); n = Nibbler ("4321");