sat-rs/fsrc-core/tests/pus_events.rs

68 lines
2.0 KiB
Rust
Raw Normal View History

2022-10-23 22:32:30 +02:00
#![allow(dead_code, unused_imports)]
2022-10-24 01:51:33 +02:00
use fsrc_core::events::{
EventU32TypedSev, GenericEvent, HasSeverity, LargestEventRaw, LargestGroupIdRaw, Severity,
SeverityInfo, SeverityLow, SeverityMedium,
};
2022-10-22 17:16:28 +02:00
2022-10-23 22:32:30 +02:00
struct GroupIdIntrospection {
name: &'static str,
id: LargestGroupIdRaw,
}
2022-10-24 01:51:33 +02:00
struct EventIntrospection<SEVERITY: HasSeverity + 'static> {
2022-10-23 22:32:30 +02:00
name: &'static str,
group_id: GroupIdIntrospection,
2022-10-24 01:51:33 +02:00
event: &'static EventU32TypedSev<SEVERITY>,
2022-10-23 22:32:30 +02:00
info: &'static str,
}
//#[event(descr="This is some info event")]
2022-10-24 01:51:33 +02:00
const INFO_EVENT_0: EventU32TypedSev<SeverityInfo> = EventU32TypedSev::const_new(0, 0);
2022-10-23 22:32:30 +02:00
// This is ideally auto-generated
2022-10-24 01:51:33 +02:00
const INFO_EVENT_0_INTROSPECTION: EventIntrospection<SeverityInfo> = EventIntrospection {
2022-10-23 22:32:30 +02:00
name: "INFO_EVENT_0",
group_id: GroupIdIntrospection {
id: 0,
name: "Group ID 0 without name",
},
event: &INFO_EVENT_0,
info: "This is some info event",
};
//#[event(descr="This is some low severity event")]
2022-10-24 01:51:33 +02:00
const SOME_LOW_SEV_EVENT: EventU32TypedSev<SeverityLow> = EventU32TypedSev::const_new(0, 12);
2022-10-23 22:32:30 +02:00
2022-10-24 01:51:33 +02:00
//const EVENT_LIST: [&'static Event; 2] = [&INFO_EVENT_0, &SOME_LOW_SEV_EVENT];
2022-10-23 22:32:30 +02:00
//#[event_group]
const TEST_GROUP_NAME: u16 = 1;
// Auto-generated?
const TEST_GROUP_NAME_NAME: &'static str = "TEST_GROUP_NAME";
//#[event(desc="Some medium severity event")]
2022-10-24 01:51:33 +02:00
const MEDIUM_SEV_EVENT_IN_OTHER_GROUP: EventU32TypedSev<SeverityMedium> =
EventU32TypedSev::const_new(TEST_GROUP_NAME, 0);
2022-10-23 22:32:30 +02:00
// Also auto-generated
2022-10-24 01:51:33 +02:00
const MEDIUM_SEV_EVENT_IN_OTHER_GROUP_INTROSPECTION: EventIntrospection<SeverityMedium> =
EventIntrospection {
name: "MEDIUM_SEV_EVENT_IN_OTHER_GROUP",
group_id: GroupIdIntrospection {
name: TEST_GROUP_NAME_NAME,
id: TEST_GROUP_NAME,
},
event: &MEDIUM_SEV_EVENT_IN_OTHER_GROUP,
info: "Some medium severity event",
};
2022-10-23 22:32:30 +02:00
#[test]
fn main() {
2022-10-24 01:51:33 +02:00
//let test = stringify!(INFO_EVENT);
//println!("{:?}", test);
//for event in EVENT_LIST {
// println!("{:?}", event);
//}
2022-10-23 22:32:30 +02:00
//let test_struct =
}