Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
f7d59dfe
Commit
f7d59dfe
authored
Jul 08, 2019
by
Ryan Lopopolo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for Range#max and Range#min
parent
0484bf13
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
0 deletions
+42
-0
test/t/range.rb
test/t/range.rb
+42
-0
No files found.
test/t/range.rb
View file @
f7d59dfe
...
...
@@ -110,3 +110,45 @@ assert('Range#dup') do
assert_equal
r
.
end
,
"z"
assert_true
r
.
exclude_end?
end
assert
(
'Range#max'
)
do
assert_equal
10
,
(
1
..
10
).
max
assert_equal
9
,
(
1
...
10
).
max
assert_equal
nil
,
(
10
..
1
).
max
assert_equal
nil
,
(
10
...
1
).
max
# equal endpoints
assert_equal
5
,
(
5
..
5
).
max
assert_equal
nil
,
(
5
...
5
).
max
# block overrides comparison
assert_equal
(
10
,
(
1
..
10
).
max
{
|
a
,
b
|
a
<=>
b
})
assert_equal
(
9
,
(
1
...
10
).
max
{
|
a
,
b
|
a
<=>
b
})
assert_equal
(
nil
,
(
10
..
1
).
max
{
|
a
,
b
|
a
<=>
b
})
assert_equal
(
nil
,
(
10
...
1
).
max
{
|
a
,
b
|
a
<=>
b
})
assert_equal
(
1
,
(
1
..
10
).
max
{
|
a
,
b
|
b
<=>
a
})
assert_equal
(
1
,
(
1
...
10
).
max
{
|
a
,
b
|
b
<=>
a
})
assert_equal
(
nil
,
(
10
..
1
).
max
{
|
a
,
b
|
b
<=>
a
})
assert_equal
(
nil
,
(
10
...
1
).
max
{
|
a
,
b
|
b
<=>
a
})
end
assert
(
'Range#min'
)
do
assert_equal
1
,
(
1
..
10
).
min
assert_equal
1
,
(
1
...
10
).
min
assert_equal
nil
,
(
10
..
1
).
min
assert_equal
nil
,
(
10
...
1
).
min
# equal endpoints
assert_equal
7
,
(
7
..
7
).
min
assert_equal
nil
,
(
7
...
7
).
min
# block overrides comparison
assert_equal
(
1
,
(
1
..
10
).
min
{
|
a
,
b
|
a
<=>
b
})
assert_equal
(
1
,
(
1
...
10
).
min
{
|
a
,
b
|
a
<=>
b
})
assert_equal
(
nil
,
(
10
..
1
).
min
{
|
a
,
b
|
a
<=>
b
})
assert_equal
(
nil
,
(
10
...
1
).
min
{
|
a
,
b
|
a
<=>
b
})
assert_equal
(
10
,
(
1
..
10
).
min
{
|
a
,
b
|
b
<=>
a
})
assert_equal
(
9
,
(
1
...
10
).
min
{
|
a
,
b
|
b
<=>
a
})
assert_equal
(
nil
,
(
10
..
1
).
min
{
|
a
,
b
|
b
<=>
a
})
assert_equal
(
nil
,
(
10
...
1
).
min
{
|
a
,
b
|
b
<=>
a
})
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment