Skip to content

Commit

Permalink
Corrected writer log
Browse files Browse the repository at this point in the history
  • Loading branch information
Galaco committed Oct 1, 2023
1 parent 34dcdea commit f936906
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 20 deletions.
12 changes: 2 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Test and coverage
on:
push:
branches: [main]
branches:
- '*'
pull_request:
branches: [main]
jobs:
Expand All @@ -17,14 +18,5 @@ jobs:
uses: actions/setup-go@v2
with:
go-version: '1.19.0'
- name: Check gofmt on libs
run: |
unformatted_files=$(gofmt -l libs)
if [[ -n "$unformatted_files" ]]; then
echo "The following files are not properly formatted:"
echo "$unformatted_files"
echo "Run 'gofmt -w libs' to fix formatting."
exit 1
fi
- name: Run coverage
run: go test ./... -race -coverpkg=./libs/... -coverprofile=coverage.out -covermode=atomic
5 changes: 1 addition & 4 deletions lump/primitive/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,4 @@ type MapDispInfo struct {
}

// CompressedLightCube
type CompressedLightCube struct {
// Color
Color [6]ColorRGBExponent32 `json:"color"`
}
type CompressedLightCube = [6]ColorRGBExponent32
2 changes: 1 addition & 1 deletion lump/primitive/leafambientlighting/leafambientlighting.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ type LeafAmbientLighting struct {
// Z z
Z byte `json:"z"`
// Pad is padding to 4 bytes (any other purpose unknown).
Unknown1 byte
Pad byte
}
10 changes: 5 additions & 5 deletions writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ func TestWriter_Write(t *testing.T) {

expectedLumpOffset := int(binary.LittleEndian.Uint32(expectedBytes[offset : offset+4]))
expectedLumpLength := int(binary.LittleEndian.Uint32(expectedBytes[offset+4 : offset+8]))
actualLumpOffset := int(binary.LittleEndian.Uint32(expectedBytes[offset : offset+4]))
actualLumpLength := int(binary.LittleEndian.Uint32(expectedBytes[offset+4 : offset+8]))
actualLumpOffset := int(binary.LittleEndian.Uint32(actual[offset : offset+4]))
actualLumpLength := int(binary.LittleEndian.Uint32(actual[offset+4 : offset+8]))

log.Printf("%d: offset: %d, %d (%d). length: %d, %d (%d). Version: %d, %d\n", i,
expectedLumpOffset,
Expand Down Expand Up @@ -126,9 +126,9 @@ func TestWriter_Write(t *testing.T) {
t.Errorf("toBytes(%s) returned unexpected bytes", tc.filePath)
}

//if diff := cmp.Diff(expectedBytes, actual); diff != "" {
// t.Errorf("toBytes(%s) returned unexpected diff (-want +got):\n%s", tc.filePath, diff)
//}
if diff := cmp.Diff(expectedBytes, actual); diff != "" {
t.Errorf("toBytes(%s) returned unexpected diff (-want +got):\n%s", tc.filePath, diff)
}
}
})
}
Expand Down

0 comments on commit f936906

Please sign in to comment.