jd4 icon indicating copy to clipboard operation
jd4 copied to clipboard

New cases file format

Open iceboy233 opened this issue 8 years ago • 5 comments

  • Use yaml as config
  • Case insensitive
  • Recursive
  • Cover all existing use cases
  • Automatically convertible from "legacy case"
  • Support special judge

Initial thinking:

time: 1s
memory: 16m
score: 10
children:
- input: input/input0.txt
  output: output/output0.txt
- input: input/input1.txt
  output: output/output1.txt
- judge:
    file: judge.cc
    lang: cc
    time: 5s
    memory: 64m
    data: ['data/state', 'data/transition']
  score: 30
  children:
  - input: input/input2.txt
    data: data/state
    memory: 32m
  - input: input/input3.txt
    data: data/state
    score: 50
    memory: 2048m

This is an extreme case. Normal config should be much simpler.

iceboy233 avatar May 19 '17 20:05 iceboy233

YAML is quite unfriendly to beginners.

q234rty avatar Jul 04 '17 10:07 q234rty

Could you please explain in more details? @iceb0y

twd2 avatar Aug 26 '17 15:08 twd2

TOML seems simpler and maybe better for this purpose.

q234rty avatar Oct 29 '17 04:10 q234rty

Looks like yaml supports inheritance by itself.

The proposed config can be rewritten as:

default: &default
  time: 1s
  memory: 16m
  score: 10
default2: &default2
  <<: *default
  judge:
    file: judge.cc
    lang: cc
    time: 5s
    memory: 64m
    data: ['data/state', 'data/transition']
  score: 30
cases:
- <<: *default
  input: input/input0.txt
  output: output/output0.txt
- <<: *default
  input: input/input1.txt
  output: output/output1.txt
- <<: *default2
  input: input/input2.txt
  data: data/state
  memory: 32m
- <<: *default2
  input: input/input3.txt
  data: data/state
  score: 50
  memory: 2048m

Parse result:

[{'input': 'input/input0.txt',
  'memory': '16m',
  'output': 'output/output0.txt',
  'score': 10,
  'time': '1s'},
 {'input': 'input/input1.txt',
  'memory': '16m',
  'output': 'output/output1.txt',
  'score': 10,
  'time': '1s'},
 {'data': 'data/state',
  'input': 'input/input2.txt',
  'judge': {'data': ['data/state', 'data/transition'],
            'file': 'judge.cc',
            'lang': 'cc',
            'memory': '64m',
            'time': '5s'},
  'memory': '32m',
  'score': 30,
  'time': '1s'},
 {'data': 'data/state',
  'input': 'input/input3.txt',
  'judge': {'data': ['data/state', 'data/transition'],
            'file': 'judge.cc',
            'lang': 'cc',
            'memory': '64m',
            'time': '5s'},
  'memory': '2048m',
  'score': 50,
  'time': '1s'}]

iceboy233 avatar Nov 18 '17 22:11 iceboy233

https://github.com/vstakhov/libucl is another option

iceboy233 avatar May 16 '18 20:05 iceboy233