Skip to content

Commit

Permalink
TTCN-3 support (#522)
Browse files Browse the repository at this point in the history
  • Loading branch information
boyter authored Sep 30, 2024
1 parent 98cade9 commit 2715b69
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 14 deletions.
1 change: 1 addition & 0 deletions LANGUAGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ Textile (textile)
Thrift (thrift)
TL (tl)
TOML (toml)
TTCN-3 (ttcn,ttcn3,ttcnpp)
Twig Template (twig)
TypeScript (ts,tsx)
TypeScript Typings (d.ts)
Expand Down
26 changes: 13 additions & 13 deletions SCC-OUTPUT-REPORT.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<th>447</th>
<th>7659</th>
<th>1529</th>
<th>253964</th>
<th>254048</th>
<th>4067</th>
</tr><tr>
<td>processor/formatters.go</td>
Expand Down Expand Up @@ -240,16 +240,6 @@
<td>0</td>
<td>2209</td>
<td>35</td>
</tr><tr>
<td>processor/bloom.go</td>
<td></td>
<td>37</td>
<td>7</td>
<td>12</td>
<td>18</td>
<td>2</td>
<td>1062</td>
<td>29</td>
</tr><tr>
<td>processor/cocomo_test.go</td>
<td></td>
Expand All @@ -260,6 +250,16 @@
<td>6</td>
<td>686</td>
<td>23</td>
</tr><tr>
<td>processor/bloom.go</td>
<td></td>
<td>37</td>
<td>7</td>
<td>12</td>
<td>18</td>
<td>2</td>
<td>1062</td>
<td>29</td>
</tr><tr>
<td>processor/helpers_test.go</td>
<td></td>
Expand Down Expand Up @@ -288,7 +288,7 @@
<td>0</td>
<td>4</td>
<td>0</td>
<td>21625</td>
<td>21709</td>
<td>5</td>
</tr></tbody>
<tfoot><tr>
Expand All @@ -299,7 +299,7 @@
<th>447</th>
<th>7659</th>
<th>1529</th>
<th>253964</th>
<th>254048</th>
<th>4067</th>
</tr>
<tr>
Expand Down
61 changes: 61 additions & 0 deletions examples/language/ttcn.ttcn
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
module TestSystem {

// Define a subtype of integer
type integer myNewType (0..50)

// Declare Request struct type with 2 fields
type record Request {
myNewType param1,
charstring param2
}

// Declare Answer struct type with one field
type record Answer {
myNewType param1
}

// Declare a message based communication port
type port cEnv_type message {
out Request;
in Answer;
}

// Declare the component on which the test case will run
type component sSystem {
port cEnv_type cEnv;
}

// The templates define the outgoing parameter values
// and verify the incoming parameter values
template Request Good_Req := {param1 := 42, param2 := "hello !" };
template Answer All_is_OK := {param1 := 0};

// Define testcase1 that will run on sSystem component
testcase testcase1() runs on sSystem
{
// Send Request message with (42, "hello !") as parmeters
cEnv.send(Good_Req);
// An alternative for the 2 possible answers
alt
{
// Do we receive Answer with 0 as parameter
[]cEnv.receive(All_is_OK)
{
// Pass verdict !
setverdict(pass)
}
// Or do we receive something else
[]cEnv.receive
{
// Fail verdict
setverdict(fail)
}
}
}

// Control part chains test cases execution automatically
control {
var verdicttype verdict1;
verdict1 := execute(testcase1());
}
}
30 changes: 30 additions & 0 deletions languages.json
Original file line number Diff line number Diff line change
Expand Up @@ -6082,6 +6082,36 @@
}
]
},
"TTCN-3": {
"complexitychecks": [
"for ",
"for(",
"from ",
"if ",
"if(",
"select ",
"case ",
"while ",
"do ",
"goto ",
"stop ",
"break ",
"else ",
"|| ",
"&& ",
"!= ",
"== "
],
"extensions": ["ttcn", "ttcn3", "ttcnpp"],
"line_comment": ["//"],
"multi_line": [["/*", "*/"]],
"quotes": [
{
"end": "\"",
"start": "\""
}
]
},
"TaskPaper": {
"complexitychecks": [],
"extensions": ["taskpaper"],
Expand Down
2 changes: 1 addition & 1 deletion processor/constants.go

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions test-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,7 @@ specificLanguages=(
'Teal '
'Templ '
'Terraform '
'TTCN-3 '
'TypeSpec '
'Typst '
'Web Services '
Expand Down

0 comments on commit 2715b69

Please sign in to comment.