Use Go builtin min/max func

This commit is contained in:
Deluan
2024-02-16 21:48:25 -05:00
parent f7a4387d0e
commit 166eb37787
8 changed files with 18 additions and 74 deletions
+5 -21
View File
@@ -13,26 +13,10 @@ func TestNumber(t *testing.T) {
RunSpecs(t, "Number Suite")
}
var _ = Describe("Min", func() {
It("returns zero value if no arguments are passed", func() {
Expect(number.Min[int]()).To(BeZero())
})
It("returns the smallest int", func() {
Expect(number.Min(1, 2)).To(Equal(1))
})
It("returns the smallest float", func() {
Expect(number.Min(-4.1, -4.2, -4.0)).To(Equal(-4.2))
})
})
var _ = Describe("Max", func() {
It("returns zero value if no arguments are passed", func() {
Expect(number.Max[int]()).To(BeZero())
})
It("returns the biggest int", func() {
Expect(number.Max(1, 2)).To(Equal(2))
})
It("returns the biggest float", func() {
Expect(number.Max(-4.1, -4.2, -4.0)).To(Equal(-4.0))
var _ = Describe("RandomInt64", func() {
It("should return a random int64", func() {
for i := 0; i < 10000; i++ {
Expect(number.RandomInt64(100)).To(BeNumerically("<", 100))
}
})
})