Verify the checker

Getting input and validation

  • read arguments from argv but only valid 32-bit integers
  • check duplicates
  • receive arguments via command line (./checker -i 500.in -p -o 500.out -e 500.ops -v)
    • -i 500.in, a file with number (either on lines or separated by spaces), if not specified, then the stack elements shall come after the arguments.
    • -p pause whenever using pa (if -v is specified, then pause ncurses, if not write some indicator to the file)
    • -o 500.out write an output file (if name was not specified, default is foobar.out)
    • -e 500.out export push_swap operations to a file (if name was not specified, default is foobar.ops
    • -v visualising with ncurses

Reading operators and process

  • read stack_a from argv[]
  • read operators list from stdin
  • verify each operator
  • apply the list of operators on stack_a, any failure will stop the process, and output KO, otherwise it shall output OK
Edited by Anas Rchid