1
0

validate-using-testset-and-group.cpp 607 B

12345678910111213141516171819202122232425262728293031
  1. /**
  2. * Validates input depending on testset and group.
  3. */
  4. #include "testlib.h"
  5. using namespace std;
  6. int main(int argc, char *argv[]) {
  7. registerValidation(argc, argv);
  8. int n, m;
  9. if (validator.testset() == "pretests") {
  10. n = inf.readInt(1, 10, "n");
  11. inf.readSpace();
  12. m = inf.readInt(1, 10, "m");
  13. } else {
  14. n = inf.readInt(1, 100, "n");
  15. inf.readSpace();
  16. m = inf.readInt(1, 100, "m");
  17. }
  18. if (validator.group() == "even-n-and-m") {
  19. ensure(n % 2 == 0);
  20. ensure(m % 2 == 0);
  21. }
  22. inf.readEoln();
  23. inf.readEof();
  24. }