yesno.cpp 816 B

123456789101112131415161718192021222324252627
  1. #include "testlib.h"
  2. #include <string>
  3. using namespace std;
  4. const string YES = "YES";
  5. const string NO = "NO";
  6. int main(int argc, char * argv[])
  7. {
  8. setName("%s", (YES + " or " + NO + " (case insensetive)").c_str());
  9. registerTestlibCmd(argc, argv);
  10. std::string ja = upperCase(ans.readWord());
  11. std::string pa = upperCase(ouf.readWord());
  12. if (ja != YES && ja != NO)
  13. quitf(_fail, "%s or %s expected in answer, but %s found", YES.c_str(), NO.c_str(), compress(ja).c_str());
  14. if (pa != YES && pa != NO)
  15. quitf(_pe, "%s or %s expected, but %s found", YES.c_str(), NO.c_str(), compress(pa).c_str());
  16. if (ja != pa)
  17. quitf(_wa, "expected %s, found %s", compress(ja).c_str(), compress(pa).c_str());
  18. quitf(_ok, "answer is %s", ja.c_str());
  19. }