企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
~~~ package observer import ( "testing" ) func TestObserver(t *testing.T) { var s = NewSubjectA(12) var oa = NewObserverA(s, 1) var ob = NewObserverB(s, 1) var oafu update = oa.Update s.AddCallFunc(&oafu) var obfu update = ob.Update s.AddCallFunc(&obfu) s.Notify() s.SetState(3) s.Notify() } ~~~