💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
~~~ 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() } ~~~