/* largest_palindrome_product_all_tests
 *
 */
int largest_palindrome_product_all_tests(void) {

	/* local variables */
	int tests_passed;
	int expected;
	int result;

	tests_passed = 0;

	/* test 1 */
	expected = 906609;
	result = largest_palindrome_product();

	if (result != expected) {
		printf("%s\n", "Test 1 Failed!");
		printf("%s%d%s%d\n", "Expected: ", expected, ". Result: ", result);
	} else {
		tests_passed++;
	}

	/* Currently the largest_palindrome_product function takes no parameters,
	 * so it's not possible to test other values here.
	 *
	 test 2 
	expected = true;
	result = is_palindrome(660066);

	if (result != expected) {
		printf("%s\n", "Test 2 Failed!");
		printf("%s%d%s%d\n", "Expected: ", expected, ". Result: ", result);
	} else {
		tests_passed++;
	}

	 test 3 
	expected = false;
	result = is_palindrome(66006);

	if (result != expected) {
		printf("%s\n", "Test 3 Failed!");
		printf("%s%d%s%d\n", "Expected: ", expected, ". Result: ", result);
	} else {
		tests_passed++;
	}

	 test 4 
	expected = false;
	result = is_palindrome(1111112);

	if (result != expected) {
		printf("%s\n", "Test 4 Failed!");
		printf("%s%d%s%d\n", "Expected: ", expected, ". Result: ", result);
	} else {
		tests_passed++;
	}
  */

	return tests_passed;
}
Esempio n. 2
0
int main(int argc, char* argv[]) {

    const int MIN = 100;
    const int MAX = 999;

    std::cout << "The largest palindrome product of two 3-digit numbers is: ";
    std::cout << largest_palindrome_product(MIN, MAX) << std::endl;

    return 0;
}
Esempio n. 3
0
int main( int argc, char** args )
{
    if( 2 > argc ) { return 1; }
    printf
        (
            "largest palindrome from product is: %" PRIu32 "\n",
            largest_palindrome_product( atol( args[ 1 ] ) )
        );

    return 0;
}