Skip to content

Commit

Permalink
fix GPT partition table tests (#179)
Browse files Browse the repository at this point in the history
Signed-off-by: Avi Deitcher <[email protected]>
  • Loading branch information
deitch authored Apr 9, 2023
1 parent 5b6d86c commit fd11a09
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 1 addition & 4 deletions partition/gpt/table_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ func GetValidTable() *Table {
physicalSectorSize: 512,
},
}
// add 127 Unused partitions to the table
for i := 1; i < 128; i++ {
parts = append(parts, &Partition{Type: Unused})
}
// there are 127 Unused partitions, but those are ignored
table.Partitions = parts
return &table
}
Expand Down
4 changes: 2 additions & 2 deletions partition/gpt/table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ func TestTableWrite(t *testing.T) {
}
func TestGetPartitionSize(t *testing.T) {
table := GetValidTable()
request := 1
request := 0
size := table.Partitions[request].GetSize()
expected := int64(table.Partitions[request].Size)
if size != expected {
Expand All @@ -370,7 +370,7 @@ func TestGetPartitionStart(t *testing.T) {
maxPart := len(table.Partitions)
request := maxPart - 1
start := table.Partitions[request].GetStart()
expected := int64(table.Partitions[request].Start)
expected := int64(table.Partitions[request].Start * uint64(table.LogicalSectorSize))
if start != expected {
t.Errorf("received start %d instead of %d", start, expected)
}
Expand Down

0 comments on commit fd11a09

Please sign in to comment.