File: template.py

package info (click to toggle)
scap-security-guide 0.1.76-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 110,644 kB
  • sloc: xml: 241,883; sh: 73,777; python: 32,527; makefile: 27
file content (42 lines) | stat: -rw-r--r-- 1,757 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
def preprocess(data, lang):
    data["zero_comparison_operation"] = data.get("zero_comparison_operation", None)

    if "greater" in data["operation"]:
        if data["zero_comparison_operation"]:
            if "greater" in data["zero_comparison_operation"]:
                data["test_var_value"] = "-2"
                data["test_correct_value"] = "1"
                data["test_wrong_value"] = "-3"
                data["test_wrong_vs_zero_value"] = "-1"
            elif "less" in data["zero_comparison_operation"]:
                data["test_var_value"] = "-2"
                data["test_correct_value"] = "-1"
                data["test_wrong_value"] = "-3"
                data["test_wrong_vs_zero_value"] = "1"
        else:
            data["test_var_value"] = "0"
            data["test_correct_value"] = "1"
            data["test_wrong_value"] = "-1"

    elif "less" in data["operation"]:
        if data["zero_comparison_operation"]:
            if "greater" in data["zero_comparison_operation"]:
                data["test_var_value"] = "2"
                data["test_correct_value"] = "1"
                data["test_wrong_value"] = "3"
                data["test_wrong_vs_zero_value"] = "-1"
            elif "less" in data["zero_comparison_operation"]:
                data["test_var_value"] = "2"
                data["test_correct_value"] = "-1"
                data["test_wrong_value"] = "3"
                data["test_wrong_vs_zero_value"] = "1"
        else:
            data["test_var_value"] = "0"
            data["test_correct_value"] = "-1"
            data["test_wrong_value"] = "1"
    else:
        data["test_var_value"] = "0"
        data["test_correct_value"] = "0"
        data["test_wrong_value"] = "1"

    return data