support multi-module (#4)

* add multimodule
* re-package modules
This commit is contained in:
Ilia Denisov
2026-02-22 08:57:19 +02:00
committed by GitHub
parent 9e36d7151e
commit 8f982278d2
132 changed files with 317 additions and 191 deletions
+33
View File
@@ -0,0 +1,33 @@
package util
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
func TestFixed(t *testing.T) {
for _, tc := range []struct {
precision int
source, expected float64
}{
{3, 0, 0},
{3, -1, -1},
{3, 1.5, 1.5},
{3, 2.25, 2.25},
{3, 3.275, 3.275},
{3, 4.0004, 4.000},
{5, 5.000005, 5.00001},
{4, -6.00004, -6.},
{4, -6.00005, -6.0001},
} {
t.Run(fmt.Sprintf("%f", tc.source), func(t *testing.T) {
if tc.precision == 3 {
assert.Equal(t, tc.expected, Fixed3(tc.source))
} else {
assert.Equal(t, tc.expected, fixed(tc.source, tc.precision))
}
})
}
}