Skip to content

Commit

Permalink
validation.h: Add always-strict AnswerValidator : Validator
Browse files Browse the repository at this point in the history
  • Loading branch information
RagnarGrootKoerkamp committed Feb 3, 2024
1 parent dcec8be commit d2f1f1b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions headers/validation.h
Original file line number Diff line number Diff line change
Expand Up @@ -1469,3 +1469,11 @@ class OutputValidator : public Validator {
return false;
}
};

class AnswerValidator : public Validator {
public:
// An OutputValidator can be run in different modes.
explicit AnswerValidator(int argc, char** argv, std::istream& in_ = std::cin)
: Validator(/*ws_sensitive=*/true, /*space sensitive*/ true, in_,
get_constraints_file(argc, argv)) {}
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "validation.h"

int main(int argc, char** argv) {
OutputValidator v(argc, argv);
AnswerValidator v(argc, argv);
int answer = v.read_integer("answer", 0, 1000);
v.newline();
}

0 comments on commit d2f1f1b

Please sign in to comment.