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

Function TestDurationAdd

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

Source from the content-addressed store, hash-verified

1414}
1415
1416func TestDurationAdd(t *testing.T) {
1417 d1 := int64(3600000000000) // 1 hour
1418 d2 := int64(1800000000000) // 30 minutes
1419
1420 expr := ast.ApplyFn{symbols.DurationAdd, []ast.BaseTerm{
1421 ast.Duration(d1),
1422 ast.Duration(d2),
1423 }}
1424 got, err := EvalApplyFn(expr, ast.ConstSubstMap{})
1425 if err != nil {
1426 t.Fatalf("EvalApplyFn(%v) failed with %v", expr, err)
1427 }
1428 want := ast.Duration(d1 + d2)
1429 if !got.Equals(want) {
1430 t.Errorf("EvalApplyFn(%v) = %v, want %v", expr, got, want)
1431 }
1432}
1433
1434func TestDurationMult(t *testing.T) {
1435 d := int64(3600000000000) // 1 hour

Callers

nothing calls this directly

Calls 3

DurationFunction · 0.92
EvalApplyFnFunction · 0.85
EqualsMethod · 0.65

Tested by

no test coverage detected