@@ -18,6 +18,8 @@ import { InRangeCall } from '../src/Commands/Comparisons/InRangeCall';
1818import { FunctionBlockCall } from '../src/Commands/Functions/Base/FunctionBlockCall' ;
1919import { SystemFunctionCall } from '../src/Commands/Functions/Base/SystemFunctionCall' ;
2020import { TONCall } from '../src/Commands/Functions/TONCall' ;
21+ import { CTUCall } from '../src/Commands/Functions/CTUCall' ;
22+ import { TPCall } from '../src/Commands/Functions/TPCall' ;
2123import { IOperationOrSignalDirectionWrapper } from '../src/Interfaces/IOperationOrSignalDirectionWrapper' ;
2224import { Direction } from '../src/Enums/Direction' ;
2325import { SignalType } from '../src/Enums/SignalType' ;
@@ -222,6 +224,106 @@ describe('SampleTests', () => {
222224 expect ( xml ) . toContain ( 'F_LAD' ) ;
223225 } ) ;
224226
227+ test ( 'TestCallWithCTU' , ( ) => {
228+ const codeblock = new CodeBlock ( ) ;
229+ codeblock . safety = false ;
230+ const nw = new Network ( 'Test2' , 'Test2en' ) ;
231+
232+ const f = new And (
233+ new Signal ( 'aa' ) ,
234+ new CTUCall ( 'Hallo' , new Signal ( 'bbb' , SignalType . Bool ) , new Signal ( '2' , SignalType . ConstantInt ) , new Coil ( new Signal ( 'ccc' , SignalType . Bool ) ) ) ,
235+ ) ;
236+ nw . add ( f ) ;
237+ codeblock . add ( nw ) ;
238+
239+ const block = new Block ( 'Test' , 'blabla' , codeblock ) ;
240+ block . blockInterface = TestInterface ;
241+ const xml = block . getCode ( ) ;
242+ expect ( xml ) . toBeTruthy ( ) ;
243+ } ) ;
244+
245+ test ( 'TestCallWithTPAndDistributor' , ( ) => {
246+ const codeblock = new CodeBlock ( ) ;
247+ codeblock . safety = false ;
248+ const nw = new Network ( 'Test2' , 'Test2en' ) ;
249+
250+ const and = new And (
251+ new Signal ( '#aaa' ) ,
252+ new TPCall (
253+ 'PulseStartPrint' ,
254+ new Signal ( 'T#100ms' , SignalType . ConstantTime ) ,
255+ new Distributor (
256+ new Coil ( new Signal ( '#bbbb' ) ) ,
257+ new RCoil ( new Signal ( '#cccc' ) ) ,
258+ new SCoil ( new Signal ( '#dddd' ) ) ,
259+ ) ,
260+ ) ,
261+ ) ;
262+ nw . add ( and ) ;
263+ codeblock . add ( nw ) ;
264+
265+ const block = new Block ( 'Test' , 'blabla' , codeblock ) ;
266+ block . blockInterface = TestInterface ;
267+ const xml = block . getCode ( ) ;
268+ expect ( xml ) . toBeTruthy ( ) ;
269+ } ) ;
270+
271+ test ( 'DistributorWithOr' , ( ) => {
272+ const codeblock = new CodeBlock ( ) ;
273+ codeblock . safety = false ;
274+ const nw = new Network ( 'Test2' , 'Test2en' ) ;
275+
276+ nw . add (
277+ new And (
278+ new Signal ( 'asd' ) ,
279+ new Distributor (
280+ new SCoil ( new Signal ( 'x' ) ) ,
281+ new And (
282+ new Or (
283+ new And ( new Signal ( 'a' ) , new Signal ( 'h' ) ) ,
284+ new And ( new Signal ( 'b' ) , new Signal ( 'f' ) ) ,
285+ ) ,
286+ new SCoil ( new Signal ( 'c' ) ) ,
287+ ) ,
288+ ) ,
289+ ) ,
290+ ) ;
291+ codeblock . add ( nw ) ;
292+
293+ const block = new Block ( 'Test' , 'blabla' , codeblock ) ;
294+ block . blockInterface = TestInterface ;
295+ const xml = block . getCode ( ) ;
296+ expect ( xml ) . toBeTruthy ( ) ;
297+ } ) ;
298+
299+ test ( 'MultipleOr' , ( ) => {
300+ const codeblock = new CodeBlock ( ) ;
301+ codeblock . safety = false ;
302+ const nw = new Network ( 'Test2' , 'Test2en' ) ;
303+
304+ nw . add (
305+ new Coil (
306+ new Signal ( 'a' ) ,
307+ new And (
308+ new Signal ( '1' ) ,
309+ new Or (
310+ new And (
311+ new Or ( new Signal ( 'b' ) , new Signal ( 'c' ) ) ,
312+ new Signal ( 'd' ) ,
313+ ) ,
314+ new Signal ( 'e' ) ,
315+ ) ,
316+ ) ,
317+ ) ,
318+ ) ;
319+ codeblock . add ( nw ) ;
320+
321+ const block = new Block ( 'Test' , 'blabla' , codeblock ) ;
322+ block . blockInterface = TestInterface ;
323+ const xml = block . getCode ( ) ;
324+ expect ( xml ) . toBeTruthy ( ) ;
325+ } ) ;
326+
225327 test ( 'FixedPeripherySignalTest' , ( ) => {
226328 const codeblock = new CodeBlock ( ) ;
227329 const nw = new Network ( 'Test3' , 'Test3en' ) ;
@@ -327,6 +429,49 @@ describe('SampleTests', () => {
327429 expect ( xml ) . toBeTruthy ( ) ;
328430 } ) ;
329431
432+ test ( 'ComplexOr2' , ( ) => {
433+ const codeblock = new CodeBlock ( ) ;
434+ codeblock . safety = false ;
435+ const nw = new Network ( 'T1' , 'T1' ) ;
436+
437+ nw . add (
438+ new Coil (
439+ new Signal ( 'Test11' ) ,
440+ new Or (
441+ new Signal ( 'Test12' ) ,
442+ new Or (
443+ new And (
444+ new Signal ( 'Test1' ) ,
445+ new Or (
446+ new And (
447+ new Signal ( 'Test2' ) ,
448+ new Or ( new Signal ( 'Test3' ) , new Signal ( 'Test4' ) ) ,
449+ ) ,
450+ new Signal ( 'Test5' ) ,
451+ ) ,
452+ ) ,
453+ new And (
454+ new Signal ( 'Test6' ) ,
455+ new Or (
456+ new And (
457+ new Signal ( 'Test7' ) ,
458+ new Or ( new Signal ( 'Test8' ) , new Signal ( 'Test9' ) ) ,
459+ ) ,
460+ new Signal ( 'Test10' ) ,
461+ ) ,
462+ ) ,
463+ ) ,
464+ ) ,
465+ ) ,
466+ ) ;
467+ codeblock . add ( nw ) ;
468+
469+ const block = new Block ( 'Test' , 'blabla' , codeblock ) ;
470+ block . blockInterface = TestInterface ;
471+ const xml = block . getCode ( ) ;
472+ expect ( xml ) . toBeTruthy ( ) ;
473+ } ) ;
474+
330475 test ( 'Complex3' , ( ) => {
331476 const codeblock = new CodeBlock ( ) ;
332477 codeblock . safety = false ;
0 commit comments