sat-rs/satrs-macros/tests/verify_gen_struct.rs

18 lines
656 B
Rust
Raw Normal View History

2022-11-27 18:47:02 +01:00
use satrs_core::resultcode::{ResultU16, ResultU16Ext};
2022-11-27 18:21:50 +01:00
use satrs_macros::*;
2022-11-27 18:47:02 +01:00
#[resultcode(info = "This is a test result where the first parameter is foo")]
2022-11-27 18:21:50 +01:00
const TEST_RESULT: ResultU16 = ResultU16::const_new(0, 1);
2022-11-27 18:47:02 +01:00
// Create named reference of auto-generated struct, which can be used by IDEs etc.
const TEST_RESULT_EXT_REF: &ResultU16Ext = &TEST_RESULT_EXT;
2022-11-27 18:21:50 +01:00
2022-11-27 18:47:02 +01:00
fn main() {
assert_eq!(TEST_RESULT_EXT.name, "TEST_RESULT");
assert_eq!(TEST_RESULT_EXT.result, &TEST_RESULT);
assert_eq!(
TEST_RESULT_EXT.info,
"This is a test result where the first parameter is foo"
);
assert_eq!(TEST_RESULT_EXT_REF.name, "TEST_RESULT");
}