Files
Alessandro ScandoneandGitHub 5dfc34cd3c feat: feature flag syntax (#120)
* feat: feature flag syntax

* feat: change syntax

* feat: reject invalid features

* feat: add static check of unknown features

* feat: more defensive args handling

* fix: fix typo
2026-03-04 13:32:35 +00:00

27 lines
608 B
Go

package parser_test
import (
"math/big"
"testing"
"github.com/formancehq/numscript/internal/parser"
"github.com/stretchr/testify/assert"
)
func TestPercentageLiteralToRatio(t *testing.T) {
assert.Equal(t, big.NewRat(123, 100), parser.PercentageLiteral{
Amount: big.NewInt(123),
FloatingDigits: 0,
}.ToRatio())
assert.Equal(t, big.NewRat(123, 1000), parser.PercentageLiteral{
Amount: big.NewInt(123),
FloatingDigits: 1,
}.ToRatio())
assert.Equal(t, big.NewRat(123, 10000), parser.PercentageLiteral{
Amount: big.NewInt(123),
FloatingDigits: 2,
}.ToRatio())
}