Fix int types in OpenSubsonic responses.
Refer to https://support.symfonium.app/t/symfonium-sync-crashes-when-tpos-is-not-an-int/4204
This commit is contained in:
@@ -13,10 +13,27 @@ func TestNumber(t *testing.T) {
|
||||
RunSpecs(t, "Number Suite")
|
||||
}
|
||||
|
||||
var _ = Describe("RandomInt64", func() {
|
||||
It("should return a random int64", func() {
|
||||
for i := 0; i < 10000; i++ {
|
||||
Expect(number.RandomInt64(100)).To(BeNumerically("<", 100))
|
||||
}
|
||||
var _ = Describe("number package", func() {
|
||||
Describe("RandomInt64", func() {
|
||||
It("should return a random int64", func() {
|
||||
for i := 0; i < 10000; i++ {
|
||||
Expect(number.RandomInt64(100)).To(BeNumerically("<", 100))
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Describe("ParseInt", func() {
|
||||
It("should parse a string into an int", func() {
|
||||
Expect(number.ParseInt[int64]("123")).To(Equal(int64(123)))
|
||||
})
|
||||
It("should parse a string into an int32", func() {
|
||||
Expect(number.ParseInt[int32]("123")).To(Equal(int32(123)))
|
||||
})
|
||||
It("should parse a string into an int64", func() {
|
||||
Expect(number.ParseInt[int]("123")).To(Equal(123))
|
||||
})
|
||||
It("should parse a string into an uint", func() {
|
||||
Expect(number.ParseInt[uint]("123")).To(Equal(uint(123)))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user