Skip to content

def4ultx/decassert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Decimal Assert

Easier assert shopspring/decimal in large struct without failed from different exponential.

Usage

import (
    "testing"

    "github.com/shopspring/decimal"
    "github.com/def4ultx/decassert"
)

func TestDecimal(t *testing.T) {
    type Data struct {
        value decimal.Decimal
    }

    exp := Data{decimal.NewFromFloat(97406.784)}
    act := Data{decimal.NewFromFloat(97406.784)}
    decassert.Equal(t, exp, act)
}

How it work

decassert.Equal deep copy expected and actual value then set its decimal to zero and compare the result. If it pass it will get all underlying decimal including unexported field and compare.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages