Skip to content

decimal: improve test coverage, doc and examples #98

decimal: improve test coverage, doc and examples

decimal: improve test coverage, doc and examples #98

Workflow file for this run

on:
push:
branches: [main]
pull_request:
branches: [main]
name: decimal
jobs:
test:
strategy:
matrix:
go-version: [oldstable, stable]
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Check out code
uses: actions/checkout@v3
- name: Verify code formatting
run: gofmt -s -w . && git diff --exit-code
- name: Verify dependency consistency
run: go get -u -t . && go mod tidy && git diff --exit-code
- name: Verify generated code
run: go generate ./... && git diff --exit-code
- name: Verify potential issues
uses: golangci/golangci-lint-action@v3
- name: Run tests with coverage
run: go test -race -shuffle=on -coverprofile="coverage.txt" -covermode=atomic ./...
- name: Upload test coverage
if: matrix.os == 'ubuntu-latest' && matrix.go-version == 'stable'
uses: codecov/codecov-action@v3
fuzz:
needs: test
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: stable
- name: Check out code
uses: actions/checkout@v3
- name: Run fuzzing for string parsing
run: go test -fuzztime 20s -fuzz ^FuzzParse$ github.com/govalues/decimal
- name: Run fuzzing for string conversion
run: go test -fuzztime 20s -fuzz ^FuzzDecimalString$ github.com/govalues/decimal
- name: Run fuzzing for float64 conversion
run: go test -fuzztime 20s -fuzz ^FuzzDecimalFloat64$ github.com/govalues/decimal
- name: Run fuzzing for int64 conversion
run: go test -fuzztime 20s -fuzz ^FuzzDecimalInt64$ github.com/govalues/decimal
- name: Run fuzzing for addition
run: go test -fuzztime 20s -fuzz ^FuzzDecimalAdd$ github.com/govalues/decimal
- name: Run fuzzing for multiplication
run: go test -fuzztime 20s -fuzz ^FuzzDecimalMul$ github.com/govalues/decimal
- name: Run fuzzing for fused multiply-addition
run: go test -fuzztime 60s -fuzz ^FuzzDecimalFMA$ github.com/govalues/decimal
- name: Run fuzzing for division
run: go test -fuzztime 20s -fuzz ^FuzzDecimalQuo$ github.com/govalues/decimal
- name: Run fuzzing for integer division and remainder
run: go test -fuzztime 20s -fuzz ^FuzzDecimalQuoRem$ github.com/govalues/decimal
- name: Run fuzzing for comparison
run: go test -fuzztime 20s -fuzz ^FuzzDecimalCmp$ github.com/govalues/decimal
- name: Run fuzzing for comparison and subtraction
run: go test -fuzztime 20s -fuzz ^FuzzDecimalCmpSub$ github.com/govalues/decimal