controllogic: locals as Value, init from declarations, value-aware write

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Martino Ferrari
2026-06-24 19:40:29 +02:00
parent 519c1f2df4
commit a6fa4e7c7c
4 changed files with 114 additions and 19 deletions
+5 -5
View File
@@ -103,7 +103,7 @@ func setupConfigEngine(t *testing.T) (*Engine, *writableSource, string) {
func TestApplyConfigWritesEveryParam(t *testing.T) {
e, src, instID := setupConfigEngine(t)
cg := &compiledGraph{name: "flow", engine: e, locals: map[string]float64{}}
cg := &compiledGraph{name: "flow", engine: e, locals: map[string]Value{}}
e.applyConfig(cg, instID)
@@ -117,7 +117,7 @@ func TestApplyConfigWritesEveryParam(t *testing.T) {
func TestApplyConfigUnknownInstanceNoop(t *testing.T) {
e, src, _ := setupConfigEngine(t)
cg := &compiledGraph{name: "flow", engine: e, locals: map[string]float64{}}
cg := &compiledGraph{name: "flow", engine: e, locals: map[string]Value{}}
e.applyConfig(cg, "does-not-exist")
@@ -144,7 +144,7 @@ func TestReadConfigParam(t *testing.T) {
func TestWriteConfigParam(t *testing.T) {
e, _, instID := setupConfigEngine(t)
cg := &compiledGraph{name: "flow", engine: e, locals: map[string]float64{}}
cg := &compiledGraph{name: "flow", engine: e, locals: map[string]Value{}}
e.writeConfigParam(cg, instID, "gain", 7.5)
@@ -163,7 +163,7 @@ func TestWriteConfigParam(t *testing.T) {
func TestCreateConfigInstance(t *testing.T) {
e, _, srcID := setupConfigEngine(t)
cg := &compiledGraph{name: "flow", engine: e, locals: map[string]float64{}}
cg := &compiledGraph{name: "flow", engine: e, locals: map[string]Value{}}
src, err := e.cfg.GetInstance(srcID)
if err != nil {
@@ -197,7 +197,7 @@ func TestCreateConfigInstance(t *testing.T) {
func TestSnapshotConfig(t *testing.T) {
e, src, instID := setupConfigEngine(t)
cg := &compiledGraph{name: "flow", engine: e, locals: map[string]float64{}}
cg := &compiledGraph{name: "flow", engine: e, locals: map[string]Value{}}
// Seed current live values for the set's target signals.
_ = src.Write(context.Background(), "GAIN", 3.5)