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

Function TestDurationMult

functional/functional_test.go:1434–1449  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1432}
1433
1434func TestDurationMult(t *testing.T) {
1435 d := int64(3600000000000) // 1 hour
1436
1437 expr := ast.ApplyFn{symbols.DurationMult, []ast.BaseTerm{
1438 ast.Duration(d),
1439 ast.Number(3),
1440 }}
1441 got, err := EvalApplyFn(expr, ast.ConstSubstMap{})
1442 if err != nil {
1443 t.Fatalf("EvalApplyFn(%v) failed with %v", expr, err)
1444 }
1445 want := ast.Duration(d * 3)
1446 if !got.Equals(want) {
1447 t.Errorf("EvalApplyFn(%v) = %v, want %v", expr, got, want)
1448 }
1449}
1450
1451func TestDurationComponents(t *testing.T) {
1452 // 2 hours, 30 minutes, 45 seconds = 9045 seconds total

Callers

nothing calls this directly

Calls 4

DurationFunction · 0.92
NumberFunction · 0.92
EvalApplyFnFunction · 0.85
EqualsMethod · 0.65

Tested by

no test coverage detected