Skip to content

Commit

Permalink
Solved issue #209 "Assert does not play nice with properties" with do…
Browse files Browse the repository at this point in the history
…cumentation.

Updated main README with additions to contributions.
Fixed minor issues in the documentation.
  • Loading branch information
sagatowski committed Nov 24, 2023
1 parent 80d8b14 commit 89738d5
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ Go to the [releases](https://github.com/tcunit/TcUnit/releases).
Check out the [TcUnit-Runner project](https://github.com/tcunit/TcUnit-Runner).

**Want to contribute to the project?**
That's fantastic! But please read the [CONTRIBUTING](CONTRIBUTING.md) first.
That's fantastic! There are two ways to do this.
1. Contribute with your time and knowledge by fixing issues or adding new features. Please read the [CONTRIBUTING](CONTRIBUTING.md) first.
2. By [becoming a sponsor](https://github.com/sponsors/tcunit).

**Have any questions? Found a bug or want to discuss an idea?**
Check the [F.A.Q](https://tcunit.org/#/faq).
Expand Down
13 changes: 13 additions & 0 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ If you don’t find what you are looking for here, you can look through the:
10. [If I call ADSLOGSTR(), my messages don't show up in the correct sequence. Why?](#_10-if-i-call-adslogstr-my-messages-dont-show-up-in-the-correct-sequence-why)
11. [How do I test functions?](#_11-how-do-i-test-functions)
12. [I have problems running TcUnit on a ARMv7 controller, why?](#_12-i-have-problems-running-tcunit-on-a-armv7-controller-why)
13. [AssertEquals(ANY) on properties makes my development environment crash, why?](#_13-assertequalsany-on-properties-makes-my-development-environment-crash-why)

---

Expand Down Expand Up @@ -317,3 +318,15 @@ When running TcUnit with a controller using ARMv7 you can run into issues, such
This seems to be an issue with the limited memory of the controllers using an ARMv7 such as the CX8190 and CX9020. Please adjust the [parameters related to memory allocation](#6-when-i-run-more-than-100-tests-in-a-single-test-suite-i-get-the-wrong-results-why).

For more information on a set of working parameters, see [this issue on GitHub](https://github.com/tcunit/TcUnit/issues/148).

## 13. AssertEquals(ANY) on properties makes my development environment crash, why?

Asserting the expected value of a property makes TcXaeShell crash and triggers a Windows Blue-Screen-Of-Death causing a full PLC reboot.
What should I do?

Using [`AssertEquals(ANY)`](api.md#assertequals) on a property is not allowed.
In TwinCAT 4024 (and earlier) the compiler doesn't warn about this but simply crashes. In TwinCAT 4026 (and later) a compile error is raised, see the following screenshot:

![AssertANY with parameter](img/AssertAnyWithParameter.png)

Simply use the primitive variant of Assert instead. For example, if you have a parameter that is a boolean, use [`AssertEquals_BOOL`](api.md#assertequals_bool) instead.
Binary file added docs/img/AssertAnyWithParameter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/programming-example-implementation-part-two.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Running our three unit tests that we defined earlier we get the result:

Two additional tests that succeed.

### FB_DiagnosticMessageTimeStampParser
## FB_DiagnosticMessageTimeStampParser

The timestamp parser takes an EtherCAT distributed clock (DC) timestamp (8 bytes), information of whether the timestamp is a local or global timestamp and delivers a human-readable string as output.

Expand Down
2 changes: 1 addition & 1 deletion docs/programming-example-test-cases-part-two.md
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ TEST_FINISHED();

As can be seen the only thing that varies between the tests (other than name) is the different inputs and expected output.

### FB_DiagnosticMessageTimeStampParser_Test
## FB_DiagnosticMessageTimeStampParser_Test

The eight bytes that make up the timestamp can be either the distributed clock (DC) from EtherCAT, or a local clock in the device itself.
In the global case we want to parse the DC-time, while in the local case we just want to take the DC from the current task time (the local clock could be extracted from the EtherCAT-slave, but for the sake of simplicity we'll use the task DC).
Expand Down

0 comments on commit 89738d5

Please # to comment.