about summary refs log tree commit diff
path: root/src/tools/miri/tests/pass/bools.rs
blob: 30fc14704d9d0aece08f0e3b5a5067bc7249586d (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
fn boolean() -> bool {
    true
}

fn if_false() -> i64 {
    let c = false;
    if c { 1 } else { 0 }
}

fn if_true() -> i64 {
    let c = true;
    if c { 1 } else { 0 }
}

fn match_bool() -> i16 {
    let b = true;
    match b {
        true => 1,
        _ => 0,
    }
}

fn main() {
    assert!(boolean());
    assert_eq!(if_false(), 0);
    assert_eq!(if_true(), 1);
    assert_eq!(match_bool(), 1);
    assert_eq!(true == true, true);
}