12345678910111213141516171819202122 |
- package buildin
- import "testing"
- func TestRangeInt(t *testing.T) {
- // Test case 1: min equals max
- min1 := uint(5)
- max1 := uint(5)
- expected1 := 5
- result1 := RangeInt(min1, max1)
- if result1 != expected1 {
- t.Errorf("Test case 1 failed. Expected %v, got %v", expected1, result1)
- }
- // Test case 2: min is less than max
- min2 := uint(1)
- max2 := uint(10)
- result2 := RangeInt(min2, max2)
- if result2 < int(min2) || result2 > int(max2) {
- t.Errorf("Test case 2 failed. Result %v is out of range", result2)
- }
- }
|