UniSet 2.45.1
Пространство имен tests.test_codegen_fb

Классы

class  TestFBInstanceCodegen
class  TestFBCallCodegen
class  TestFBFieldAccessCodegen
class  TestFunctionBlockDeclarationCodegen

Функции

IRProgram _make_program (str name="Main", list|None inputs=None, list|None outputs=None, list|None locals_=None, list|None fb_instances=None, list|None body=None, list|None function_blocks=None)
SensorMapping _make_mapping (list[SensorEntry]|None inputs=None, list[SensorEntry]|None outputs=None)

Подробное описание

Tests for function block code generation (codegen.py).

Tests cover:
- IRFBInstance emits correct constructor: new TON(pt), new CTU(pv), new RS()
- IRFBCall emits correct update() calls with args in correct order
- IRFieldAccess on FB emits obj.field
- All 10 standard FBs generate correct constructor and update() calls
- FUNCTION_BLOCK declaration emits JS class with constructor and execute()

Функции

◆ _make_mapping()

SensorMapping tests.test_codegen_fb._make_mapping ( list[SensorEntry] | None inputs = None,
list[SensorEntry] | None outputs = None )
protected
Helper to create a SensorMapping with defaults.

◆ _make_program()

IRProgram tests.test_codegen_fb._make_program ( str name = "Main",
list | None inputs = None,
list | None outputs = None,
list | None locals_ = None,
list | None fb_instances = None,
list | None body = None,
list | None function_blocks = None )
protected
Helper to create an IRProgram with defaults.