feat(cpone): migrate lab registration endpoints
This commit is contained in:
16
internal/repository/lab_services_test.go
Normal file
16
internal/repository/lab_services_test.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package repository
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestAbsoluteSharesToPercentagesMatchesLaravel(t *testing.T) {
|
||||
result := absoluteSharesToPercentages([4]float64{50000, 30000, 10000, 10000}, 100000)
|
||||
expected := [4]float64{50, 30, 10, 10}
|
||||
if result != expected {
|
||||
t.Fatalf("shares = %v, want %v", result, expected)
|
||||
}
|
||||
|
||||
withRounding := absoluteSharesToPercentages([4]float64{1, 1, 1, 0}, 3)
|
||||
if withRounding != [4]float64{33.34, 33.33, 33.33, 0} {
|
||||
t.Fatalf("rounded shares = %v", withRounding)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user