# Test groups¶

A test group is a set of test cases that are assigned/included to the same set of subtasks. If your problem has subtasks, then instead of writing `TestCases()` method, you will be writing `TestGroupX()` methods instead, where `X` is the test group number.

For the whole test cases to be strong, a test case should be assigned in multiple subtasks if possible. In other words, several subtasks may share some test cases. In tcframe, a test case must be assigned to a subtask if (and only if) it satisfies the constraints of that subtask.

## Designing test groups¶

In this example, we will use this subtasking scheme:

- N = 1
- 1 ≤ K ≤ 100

- 1 ≤ N ≤ 100
- K = 1

- 1 ≤ N ≤ 100
- 1 ≤ K ≤ 100

Our advice on designing test groups is as follows.

First, create a Venn diagram denoting the valid test cases for all subtasks. For this problem, the diagram will be like this: In order to have a strong set of test cases, we should create a test group for each closed region in the Venn diagram. In this case, we will have four test groups as follows:

• Test group 1: consists of only one test case N = K = 1. Assign it to subtasks {1, 2, 3}.
• Test group 2: generate test cases that satisfy N = 1; 2 ≤ K ≤ 100. Assign them to subtasks {1, 3}.
• Test group 3: generate test cases that satisfy 2 ≤ N ≤ 100; K = 1. Assign them to subtasks {2, 3}.
• Test group 4: generate test cases that satisfy 2 ≤ N, K ≤ 100. Assign them to subtasks {3}.

## Test group definitions¶

To define test groups, write each of the methods `TestGroupX()`, where `X` is a positive integer denoting the test group number, starting from 1. Then, call the `Subtasks(S)` method as the first statement, where `S` is a set of subtask numbers. The remaining bodies of test group methods are test case definitions. For the above example:

```void TestGroup1() {
// CASE() calls follow
}
void TestGroup2() {
// CASE() calls follow
}
void TestGroup3() {
Each test case definition will be realized as a pair of input/output files, with the following filenames: `<slug>_<group-number>_<case-number>.in` and `<slug>_<group-number>_<case-number>.out`. For example, `sum_2_3.in`, `sum_2_3.out`.