summaryrefslogtreecommitdiffstats
path: root/tests/coverage/conditions.rs
blob: fa7f2a116c21e6367ea83d7513328b12778d0f44 (plain)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#![allow(unused_assignments, unused_variables)]

fn main() {
    let mut countdown = 0;
    if true {
        countdown = 10;
    }

    const B: u32 = 100;
    let x = if countdown > 7 {
        countdown -= 4;
        B
    } else if countdown > 2 {
        if countdown < 1 || countdown > 5 || countdown != 9 {
            countdown = 0;
        }
        countdown -= 5;
        countdown
    } else {
        return;
    };

    let mut countdown = 0;
    if true {
        countdown = 10;
    }

    if countdown > 7 {
        countdown -= 4;
    } else if countdown > 2 {
        if countdown < 1 || countdown > 5 || countdown != 9 {
            countdown = 0;
        }
        countdown -= 5;
    } else {
        return;
    }

    if true {
        let mut countdown = 0;
        if true {
            countdown = 10;
        }

        if countdown > 7 {
            countdown -= 4;
        }
        else if countdown > 2 {
            if countdown < 1 || countdown > 5 || countdown != 9 {
                countdown = 0;
            }
            countdown -= 5;
        } else {
            return;
        }
    }

    let mut countdown = 0;
    if true {
        countdown = 1;
    }

    let z = if countdown > 7 {
        countdown -= 4;
    } else if countdown > 2 {
        if countdown < 1 || countdown > 5 || countdown != 9 {
            countdown = 0;
        }
        countdown -= 5;
    } else {
        let should_be_reachable = countdown;
        println!("reached");
        return;
    };

    let w = if countdown > 7 {
        countdown -= 4;
    } else if countdown > 2 {
        if countdown < 1 || countdown > 5 || countdown != 9 {
            countdown = 0;
        }
        countdown -= 5;
    } else {
        return;
    };
}