mln-rs-util 0.0.13

Part of mln-rs, a Rust port of the MapLibre Native map rendering core. Depend on mln-rs instead.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::string::{to_hex_u64, to_string_double};

// gtest: ToString.FloatingPoint
#[test]
fn floating_point() {
    assert_eq!("0", to_string_double(0.0));
    assert_eq!("1.33", to_string_double(1.33));
    assert_eq!("-1", to_string_double(-1.0));
    assert_eq!("12340000000", to_string_double(12_340_000_000.0));
    assert_eq!("12340000000", to_string_double(12_340_000_000.0));
}

// gtest: ToHex.SIZE_T
#[test]
fn size_t() {
    // INTPTR_MAX == INT64_MAX
    assert_eq!("a715b247df38cc29", to_hex_u64(0xa715_b247_df38_cc29));
}