From dcd0a8d1d00e6f11c782332340e74e65a33158a1 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Thu, 20 Feb 2025 23:54:13 +0100 Subject: [PATCH] Improved documentation --- docs/readme.md | 2 +- src/asmc/Finalize.go | 13 +++++++------ tests/readme.md | 33 ++++++++++++++++++++++++++++++++- 3 files changed, 40 insertions(+), 8 deletions(-) diff --git a/docs/readme.md b/docs/readme.md index 8716f7e..842942e 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -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 diff --git a/src/asmc/Finalize.go b/src/asmc/Finalize.go index 71bb996..377b777 100644 --- a/src/asmc/Finalize.go +++ b/src/asmc/Finalize.go @@ -15,12 +15,13 @@ 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), - codeStart: codeOffset(), - data: data, - dataLabels: dataLabels, - dlls: dlls, + 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, + dlls: dlls, } for _, x := range a.Instructions { diff --git a/tests/readme.md b/tests/readme.md index 07bcf2e..fcd1389 100644 --- a/tests/readme.md +++ b/tests/readme.md @@ -1,11 +1,42 @@ ## 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 the coverage profile: + +```shell +go test -coverpkg=./... -coverprofile=cover.out ./... +``` + +View the data with the integrated tools: + +```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 ``` \ No newline at end of file