mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-06-29 17:32:30 +00:00

* [linter] Add `musttag` Enforce field tags in (un)marshaled structs. * [linter] Add `nestif` Reports deeply nested if statements. * [linter] Add `noctx` Finds sending http request without context.Context. * [linter] Add `paralleltest` Paralleltest detects missing usage of t.Parallel() method in your Go test. * [linter] Add `tagalign` Check that struct tags are well aligned. * [linter] Add `tagliatelle` Checks the struct tags. * [linter] Add `whitespace` Tool for detection of leading and trailing whitespace. * [paralleltest] Exclude files bc of data race in tests Signed-off-by: Julian Strobl <jmastr@mailbox.org>
38 lines
795 B
Go
38 lines
795 B
Go
package util
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"gotest.tools/assert"
|
|
)
|
|
|
|
func Test2FloatConvertion(t *testing.T) {
|
|
t.Parallel()
|
|
var expectedValue uint64 = 99869000000
|
|
value := RDDLToken2Uint(998.69)
|
|
assert.Equal(t, expectedValue, value)
|
|
}
|
|
|
|
func Test2UintConvertion(t *testing.T) {
|
|
t.Parallel()
|
|
expectedValue := 998.69
|
|
value := RDDLToken2Float(99869000000)
|
|
assert.Equal(t, expectedValue, value)
|
|
}
|
|
|
|
func TestStringToFloat(t *testing.T) {
|
|
t.Parallel()
|
|
expectedValue := 998.69
|
|
value, err := RDDLTokenStringToFloat("998.69")
|
|
assert.Equal(t, expectedValue, value)
|
|
assert.Equal(t, nil, err)
|
|
}
|
|
|
|
func TestStringToUint(t *testing.T) {
|
|
t.Parallel()
|
|
var expectedValue uint64 = 99869000000
|
|
value, err := RDDLTokenStringToUint("998.69")
|
|
assert.Equal(t, expectedValue, value)
|
|
assert.Equal(t, nil, err)
|
|
}
|