(t *testing.T)
| 2785 | } |
| 2786 | |
| 2787 | func TestCustomDecorator(t *testing.T) { |
| 2788 | decV1 := func(i Interpretable) (Interpretable, error) { |
| 2789 | return i, nil |
| 2790 | } |
| 2791 | opt := CustomDecorator(decV1) |
| 2792 | p := &planner{} |
| 2793 | p2, err := opt(p) |
| 2794 | if err != nil { |
| 2795 | t.Fatalf("CustomDecorator failed: %v", err) |
| 2796 | } |
| 2797 | if len(p2.decorators) != 1 { |
| 2798 | t.Fatalf("CustomDecorator did not add decorator") |
| 2799 | } |
| 2800 | res, err := p2.decorators[0](NewConstValue(1, types.IntOne)) |
| 2801 | if err != nil { |
| 2802 | t.Fatalf("wrapped decorator failed: %v", err) |
| 2803 | } |
| 2804 | if res.ID() != 1 { |
| 2805 | t.Errorf("wrapped decorator returned node with ID %d, wanted 1", res.ID()) |
| 2806 | } |
| 2807 | } |
| 2808 | |
| 2809 | func TestCostTrackerActualCost(t *testing.T) { |
| 2810 | ct := &CostTracker{cost: 42} |
nothing calls this directly
no test coverage detected