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 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 ## Platforms

View File

@ -15,12 +15,13 @@ func Finalize(a asm.Assembler, dlls dll.List) ([]byte, []byte) {
} }
c := compiler{ c := compiler{
code: make([]byte, 0, len(a.Instructions)*8), code: make([]byte, 0, len(a.Instructions)*8),
codeLabels: make(map[string]Address, 32), codeLabels: make(map[string]Address, 32),
codeStart: codeOffset(), codePointers: make([]*pointer, 0, len(a.Instructions)*8),
data: data, codeStart: codeOffset(),
dataLabels: dataLabels, data: data,
dlls: dlls, dataLabels: dataLabels,
dlls: dlls,
} }
for _, x := range a.Instructions { for _, x := range a.Instructions {

View File

@ -1,11 +1,57 @@
## Tests ## Tests
Basic test run:
```shell ```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 ## Benchmarks
Run all benchmarks:
```shell ```shell
go test ./tests -run='^$' -bench=. -benchmem 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
```