// Copyright 2023-2024 Shin Yoshida // // "GPL-3.0-only" // // This is part of BSN1_SERDE // // BSN1_SERDE is free software: you can redistribute it and/or modify it under the terms of the // GNU General Public License as published by the Free Software Foundation, version 3. // // BSN1_SERDE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public License along with this program. If // not, see . use bsn1_serde::{from_ber, from_der, to_ber, to_der}; #[derive(bsn1_serde::Serialize, bsn1_serde::Deserialize, Debug, PartialEq)] struct A; #[derive(bsn1_serde::Serialize, bsn1_serde::Deserialize, Debug, PartialEq)] #[bsn1_serde] struct B; #[derive(bsn1_serde::Serialize, bsn1_serde::Deserialize, Debug, PartialEq)] #[bsn1_serde(id = Sequence)] struct C; #[derive(bsn1_serde::Serialize, bsn1_serde::Deserialize, Debug, PartialEq)] #[bsn1_serde(tag_class = PRIVATE)] struct D; #[derive(bsn1_serde::Serialize, bsn1_serde::Deserialize, Debug, PartialEq)] #[bsn1_serde(id = Sequence, tag_class = PRIVATE)] struct E; #[derive(bsn1_serde::Serialize, bsn1_serde::Deserialize, Debug, PartialEq)] #[bsn1_serde(tag_pc = PRIMITIVE)] struct F; #[derive(bsn1_serde::Serialize, bsn1_serde::Deserialize, Debug, PartialEq)] #[bsn1_serde(id = Sequence, tag_pc = PRIMITIVE)] struct G; #[derive(bsn1_serde::Serialize, bsn1_serde::Deserialize, Debug, PartialEq)] #[bsn1_serde(tag_class = PRIVATE, tag_pc = PRIMITIVE)] struct H; #[derive(bsn1_serde::Serialize, bsn1_serde::Deserialize, Debug, PartialEq)] #[bsn1_serde(id = Sequence, tag_class = PRIVATE, tag_pc = PRIMITIVE)] struct I; #[derive(bsn1_serde::Serialize, bsn1_serde::Deserialize, Debug, PartialEq)] #[bsn1_serde(tag_num = 0)] struct J; #[derive(bsn1_serde::Serialize, bsn1_serde::Deserialize, Debug, PartialEq)] #[bsn1_serde(id = Sequence, tag_num = 1)] struct K; #[derive(bsn1_serde::Serialize, bsn1_serde::Deserialize, Debug, PartialEq)] #[bsn1_serde(tag_class = PRIVATE, tag_num = 0x1e)] struct L; #[derive(bsn1_serde::Serialize, bsn1_serde::Deserialize, Debug, PartialEq)] #[bsn1_serde(id = Sequence, tag_class = PRIVATE, tag_num = 0x1f)] struct M; #[derive(bsn1_serde::Serialize, bsn1_serde::Deserialize, Debug, PartialEq)] #[bsn1_serde(tag_pc = PRIMITIVE, tag_num = 0x7f)] struct N; #[derive(bsn1_serde::Serialize, bsn1_serde::Deserialize, Debug, PartialEq)] #[bsn1_serde(id = Sequence, tag_pc = PRIMITIVE, tag_num = 0x80)] struct O; #[derive(bsn1_serde::Serialize, bsn1_serde::Deserialize, Debug, PartialEq)] #[bsn1_serde(tag_class = PRIVATE, tag_pc = PRIMITIVE, tag_num = 0x3fff)] struct P; #[derive(bsn1_serde::Serialize, bsn1_serde::Deserialize, Debug, PartialEq)] #[bsn1_serde(id = Sequence, tag_class = PRIVATE, tag_pc = PRIMITIVE, tag_num = 0x4000)] struct Q; fn main() { test_a(); test_b(); test_c(); test_d(); test_e(); test_f(); test_g(); test_h(); test_i(); test_j(); test_k(); test_l(); test_m(); test_n(); test_o(); test_p(); test_q(); } fn test_a() { let val = A; let der = to_der(&val).unwrap(); assert_eq!(val, from_der(&der).unwrap()); let ber = to_ber(&val).unwrap(); assert_eq!(val, from_ber(&ber).unwrap()); } fn test_b() { let val = B; let der = to_der(&val).unwrap(); assert_eq!(val, from_der(&der).unwrap()); let ber = to_ber(&val).unwrap(); assert_eq!(val, from_ber(&ber).unwrap()); } fn test_c() { let val = C; let der = to_der(&val).unwrap(); assert_eq!(val, from_der(&der).unwrap()); let ber = to_ber(&val).unwrap(); assert_eq!(val, from_ber(&ber).unwrap()); } fn test_d() { let val = D; let der = to_der(&val).unwrap(); assert_eq!(val, from_der(&der).unwrap()); let ber = to_ber(&val).unwrap(); assert_eq!(val, from_ber(&ber).unwrap()); } fn test_e() { let val = E; let der = to_der(&val).unwrap(); assert_eq!(val, from_der(&der).unwrap()); let ber = to_ber(&val).unwrap(); assert_eq!(val, from_ber(&ber).unwrap()); } fn test_f() { let val = F; let der = to_der(&val).unwrap(); assert_eq!(val, from_der(&der).unwrap()); let ber = to_ber(&val).unwrap(); assert_eq!(val, from_ber(&ber).unwrap()); } fn test_g() { let val = G; let der = to_der(&val).unwrap(); assert_eq!(val, from_der(&der).unwrap()); let ber = to_ber(&val).unwrap(); assert_eq!(val, from_ber(&ber).unwrap()); } fn test_h() { let val = H; let der = to_der(&val).unwrap(); assert_eq!(val, from_der(&der).unwrap()); let ber = to_ber(&val).unwrap(); assert_eq!(val, from_ber(&ber).unwrap()); } fn test_i() { let val = I; let der = to_der(&val).unwrap(); assert_eq!(val, from_der(&der).unwrap()); let ber = to_ber(&val).unwrap(); assert_eq!(val, from_ber(&ber).unwrap()); } fn test_j() { let val = J; let der = to_der(&val).unwrap(); assert_eq!(val, from_der(&der).unwrap()); let ber = to_ber(&val).unwrap(); assert_eq!(val, from_ber(&ber).unwrap()); } fn test_k() { let val = K; let der = to_der(&val).unwrap(); assert_eq!(val, from_der(&der).unwrap()); let ber = to_ber(&val).unwrap(); assert_eq!(val, from_ber(&ber).unwrap()); } fn test_l() { let val = L; let der = to_der(&val).unwrap(); assert_eq!(val, from_der(&der).unwrap()); let ber = to_ber(&val).unwrap(); assert_eq!(val, from_ber(&ber).unwrap()); } fn test_m() { let val = M; let der = to_der(&val).unwrap(); assert_eq!(val, from_der(&der).unwrap()); let ber = to_ber(&val).unwrap(); assert_eq!(val, from_ber(&ber).unwrap()); } fn test_n() { let val = N; let der = to_der(&val).unwrap(); assert_eq!(val, from_der(&der).unwrap()); let ber = to_ber(&val).unwrap(); assert_eq!(val, from_ber(&ber).unwrap()); } fn test_o() { let val = O; let der = to_der(&val).unwrap(); assert_eq!(val, from_der(&der).unwrap()); let ber = to_ber(&val).unwrap(); assert_eq!(val, from_ber(&ber).unwrap()); } fn test_p() { let val = P; let der = to_der(&val).unwrap(); assert_eq!(val, from_der(&der).unwrap()); let ber = to_ber(&val).unwrap(); assert_eq!(val, from_ber(&ber).unwrap()); } fn test_q() { let val = Q; let der = to_der(&val).unwrap(); assert_eq!(val, from_der(&der).unwrap()); let ber = to_ber(&val).unwrap(); assert_eq!(val, from_ber(&ber).unwrap()); }