7 "review.coreboot.org/coreboot.git/util/intelp2m/config"
25 PlatformSpecificIf
interface {
26 GenMacro(string, uint32, uint32, uint8) string
31 func (p Pad
) toShortMacro(platform PlatformSpecificIf
) string {
32 config
.FldStyleSet("none")
33 config
.NonCheckingFlagSet(true)
34 return platform
.GenMacro(p
.ID
, p
.DW0
, p
.DW1
, p
.Ownership
)
37 func (p Pad
) toLongMacro(platform PlatformSpecificIf
) string {
38 config
.FldStyleSet("cb")
39 config
.NonCheckingFlagSet(false)
40 return platform
.GenMacro(p
.ID
, p
.DW0
, p
.DW1
, p
.Ownership
)
43 func (m
*Macro
) checkFor(platform PlatformSpecificIf
, pad Pad
) error
{
44 var format
string = "%s macro\nExpects: '%s'\nActually: '%s'\n\n"
45 if actually
:= pad
.toLongMacro(platform
); m
.Long
!= "" && m
.Long
!= actually
{
46 return fmt
.Errorf(format
, "LONG", m
.Long
, actually
)
48 if actually
:= pad
.toShortMacro(platform
); m
.Short
!= "" && m
.Short
!= actually
{
49 return fmt
.Errorf(format
, "SHORT", m
.Short
, actually
)
54 func (suite Suite
) Run(t
*testing
.T
, label
string, platform PlatformSpecificIf
) {
55 t
.Run(label
, func(t
*testing
.T
) {
56 for _
, testcase
:= range suite
{
57 if err
:= testcase
.Macro
.checkFor(platform
, testcase
.Pad
); err
!= nil {
58 t
.Errorf("Test failed for pad %s\n%v", testcase
.Pad
.ID
, err
)