int main(void) { printf("%f\n", Game24Points(7, 2, 1, 10)); printf("%f\n", Game24Points(7, 2, 2, 10)); printf("%f\n\n", Game24PointsEx("7 2 2 10")); printf("%f\n", Game24PointsEx("1 5 5 5")); printf("%f\n", Game24PointsEx("1 7 6 7")); printf("%f\n", Game24PointsEx("3 3 8 8")); printf("%f\n", Game24PointsEx("9 9 7 5")); printf("%f\n", Game24PointsEx("1 9 1 7")); return 0; }
double Game24PointsEx(char *str) { int a, b, c, d; sscanf(str, "%d %d %d %d", &a, &b, &c, &d); return Game24Points(a, b, c, d); }
void CExampleTest::TestCase01_2() { return CPPUNIT_ASSERT(Game24Points(1, 2, 3, 4) == true); }
void CExampleTest::TestCase01_3() { return CPPUNIT_ASSERT(Game24Points(7, 7, 7, 7) == false); }
/* ----------用例------------- */ void CExampleTest::TestCase01_1() { return CPPUNIT_ASSERT(Game24Points(7, 2, 1, 10) == true); }