Improved documentation

This commit is contained in:
Eduard Urbach 2025-02-20 23:54:13 +01:00
parent 36d0142573
commit 8b932fb332
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0
3 changed files with 55 additions and 8 deletions

View File

@ -33,7 +33,7 @@ You can take a look at the [examples](../examples).
go run gotest.tools/gotestsum@latest
```
This will run over 350 tests in various categories.
This will run over 350 [tests](../tests) in various categories.
## Platforms

View File

@ -17,6 +17,7 @@ func Finalize(a asm.Assembler, dlls dll.List) ([]byte, []byte) {
c := compiler{
code: make([]byte, 0, len(a.Instructions)*8),
codeLabels: make(map[string]Address, 32),
codePointers: make([]*pointer, 0, len(a.Instructions)*8),
codeStart: codeOffset(),
data: data,
dataLabels: dataLabels,

View File

@ -1,11 +1,57 @@
## Tests
Basic test run:
```shell
go test ./... -v -cover
go test ./... -v
```
Prettier output using `gotestsum`:
```shell
go run gotest.tools/gotestsum@latest
```
## Coverage
Generate a coverage profile:
```shell
go test -coverpkg=./... -coverprofile=cover.out ./...
```
View the data:
```shell
go tool cover -func cover.out
go tool cover -html cover.out
```
## Benchmarks
Run all benchmarks:
```shell
go test ./tests -run='^$' -bench=. -benchmem
```
Examples only:
```shell
go test ./tests -run='^$' -bench=Examples/ -benchmem
```
## Profiling
Generate a profile:
```shell
go test ./tests -run='^$' -bench=Examples/ -benchmem -cpuprofile cpu.out -memprofile mem.out
```
View the data:
```shell
go tool pprof --nodefraction=0.1 -http=:8080 ./cpu.out
go tool pprof --nodefraction=0.1 -http=:8080 ./mem.out
```