Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages