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

Function TestTimeLessThanOrEqual

builtin/builtin_test.go:640–663  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

638}
639
640func TestTimeLessThanOrEqual(t *testing.T) {
641 t1 := ast.Time(1705314600000000000)
642 t2 := ast.Time(1705314601000000000)
643
644 tests := []struct {
645 left ast.BaseTerm
646 right ast.BaseTerm
647 want bool
648 }{
649 {t1, t2, true}, // earlier <= later
650 {t2, t1, false}, // later <= earlier
651 {t1, t1, true}, // same time
652 }
653 for _, test := range tests {
654 atom := ast.NewAtom(":time:le", test.left, test.right)
655 got, _, err := Decide(atom, &emptySubst)
656 if err != nil {
657 t.Fatal(err)
658 }
659 if got != test.want {
660 t.Errorf("TimeLe: for atom %v got %v want %v.", atom, got, test.want)
661 }
662 }
663}
664
665func TestTimeGreaterThan(t *testing.T) {
666 t1 := ast.Time(1705314600000000000)

Callers

nothing calls this directly

Calls 3

TimeFunction · 0.92
NewAtomFunction · 0.92
DecideFunction · 0.85

Tested by

no test coverage detected