Skip to content

Commit 3967918

Browse files
committed
Finished programming example in docs. Started API docs.
1 parent cafd6a5 commit 3967918

11 files changed

+318
-2
lines changed

docs/_config.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ theme: minima
3333
# - jekyll-feed
3434

3535
header_pages:
36-
- introduction-user-guide.md
3736
- unit-testing-concepts.md
37+
- introduction-user-guide.md
3838
- programming-example.md
3939
- faq.md
4040
- download.md
41+
- api.md
4142

4243
# Exclude from processing.
4344
# The following items will not be processed, by default.

docs/api.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
layout: page
3+
title: API
4+
---
5+
6+
This is the application programming interface for TcUnit.
7+
8+
- [`FB_TestSuite`](#fb_testsuite)
9+
10+
## FB_TestSuite
11+
12+
This function block is responsible for holding the internal state of the test suite.
13+
Every test suite can have one or more tests, and every test can do one or more asserts.
14+
It's also responsible for providing all the assert-methods for asserting different data types.
15+
Only failed assertions are recorded.
16+
17+
**Method summary:**
18+
19+
- [AssertArrayEquals_BOOL](#assertarrayequals_bool)`(Expecteds : ARRAY[*] OF BOOL, Actuals : ARRAY[*] OF BOOL, Message : T_MaxString)`
20+
*Asserts that two BOOL arrays are equal.*
21+
22+
### `AssertArrayEquals_BOOL`
23+
24+
```StructuredText
25+
METHOD PUBLIC AssertArrayEquals_BOOL
26+
VAR_IN_OUT
27+
Expecteds : ARRAY[*] OF BOOL;
28+
Actuals : ARRAY[*] OF BOOL;
29+
END_VAR
30+
VAR_INPUT
31+
Message : T_MaxString;
32+
END_VAR
33+
```
34+
35+
Asserts that two BOOL arrays are equal.
36+
If they are not, an assertion error is created.
37+
38+
**Parameters:**
39+
40+
- `Expecteds` – BOOL array with expected values
41+
- `Actuals` – BOOL array with actual values
42+
- `Message` – The identifying message for the assertion error
43+
44+
**Positive example:**
45+
46+
```StructuredText
47+
VAR
48+
a : ARRAY[1..5] OF BOOL := [TRUE, FALSE, TRUE, FALSE, TRUE];
49+
b : ARRAY[1..5] OF BOOL := [TRUE, FALSE, TRUE, FALSE, TRUE];
50+
END_VAR
51+
-------
52+
TEST('Test_BOOL_Array_Equals');
53+
AssertArrayEquals_BOOL(Expecteds := a,
54+
Actuals := b,
55+
Message := 'Arrays differ');
56+
TEST_FINISHED();
57+
```
58+
59+
**Failing example #1:**
60+
61+
```StructuredText
62+
VAR
63+
a : ARRAY[1..6] OF BOOL := [TRUE, TRUE, TRUE, TRUE, TRUE, TRUE];
64+
b : ARRAY[1..4] OF BOOL := [TRUE, TRUE, TRUE, TRUE];
65+
END_VAR
66+
67+
TEST('Test_BYTE_Array_DiffersInSize');
68+
AssertArrayEquals_BOOL(Expecteds := a,
69+
Actuals := b,
70+
Message := 'Arrays differ');
71+
TEST_FINISHED();
72+
```
73+
74+
**Failing example #2:**
75+
76+
```StructuredText
77+
VAR
78+
a : ARRAY[0..5] OF BOOL := [TRUE, TRUE, FALSE, TRUE, FALSE, TRUE];
79+
b : ARRAY[0..5] OF BOOL := [TRUE, TRUE, TRUE, TRUE, FALSE, FALSE];
80+
END_VAR
81+
82+
TEST('Test_BYTE_Array_DiffersInContent');
83+
AssertArrayEquals_BOOL(Expecteds := a,
84+
Actuals := b,
85+
Message := 'Arrays differ');
86+
TEST_FINISHED();
87+
```

docs/img/TcUnit13Successful_2.png

4.93 KB
Loading

docs/img/TcUnitAllSuccessful2.png

4.92 KB
Loading
4.88 KB
Loading
28.2 KB
Loading
26.3 KB
Loading
32 KB
Loading

docs/img/flagslayout.png

29.7 KB
Loading

docs/img/functionblocklayout.png

280 KB
Loading

0 commit comments

Comments
 (0)