about summary refs log tree commit diff
path: root/src/test/stdtest/bool.rs
blob: 528e8e42681acf8fa83a3bd378a134a1ec6d82ed (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
import core::*;

use std;

import bool;

#[test]
fn test_bool_from_str() {
    bool::all_values { |v|
        assert v == bool::from_str(bool::to_str(v))
    }
}

#[test]
fn test_bool_to_str() {
    assert bool::to_str(false) == "false";
    assert bool::to_str(true) == "true";
}

#[test]
fn test_bool_to_bit() {
    bool::all_values { |v|
        assert bool::to_bit(v) == if bool::is_true(v) { 1u8 } else { 0u8 };
    }
}