aboutsummaryrefslogtreecommitdiff
path: root/macros/src/tests/single.rs
diff options
context:
space:
mode:
authorJorge Aparicio <jorge@japaric.io>2019-06-13 23:56:59 +0200
committerJorge Aparicio <jorge@japaric.io>2019-06-13 23:56:59 +0200
commit81275bfa4f41e2066770087f3a33cad4227eab41 (patch)
treec779a68e7cecf4c2613c7593376f980cea5dbc05 /macros/src/tests/single.rs
parentfafeeb27270ef24fc3852711c6032f65aa7dbcc0 (diff)
rtfm-syntax refactor + heterogeneous multi-core support
Diffstat (limited to 'macros/src/tests/single.rs')
-rw-r--r--macros/src/tests/single.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/macros/src/tests/single.rs b/macros/src/tests/single.rs
new file mode 100644
index 0000000..fb2d430
--- /dev/null
+++ b/macros/src/tests/single.rs
@@ -0,0 +1,35 @@
+use quote::quote;
+use rtfm_syntax::Settings;
+
+#[test]
+fn analyze() {
+ let (app, analysis) = rtfm_syntax::parse2(
+ quote!(device = pac),
+ quote!(
+ const APP: () = {
+ #[task(priority = 1)]
+ fn a(_: a::Context) {}
+
+ #[task(priority = 2)]
+ fn b(_: b::Context) {}
+
+ // first interrupt is assigned to the highest priority dispatcher
+ extern "C" {
+ fn B();
+ fn A();
+ }
+ };
+ ),
+ Settings {
+ parse_extern_interrupt: true,
+ ..Settings::default()
+ },
+ )
+ .unwrap();
+
+ let analysis = crate::analyze::app(analysis, &app);
+ let interrupts = &analysis.interrupts[&0];
+ assert_eq!(interrupts.len(), 2);
+ assert_eq!(interrupts[&2].to_string(), "B");
+ assert_eq!(interrupts[&1].to_string(), "A");
+}