Rust::com Integration test cases for Rust COM-API#237
Rust::com Integration test cases for Rust COM-API#237castler merged 8 commits intoeclipse-score:mainfrom
Conversation
bharatGoswami8
commented
Mar 25, 2026
- Added integration test cases to verify data type and size of type for primitive and user defined struct
9b2c413 to
297ffad
Compare
982dc4b to
d5ff26c
Compare
d5ff26c to
69394d6
Compare
| name = "filesystem", | ||
| deps = [ | ||
| "//score/mw/com/test/com_api/consumer_async_apis:bigdata-com-api-async-pkg", | ||
| "//score/mw/com/test/basic_rust_api/consumer_async_apis:bigdata-com-api-async-pkg", |
There was a problem hiding this comment.
Question: what basic_rust_api means?
There was a problem hiding this comment.
it is a folder name where we kept rust com api related integration tests, keeping name com-api is so generic.
score/mw/com/test/basic_rust_api/consumer_sync_apis/consumer_app.rs
Outdated
Show resolved
Hide resolved
| // Test for primitive and complex data types, used in the com-api integration tests. | ||
|
|
||
| // Macro to generate data types with CommData impl with Eq trait | ||
| macro_rules! define_type { |
There was a problem hiding this comment.
Imo the macro should be changed slightly to be closer to the regular struct definition of Rust. This makes the code more readable.
There was a problem hiding this comment.
added the struct literal on macro parameter.
There was a problem hiding this comment.
Seems picky but why #[eq] and not #[derive($($trait:name),+)]? This way, you a) stick to the conventions of Rust and b) enable extra traits to be derived.
There was a problem hiding this comment.
Added suggest changes.
| }; | ||
|
|
||
| // Macro to generate interface classes | ||
| #define CREATE_INTERFACE(ClassName, DataType, EventName) \ |
There was a problem hiding this comment.
Imo the definition of a macro isn't worth the deduplication. Please remove this one.
There was a problem hiding this comment.
Removed and changed to each interface class.
|
|
||
| match args.test_case { | ||
| // The bigdata test uses the `BigDataInterface` and its `map_api_lanes_stamped_` event. | ||
| TestCase::Bigdata => { |
There was a problem hiding this comment.
Please move the match arms to separate functions.
|
|
||
| match args.test_case { | ||
| // The bigdata test uses the `BigDataInterface` and its `map_api_lanes_stamped_` event. | ||
| TestCase::Bigdata => { |
There was a problem hiding this comment.
Move match arms to separate functions.
63c060a to
5189a40
Compare
| // Test for primitive and complex data types, used in the com-api integration tests. | ||
|
|
||
| // Macro to generate data types with CommData impl with Eq trait | ||
| macro_rules! define_type { |
There was a problem hiding this comment.
Seems picky but why #[eq] and not #[derive($($trait:name),+)]? This way, you a) stick to the conventions of Rust and b) enable extra traits to be derived.
| #[repr(C)] | ||
| pub struct $name { | ||
| $(pub $field: $field_type,)* | ||
| } | ||
| impl CommData for $name { | ||
| const ID: &'static str = stringify!($name); | ||
| } |
There was a problem hiding this comment.
This could be deduplicated by introducing another macro. You can forward a whole AST part by using the tt matcher, along with the list of derive traits.
There was a problem hiding this comment.
Agreed, added helper macro define_com_type_impl.
| // Test for primitive and complex data types, used in the com-api integration tests. | ||
|
|
||
| // Macro to generate data types with CommData impl with Eq trait | ||
| macro_rules! define_type { |
There was a problem hiding this comment.
define_type is super super generic. Can you change the name to reflect what its doing with that type? E.g. define_com_type?
20ca61b to
5c83fbc
Compare
* Added integration test cases to verify data type and size of type for primitive and user defined struct
* Created macro for primitive and user-defined struct * created macro for genrated files
* Updated one test case for all the primitive types
* Updated complex struct test case
* Added primitive and complex struct
* Updated test cases and data types
* Updated test cases
* Updated type macro
5c83fbc to
63d9c6f
Compare