/* sum_multiples_all_tests * */ int sum_multiples_all_tests(void){ /* local variables */ int tests_passed; int expected; int result; tests_passed = 0; /* test 1 */ expected = 23; result = sum_multiples(3, 5, 10); if (result != expected) { printf("%s\n", "Test 1 Failed!"); printf("%s%d%s%d\n", "Expected: ", expected, ". Result: ", result); } else { tests_passed++; } /* test 2 */ expected = 233168; result = sum_multiples(3, 5, 1000); 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 = 64; result = sum_multiples(4, 6, 20); 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 = 105; result = sum_multiples(3, 7, 23); 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; }
int main() { printf("%d\n", sum_multiples(1000, 3, 5)); }