(t *testing.T)
| 2528 | } |
| 2529 | |
| 2530 | func TestCustomDecorator(t *testing.T) { |
| 2531 | decV1 := func(i Interpretable) (Interpretable, error) { |
| 2532 | return i, nil |
| 2533 | } |
| 2534 | opt := CustomDecorator(decV1) |
| 2535 | p := &planner{} |
| 2536 | p2, err := opt(p) |
| 2537 | if err != nil { |
| 2538 | t.Fatalf("CustomDecorator failed: %v", err) |
| 2539 | } |
| 2540 | if len(p2.decorators) != 1 { |
| 2541 | t.Fatalf("CustomDecorator did not add decorator") |
| 2542 | } |
| 2543 | res, err := p2.decorators[0](NewConstValue(1, types.IntOne)) |
| 2544 | if err != nil { |
| 2545 | t.Fatalf("wrapped decorator failed: %v", err) |
| 2546 | } |
| 2547 | if res.ID() != 1 { |
| 2548 | t.Errorf("wrapped decorator returned node with ID %d, wanted 1", res.ID()) |
| 2549 | } |
| 2550 | } |
| 2551 | |
| 2552 | func TestCostTrackerActualCost(t *testing.T) { |
| 2553 | ct := &CostTracker{cost: 42} |
nothing calls this directly
no test coverage detected