1
use ron::value::{Number, Value};
2

            
3
#[test]
4
4
fn test_large_number() {
5
4
    let test_var = Value::Number(Number::new(10000000000000000000000.0f64));
6
4
    let test_ser = ron::ser::to_string(&test_var).unwrap();
7
4
    let test_deser = ron::de::from_str::<Value>(&test_ser);
8
4

            
9
4
    assert_eq!(
10
4
        test_deser.unwrap(),
11
4
        Value::Number(Number::new(10000000000000000000000.0))
12
4
    );
13
4
}
14

            
15
#[test]
16
4
fn test_large_integer_to_float() {
17
    use ron::value::Number;
18
4
    let test_var = std::u64::MAX as u128 + 1;
19
4
    let test_ser = test_var.to_string();
20
4
    let test_deser = ron::de::from_str::<Value>(&test_ser);
21
4

            
22
4
    #[cfg(not(feature = "integer128"))]
23
4
    assert_eq!(
24
4
        test_deser.unwrap(),
25
4
        Value::Number(Number::F32((test_var as f32).into())), // f64 representation matches f32
26
4
    );
27
2
    #[cfg(feature = "integer128")]
28
2
    assert_eq!(test_deser.unwrap(), Value::Number(Number::U128(test_var)),);
29
4
}