mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-03-30 15:08:28 +00:00

* adjusted re-issuance values and the corresponding test cases. * [test] Fix `TestPoPResult` * [test] Revert `TestReissuance` Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com> Signed-off-by: Julian Strobl <jmastr@mailbox.org> Co-authored-by: Julian Strobl <jmastr@mailbox.org>
65 lines
1.5 KiB
Go
65 lines
1.5 KiB
Go
package util
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"gotest.tools/assert"
|
|
)
|
|
|
|
func Test2FloatConvertion(t *testing.T) {
|
|
t.Parallel()
|
|
var expectedValue uint64 = 99885844748
|
|
value := RDDLToken2Uint(998.85844748)
|
|
assert.Equal(t, expectedValue, value)
|
|
}
|
|
|
|
func Test2UintConvertion(t *testing.T) {
|
|
t.Parallel()
|
|
expectedValue := 998.85844748
|
|
value := RDDLToken2Float(99885844748)
|
|
assert.Equal(t, expectedValue, value)
|
|
}
|
|
|
|
func TestStringToFloat(t *testing.T) {
|
|
t.Parallel()
|
|
expectedValue := 998.85844748
|
|
value, err := RDDLTokenStringToFloat("998.85844748")
|
|
assert.Equal(t, expectedValue, value)
|
|
assert.Equal(t, nil, err)
|
|
}
|
|
|
|
func TestStringToUint(t *testing.T) {
|
|
t.Parallel()
|
|
var expectedValue uint64 = 99885844748
|
|
value, err := RDDLTokenStringToUint("998.85844748")
|
|
assert.Equal(t, expectedValue, value)
|
|
assert.Equal(t, nil, err)
|
|
}
|
|
|
|
func TestAddPrecisionLongerThan8(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
var input uint64 = 99885844748
|
|
expectedValue := "998.85844748"
|
|
rddlTokenString := UintValueToRDDLTokenString(input)
|
|
assert.Equal(t, expectedValue, rddlTokenString)
|
|
}
|
|
|
|
func TestAddPrecisionEqual8(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
var input uint64 = 69000000
|
|
expectedValue := "0.69000000"
|
|
rddlTokenString := UintValueToRDDLTokenString(input)
|
|
assert.Equal(t, expectedValue, rddlTokenString)
|
|
}
|
|
|
|
func TestAddPrecisionShorterThan8(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
var input uint64 = 9000000
|
|
expectedValue := "0.09000000"
|
|
rddlTokenString := UintValueToRDDLTokenString(input)
|
|
assert.Equal(t, expectedValue, rddlTokenString)
|
|
}
|