Skip to content

Commit

Permalink
Sync with upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
samifruit514 committed Mar 9, 2020
1 parent 6255f12 commit e6c1114
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func (cmd *UIntCommand) ValueAsLit() string {
// So PID 0x20 of Part 1 checks which PIDs in part 2 are supported, PID 0x40 of
// part 2 checks which PIDs in part 3 are supported, etc etc.
type PartSupported struct {
BaseCommand
baseCommand
UIntCommand
index byte
}
Expand All @@ -153,7 +153,7 @@ func NewPartSupported(index byte) *PartSupported {
pid := OBDParameterID((index - 1) * PartRange)

return &PartSupported{
BaseCommand{pid, 4, fmt.Sprintf("supported_commands_part%d", index)},
baseCommand{SERVICE_01_ID, pid, 4, fmt.Sprintf("supported_commands_part%d", index)},
UIntCommand{},
index,
}
Expand Down
4 changes: 2 additions & 2 deletions commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ func TestPartSupportedSupportsCommand(t *testing.T) {
}

func TestService01Command(t *testing.T) {
service01cmd := NewPart1Supported()
assert(t, service01cmd.ModeID() == SERVICE_01_ID, "Service id is not "+string(SERVICE_01_ID))
service01cmd := NewPartSupported(1)
assert(t, service01cmd.ModeID() == SERVICE_01_ID, fmt.Sprintf("Service id \"%d\" is not \"%d\"", service01cmd.ModeID(), SERVICE_01_ID))
}

func TestService04Command(t *testing.T) {
Expand Down
8 changes: 4 additions & 4 deletions device_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func TestGetPartByPID(t *testing.T) {
}

type DummyCommand struct {
BaseCommand
baseCommand
}

func (cmd *DummyCommand) ValueAsLit() string {
Expand Down Expand Up @@ -162,15 +162,15 @@ func TestIsSupportedWikipediaExample(t *testing.T) {

for _, pid := range supported {
cmd := &DummyCommand{
BaseCommand{pid, 1, "dummy"},
baseCommand{SERVICE_01_ID, pid, 1, "dummy"},
}

assertEqual(t, sc.IsSupported(cmd), true)
}

for _, pid := range unsupported {
cmd := &DummyCommand{
BaseCommand{pid, 1, "dummy"},
baseCommand{SERVICE_01_ID, pid, 1, "dummy"},
}

assertEqual(t, sc.IsSupported(cmd), false)
Expand Down Expand Up @@ -277,7 +277,7 @@ func TestIssue27Regression(t *testing.T) {

for _, pid := range supported {
cmd := &DummyCommand{
BaseCommand{pid, 1, "dummy"},
baseCommand{SERVICE_01_ID, pid, 1, "dummy"},
}

assertEqual(t, sc.IsSupported(cmd), true)
Expand Down

0 comments on commit e6c1114

Please sign in to comment.