Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
範囲の例をいくつか見てきました。
assert (0.0 .. 1.0).contains(0.5)
これについては True を期待しますが、これについては false になっていますか?
このアサーションが失敗した理由の手がかりはありますか?
Agroovy.lang.Rangeは値の aListでComparable、この場合は 2 です。そのため、List.containsが返さfalseれ0.5ます。代わりに欲しいのはRange.containsWithinBounds.
groovy.lang.Range
List
Comparable
List.contains
false
0.5
Range.containsWithinBounds