package hbrtl import ( "five/hbrt" "testing" ) func TestSetFunc(t *testing.T) { _, th := setupVM() // Get SET EXACT (default false) th.PushInt(SetExact) th.PendingParams2(1) SetFunc(th) if th.GetRetValue().AsBool() { t.Error("SET EXACT default should be false") } // Set SET EXACT ON th.PushInt(SetExact) th.PushValue(hbrt.MakeBool(true)) th.PendingParams2(2) SetFunc(th) // Returns old value (false) if th.GetRetValue().AsBool() { t.Error("SET(EXACT, .T.) should return old .F.") } // Verify new value th.PushInt(SetExact) th.PendingParams2(1) SetFunc(th) if !th.GetRetValue().AsBool() { t.Error("SET EXACT should now be true") } // Restore th.PushInt(SetExact) th.PushValue(hbrt.MakeBool(false)) th.PendingParams2(2) SetFunc(th) } func TestGetSetting(t *testing.T) { // Test helper functions if GetSetExact() { t.Error("GetSetExact should be false by default") } if GetSetDeleted() { t.Error("GetSetDeleted should be false by default") } if GetSetSoftSeek() { t.Error("GetSetSoftSeek should be false by default") } }