use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Account {
pub mid: u64,
pub name: String,
pub sex: String,
pub face: String,
pub sign: String,
pub rank: u32,
pub birthday: i64,
pub is_fake_account: u32,
pub is_deleted: u32,
pub in_reg_audit: u32,
pub is_senior_member: u32,
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn account_deserializes_negative_birthday_timestamp() {
let account: Account = serde_json::from_str(
r#"{
"mid": 1000001,
"name": "sanitized",
"sex": "保密",
"face": "",
"sign": "",
"rank": 10000,
"birthday": -1,
"is_fake_account": 0,
"is_deleted": 0,
"in_reg_audit": 0,
"is_senior_member": 0
}"#,
)
.expect("account should parse negative birthday timestamps");
assert_eq!(account.birthday, -1);
}
}