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
1b9708ef
Commit
1b9708ef
authored
Jul 22, 2012
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #390 from akuroda/float_test
add test cases in test/t/float.rb
parents
5926a440
9dd3ac36
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
6 deletions
+24
-6
test/t/float.rb
test/t/float.rb
+24
-6
No files found.
test/t/float.rb
View file @
1b9708ef
...
...
@@ -65,7 +65,11 @@ assert('Float#==', '15.2.9.3.7') do
end
assert
(
'Float#ceil'
,
'15.2.9.3.8'
)
do
3.123456789
.
ceil
==
4
a
=
3.123456789
.
ceil
b
=
3.0
.
ceil
c
=
-
3.123456789
.
ceil
d
=
-
3.0
.
ceil
a
==
4
and
b
==
3
and
c
==
-
3
and
d
==
-
3
end
assert
(
'Float#finite?'
,
'15.2.9.3.9'
)
do
...
...
@@ -74,20 +78,34 @@ assert('Float#finite?', '15.2.9.3.9') do
end
assert
(
'Float#floor'
,
'15.2.9.3.10'
)
do
3.123456789
.
floor
==
3
a
=
3.123456789
.
floor
b
=
3.0
.
floor
c
=
-
3.123456789
.
floor
d
=
-
3.0
.
floor
a
==
3
and
b
==
3
and
c
==
-
4
and
d
==
-
3
end
assert
(
'Float#infinite?'
,
'15.2.9.3.11'
)
do
not
3.123456789
.
infinite?
and
(
1.0
/
0.0
).
infinite?
a
=
3.123456789
.
infinite?
b
=
(
1.0
/
0.0
).
infinite?
c
=
(
-
1.0
/
0.0
).
infinite?
a
==
nil
and
b
==
1
and
c
==
-
1
end
assert
(
'Float#round'
,
'15.2.9.3.12'
)
do
a
=
3.123456789
.
round
b
=
3.5
.
round
c
=
3.499999999
.
round
d
=
(
-
3.123456789
).
round
e
=
(
-
3.5
).
round
f
=
12345.67
.
round
(
-
1
)
g
=
3.123456789
.
round
(
0
)
h
=
3.123456789
.
round
(
1
)
i
=
3.123456789
.
round
(
4
)
a
==
3
and
b
==
4
and
c
==
3
a
==
3
and
b
==
4
and
c
==
3
and
d
==
-
3
and
e
==
-
4
and
f
==
12350
and
g
==
3
and
h
==
3.1
and
i
==
3.1235
end
assert
(
'Float#to_f'
,
'15.2.9.3.13'
)
do
...
...
@@ -101,5 +119,5 @@ assert('Float#to_i', '15.2.9.3.14') do
end
assert
(
'Float#truncate'
,
'15.2.9.3.15'
)
do
3.123456789
.
truncate
==
3
3.123456789
.
truncate
==
3
and
-
3.1
.
truncate
==
-
3
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