fs storage

This commit is contained in:
Ilia Denisov
2026-03-13 21:07:23 +02:00
committed by GitHub
parent 43039a79bf
commit 9ade76e21d
117 changed files with 1734 additions and 176 deletions
+28
View File
@@ -0,0 +1,28 @@
package generator
import (
"fmt"
"testing"
"galaxy/util"
"github.com/stretchr/testify/assert"
)
func TestShortDistance(t *testing.T) {
for i, tc := range []struct {
w, h uint32
x1, y1, x2, y2, d float64
}{
{10, 10, 0, 0, 5, 5, 7.071},
{10, 10, 0, 0, 5.01, 5.01, 7.057},
{10, 10, 2, 2, 8, 2, 4.},
{10, 10, 8, 7, 1, 7, 3.},
} {
t.Run(fmt.Sprint(i), func(t *testing.T) {
m := Map{Width: tc.w, Height: tc.h}
d := m.ShortDistance(Coordinate{tc.x1, tc.y1}, Coordinate{tc.x2, tc.y2})
assert.Equal(t, tc.d, util.Fixed3(d))
})
}
}