Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Rob Bultman <[email protected]>
  • Loading branch information
cecille and rbultman authored Apr 11, 2024
1 parent 5f6e2c9 commit a209d1e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/testing/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ product as a black box.

Unit tests run on small pieces (“units”) of business logic. They do not use an
external controller and instead test at the public interface of the class or
function. For cluster, this requires an API that separates the cluster logic
function. For clusters, this requires an API that separates the cluster logic
from the global ember and message delivery layers.

![](./img/unit_tests.png)
Expand Down
14 changes: 7 additions & 7 deletions docs/testing/unit_testing_clusters.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ The ClusterServerClass is a **Very** light wrapper over ClusterLogic. It
translates Interaction Model wire format handling into API calls for cluster
logic methods.

This class iImplements both the AttributeAccessInterface and the CommandHandler
interfaces so ClusterLogic properly handles data dependencies between command
This class implements both the AttributeAccessInterface and the CommandHandler
interfaces so ClusterLogic properly handles data dependencies between commands
and attributes.

An example code snippet showing the translation of the TLV into API calls to the
Expand Down Expand Up @@ -60,9 +60,9 @@ CHIP_ERROR DiscoBallServer::Read(const ConcreteReadAttributePath & aPath,
The ClusterLogic class is for all the code that is SHARED between platforms. It
does NOT include any TLV parsing or direct calls to Ember/IM/LogEvent etc.

The class should include attribute getter/setters and handlers for all commands.
The class should include attribute getters/setters and handlers for all commands.

The class receive “plain data” Matter requests from ClusterServer class,
The class receives “plain data” Matter requests from ClusterServer class,
performs required common actions, and calls driver class to perform platform- or
hardware-specific actions. It also receives driver updates (e.g.
application-driven value changes) from the ClusterDriver class and updates state
Expand Down Expand Up @@ -108,9 +108,9 @@ The ClusterDriver is called by the ClusterLogic class and is used to translate
attribute changes and commands into application actions. It also reports
external changes back to the ClusterLogic class.

The API design for this class with vary by the cluster, but it si generally
The API design for this class will vary by the cluster, but it is generally
recommended to use a generic API where possible, so the API ports easily to
other platforms. For example an attribute changed callback with the changes
other platforms, for example an attribute changed callback with the changes
listed. It is important to be careful about the design and revisit this early if
issues arise.

Expand Down Expand Up @@ -150,7 +150,7 @@ Important tests to consider:
- Correctness can mostly be validated by inspection if it’s trivial.
- Important tests
- Errors when ClusterLogic instances aren’t properly registered.
- Flow through to ClusterLogic for all reads/writes/command.
- Flow through to ClusterLogic for all reads/writes/commands.
- Can unit test this class by generating the TLV / path for input, parsing the
TLV output.

Expand Down

0 comments on commit a209d1e

Please sign in to comment.