RTist 11.1 2021.24, the second release on the 11.1 release track is now available. This release contains several improvements, both bug fixes, and new features. Let’s have a look at some of these new features.
Capsule Unit Testing
You can now use the Mocha framework for unit testing capsules. A new command in the context menu of a capsule, Add Unit Test, will create everything needed for quickly writing and running a unit test for the capsule:
- A test driver model where all service ports of the capsule under test are connected to similar but conjugated ports of a test probe capsule
- A TC for building the test driver model into an executable that uses the TcpServer library for exposing all test probe ports to the Mochatest script
- A Node.js project with a Mocha testscript ready to implement the unit test
You can run the unit tests directly from within the RTist user interface, or from the command-line.
The model compiler can now generate code that complies with some of the rules implemented by the static code analysis tool Clang-Tidy. Enable this feature by setting the new preference RealTime Development – Build/Transformations – C++ – Code compliance – Clang-Tidy. By not getting warnings from the generated code, it becomes more practical to use Clang-Tidy to find problems in your handwritten code snippets.
When a search returns a large number of matches it’s useful to filter the search result. RTist now allows the boolean AND (&&) operator to be used for combining multiple patterns in the filter string. You can also combine it with the boolean NOT (!) operator to specify a filter string that will hide all matches where certain words are not present.
You can enclose the filter string in double quotes to avoid special interpretation of the characters ! or && (i.e. in that case the filter string will be applied verbatimly).
Generic Type Descriptors
The model compiler now supports generating type descriptors for type aliases with template parameters. For example:
template<typename T, unsigned int N > using StdArray = std::array<T, N>;
If type descriptor functions are defined for the type alias, they will be generated as template functions with the same template parameters. This makes it possible to implement the type descriptor generically so that it works for all (or many) instantiations of the template.
For type aliases of container types (vector, array, etc) it’s typically needed to look up the type descriptor for the element type at compile time when implementing for example the encode function. This is possible by means of a new TargetRTS template function
RTObject_class::fromType<T>(). It is specialized for all built-in C++ types, and you can write your own specializations for other types for which this is needed.
For more information visit https://hcltechsw.com/RTist