// testIsNaturalNumber2.cpp
#include "textUtility.h" // includes <iostream> and <string>
void test(string text, bool should);
int main()
{
test("0", true);
test("-1", false);
test("9", true);
test("-9", false);
test("2147483647", true);
test("-2147483648", false);
test("000000000000000000002147483647", true);
test("-000000000000000000002147483648", false);
test("2147483648", true);
test("-2147483649", false);
test("-2147483650", false);
test("-2147500000", false);
test("123456789012345678901234567890", true);
pause();
test("-", false);
test("0-", false);
test("/", false);
test("-/", false);
test(":", false);
test("-:", false);
test("a2", false);
test("2a", false);
cout << endl << "Empty string:" << endl;
test("", false); // empty String literal ""
} // function main
void test(string text, bool should)
{
bool testTrue = isNaturalNumber(text);
cout << "Your function ";
bool correct = (testTrue == should) || (testTrue && should);
cout << ( correct ? "CORRECTLY" : "INCORRECTLY" );
cout << " says \"" << text << "\" ";
cout << ( testTrue ? "DOES" : "does NOT" );
cout << " represent a natural number." << endl;
} // function testIsNaturalNumber