1
use serde::{Deserialize, Serialize};
2

            
3
40
#[derive(Debug, Eq, PartialEq, Serialize, Deserialize)]
4
struct S {
5
    a: i8,
6
    b: i16,
7
    c: i32,
8
    d: i64,
9
    #[cfg(feature = "integer128")]
10
    e: i128,
11
    f: u8,
12
    g: u16,
13
    h: u32,
14
    i: u64,
15
    #[cfg(feature = "integer128")]
16
    j: u128,
17
}
18

            
19
#[test]
20
4
fn roundtrip() {
21
4
    let s = S {
22
4
        a: std::i8::MIN,
23
4
        b: std::i16::MIN,
24
4
        c: std::i32::MIN,
25
4
        d: std::i64::MIN,
26
4
        #[cfg(feature = "integer128")]
27
4
        e: std::i128::MIN,
28
4
        f: std::u8::MAX,
29
4
        g: std::u16::MAX,
30
4
        h: std::u32::MAX,
31
4
        i: std::u64::MAX,
32
4
        #[cfg(feature = "integer128")]
33
4
        j: std::u128::MAX,
34
4
    };
35
4
    let serialized = ron::ser::to_string(&s).unwrap();
36
4
    let deserialized = ron::de::from_str(&serialized).unwrap();
37
4
    assert_eq!(s, deserialized,);
38
4
}