From 95416395865072b5db63368f81568026f80305dc Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Tue, 28 Feb 2023 15:36:27 +0800 Subject: [PATCH] test: add rust codec test sample --- src/rust_ffi/src/codec/common_code.rs | 10 ++++++++++ src/rust_ffi/src/codec/raw_code.rs | 6 ++++++ src/rust_ffi/src/codec/short_code.rs | 9 +++++++++ 3 files changed, 25 insertions(+) diff --git a/src/rust_ffi/src/codec/common_code.rs b/src/rust_ffi/src/codec/common_code.rs index 9d411d7..a6d0765 100644 --- a/src/rust_ffi/src/codec/common_code.rs +++ b/src/rust_ffi/src/codec/common_code.rs @@ -228,3 +228,13 @@ impl CommonCode { ) } } + +#[cfg(test)] +mod tests { + const TEST_CODE: u64 = 0x1_A9BF_0C00; + const TEST_CODE_STR: &str = "1A9BF0C00"; + const TEST_CODE_STR_SHR: &str = "1A9BF0C"; + + const TEST_CODE_ERR: u64 = 0x1_A9BF_FC00; + const TEST_CODE_STR_ERR: &str = "123J432A9"; +} diff --git a/src/rust_ffi/src/codec/raw_code.rs b/src/rust_ffi/src/codec/raw_code.rs index 819fc14..5ad0724 100644 --- a/src/rust_ffi/src/codec/raw_code.rs +++ b/src/rust_ffi/src/codec/raw_code.rs @@ -313,3 +313,9 @@ impl RawCode { ) } } + +#[cfg(test)] +mod tests { + const TEST_CODE: u64 = 0x0_603_EDF_5CA_FFF_5E2; + const TEST_CODE_ERR: u64 = 0x0_A34_182_B38_102_D21; +} diff --git a/src/rust_ffi/src/codec/short_code.rs b/src/rust_ffi/src/codec/short_code.rs index 203b309..eeeef12 100644 --- a/src/rust_ffi/src/codec/short_code.rs +++ b/src/rust_ffi/src/codec/short_code.rs @@ -258,3 +258,12 @@ impl ShortCode { codec_ffi::short_code_enable_fast(); } } + +#[cfg(test)] +mod tests { + const TEST_CODE: u32 = 4091296; + const TEST_CODE_STR: &str = "4WVE1"; + + const TEST_CODE_ERR: u32 = 29670987; + const TEST_CODE_STR_ERR: &str = "R50EH"; +}