MCPcopy
hub / github.com/google/mangle / TestResolveHeadTime_NowBound

Function TestResolveHeadTime_NowBound

engine/temporal_test.go:676–700  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

674}
675
676func TestResolveHeadTime_NowBound(t *testing.T) {
677 evalTime := time.Date(2024, 1, 15, 12, 0, 0, 0, time.UTC)
678 subst := unionfind.New()
679
680 // Create an interval with 'now' as the end bound
681 start := ast.Date(2024, 1, 1)
682 headTime := ast.NewInterval(
683 ast.NewTimestampBound(start),
684 ast.Now(), // 'now' bound
685 )
686
687 result, err := ResolveHeadTime(&headTime, subst, evalTime)
688 if err != nil {
689 t.Fatalf("ResolveHeadTime returned error: %v", err)
690 }
691 if result == nil {
692 t.Fatal("ResolveHeadTime returned nil")
693 }
694
695 // The 'now' bound should be resolved to evalTime
696 expectedEnd := ast.NewTimestampBound(evalTime)
697 if result.End.Type != ast.TimestampBound || result.End.Timestamp != expectedEnd.Timestamp {
698 t.Errorf("ResolveHeadTime end = %v, want %v", result.End, expectedEnd)
699 }
700}
701
702func TestResolveHeadTime_VariableBound(t *testing.T) {
703 evalTime := ast.Date(2024, 1, 15)

Callers

nothing calls this directly

Calls 6

NewFunction · 0.92
DateFunction · 0.92
NewIntervalFunction · 0.92
NewTimestampBoundFunction · 0.92
NowFunction · 0.92
ResolveHeadTimeFunction · 0.85

Tested by

no test coverage detected