-
Notifications
You must be signed in to change notification settings - Fork 29
Configuring testcases
Nattee Niparnan edited this page Sep 14, 2025
·
4 revisions
Each testcase in cafe-grader has several configurable properties. You can adjust them through the Testcase Params interface.
| Property | Description |
|---|---|
num |
The order/index of the testcase. Testcases in the same group are sorted by this value. |
code_name |
The name of the testcase, usually based on the testcase filename when imported. This is only for display. |
group |
Numeric group ID. Testcases with the same group value are bundled together to form a grouped testcase. |
group_name |
A human-friendly label for a group. This is only for display. Grouping logic uses group. You may reuse the same group_name for different groups. |
weight |
The scoring weight of the testcase, controlling how much it contributes to the total score. |
- Go to the Problem Edit page of a specific problem and click on the "Testcases" tab under the "Datasets" section. There will be the Testcase config field.
- Enter a parameter string using one of the supported formats below.
- Click Set to apply.
You can set weight, group, or group_name this way.
[w1, w2, w3, ..., wk]
- This sets only
weightbut not any other property. - Assigns values sequentially.
- Example:
[10, 20, 30]sets the first testcase’s weight to10, the second to20, the third to30.
[[c1, v1], [c2, v2], ..., [ck, vk]]
- This sets both the
weightandgroup. - Assigns values in bulk and automatically bundle testcases in the same bulk into the same group.
-
c1= number of testcases,v1= weight value. Thesec1testcases will be grouped together. - Example:
[[3, 10], [2, 20]]means first 3 testcases → weight10and bundled intoGroup 1, next 2 testcases → weight20and bundled intoGroup 2. - This follows the format of IOI CMS (https://cms.readthedocs.io/en/v1.4/Score%20types.html#groupmin)
{
"property_name": array_or_counting_form
}
-
property_namemust be one of:weight,group, orgroup_name. - The value can be either a simple array or a counting form. For the run-length form, the value is assigned to the specific property only without setting the group.
- Multiple properties can be set together.
| Input | Effect |
|---|---|
[10,10,10,20,20] |
First 3 testcases → weight 10, next 2 → weight 20. |
[[3,10],[2,20]] |
Same as above using counting form. |
{"weight": [[3,10],[2,20]]} |
Uses JSON object to set weights. |
{"group": [1,1,1], "weight": [[3,10],[2,20]]} |
First 3 testcases → group 1 with weight 10, next 2 → weight 20 without changing their groups. |
{"group_name": [[4,"somchai"]]} |
First 4 testcases → group_name "somchai". |
-
Grouping logic: Only
group(numeric) determines grouping.group_nameis just a label. - Partial lists: If you provide fewer entries than the total number of testcases, the remaining testcases keep their old configuration.
-
Strings: Always use quotes around strings in JSON (e.g.
"somchai"). - Combining properties: JSON form lets you update multiple properties in a single parameter string.