1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Deserialize, Serialize)]
5pub struct Account {
6 pub mid: u64,
8 pub name: String,
10 pub sex: String,
12 pub face: String,
14 pub sign: String,
16 pub rank: u32,
18 pub birthday: i64,
20 pub is_fake_account: u32,
22 pub is_deleted: u32,
24 pub in_reg_audit: u32,
26 pub is_senior_member: u32,
28}
29
30#[cfg(test)]
31mod tests {
32 use super::*;
33
34 #[test]
35 fn account_deserializes_negative_birthday_timestamp() {
36 let account: Account = serde_json::from_str(
37 r#"{
38 "mid": 1000001,
39 "name": "sanitized",
40 "sex": "保密",
41 "face": "",
42 "sign": "",
43 "rank": 10000,
44 "birthday": -1,
45 "is_fake_account": 0,
46 "is_deleted": 0,
47 "in_reg_audit": 0,
48 "is_senior_member": 0
49 }"#,
50 )
51 .expect("account should parse negative birthday timestamps");
52
53 assert_eq!(account.birthday, -1);
54 }
55}