Блог пользователя albertolg101

Автор albertolg101, история, 4 года назад, По-английски

Sometimes, when we are training we do not have the possibility to send our answer to an OJ (we do not have internet or the link to send this exercise) but we have the test cases of these problems, for example I have the CIIC, CEOI, USACO and IOI statements and test case. The thing is, is there an application for macOS such that having the test cases already generated and the code of the exercise will evaluate your solution on your own machine?

  • Проголосовать: нравится
  • +13
  • Проголосовать: не нравится

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Shell script?

  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    It would be a great idea but I don't know how to code it :/ in fact that would be better than a desktop application

    • »
      »
      »
      4 года назад, # ^ |
        Проголосовать: нравится +8 Проголосовать: не нравится

      Most basic version is something like this (I'm not sure it's 100% the same on macOS, but it should Linux with zsh and IIRC macOS is also on zsh).

      for i in `seq 1 100`; do
          ./sol < input${i}.txt > out.txt
          diff out.txt output${i}.txt
      done
      

      (Assuming you have 100 input-output files with names like input33.txt and output33.txt)

      • »
        »
        »
        »
        4 года назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        Adding to this, instead of having to rename your files to inputXX.txt format, there should also be a way to iterate over all files in a directory, in zsh. So you can google that.

      • »
        »
        »
        »
        4 года назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        Can you give me some documentation or link where I can learn that language and how to develop a script. It's something I've never done

»
4 года назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

I remember using ineffable in the past on Ubuntu, I guess it should also work in MacOS.

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I work on mac, and I think that xalanq's cf-tool works pretty well. You can check it out on his blog here: https://codeforces.com/blog/entry/66552