source: EcnlProtoTool/trunk/mruby-2.1.1/mrbgems/mruby-string-ext/test/range.rb@ 439

Last change on this file since 439 was 439, checked in by coas-nagasima, 4 years ago

mrubyを2.1.1に更新

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-ruby;charset=UTF-8
File size: 833 bytes
Line 
1assert('Range#max') do
2 # returns the maximum value in the range when called with no arguments
3 assert_equal 'l', ('f'..'l').max
4 assert_equal 'e', ('a'...'f').max
5
6 # returns nil when the endpoint is less than the start point
7 assert_equal nil, ('z'..'l').max
8end
9
10assert('Range#max given a block') do
11 # returns nil when the endpoint is less than the start point
12 assert_equal nil, (('z'..'l').max { |x, y| x <=> y })
13end
14
15assert('Range#min') do
16 # returns the minimum value in the range when called with no arguments
17 assert_equal 'f', ('f'..'l').min
18
19 # returns nil when the start point is greater than the endpoint
20 assert_equal nil, ('z'..'l').min
21end
22
23assert('Range#min given a block') do
24 # returns nil when the start point is greater than the endpoint
25 assert_equal nil, (('z'..'l').min { |x, y| x <=> y })
26end
Note: See TracBrowser for help on using the repository browser.