You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: loadpoint_phases_test.go
    path of file: ./repos/evcc/core
    
    the code of the file until where you have to start completion: package core

import (
	"strings"
	"testing"
	"time"

	evbus "github.com/asaskevich/EventBus"
	"github.com/benbjohnson/clock"
	"github.com/evcc-io/evcc/api"
	"github.com/evcc-io/evcc/util"
	"go.uber.org/mock/gomock"
)

type testCase struct {
	// capable=0 signals 1p3p as set during loadpoint init
	// physical/vehicle=0 signals unknown
	// measuredPhases<>0 signals previous measurement
	capable, physical, vehicle, measuredPhases, actExpected, maxExpected int
	// scaling expectation: d=down, u=up, du=both
	scale string
}

var phaseTests = []testCase{
	// 1p
	{1, 1, 0, 0, 1, 1, ""},
	{1, 1, 0, 1, 1, 1, ""},
	{1, 1, 1, 0, 1, 1, ""},
	{1, 1, 2, 0, 1, 1, ""},
	{1, 1, 3, 0, 1, 1, ""},
	// 3p
	{3, 3, 0, 0, unknownPhases, 3, ""},
	{3, 3, 0, 1, 1, 1, ""},
	{3, 3, 0, 2, 2, 2, ""},
	{3, 3, 0, 3, 3, 3, ""},
	{3, 3, 1, 0, 1, 1, ""},
	{3, 3, 2, 0, 2, 2, ""},
	{3, 3, 3, 0, 3, 3, ""},
	// 1p3p initial
	{0, 0, 0, 0, unknownPhases, 3, "du"},
	{0, 0, 0, 1, 1, 3, "u"},
	{0, 0, 0, 2, 2, 3, "du"},
	{0, 0, 0, 3, 3, 3, "du"},
	{0, 0, 1, 
    
func testScale(t *testing.T, lp *Loadpoint, sitePower float64, direction string, tc testCase) {
	t.Helper()

	act := lp.ActivePhases()
	max := lp.maxActivePhases()

	testDirection := direction[0:1] // (d)own or (u)p
	testExpectation := tc.scale

	// up-scale expected
	if testDirection == "u" && strings.Contains(testExpectation, testDirection) {
		// scale-up should only execute when the 1p max current is exceeded
		// we're testing this here and remove the upscale expectation for the following test below 1p max current
		if maxAmp := -sitePower / Voltage; maxAmp < maxA {
			if scaled := lp.pvScalePhases(sitePower, minA, maxAmp-0.0001); !scaled {
				t.Errorf("%v act=%d max=%d missing scale %s at reduced max current %.1fA", tc, act, max, direction, maxAmp)
			}

			// we've verified scale-up here so next test should not scale
			testExpectation = strings.ReplaceAll(testExpectation, testDirection, "")
		}
	}

	scaled := lp.pvScalePhases(sitePower, minA, maxA)

	if strings.Contains(testExpectation, testDirection) {
		if !scaled {
			t.Errorf("%v act=%d max=%d missing scale %s", tc, act, max, direction)
		}
	} else if scaled {
		t.Errorf("%v act=%d max=%d unexpected scale %s", tc, act, max, direction)
	}
}