-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add float type and test cases for float and double type. #187
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall.
I left some comments.
test/interface_basic_types.test.ts
Outdated
|
||
expect(test_interface.floatMethod(0.0)).toBe(0.0); | ||
|
||
var base = 1 / 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use const
instead of var
.
Also, you missed semi-colon ;
.
test/interface_basic_types.test.ts
Outdated
// the same, so we can not test the value out of the range. | ||
|
||
// NaN == NaN returns false, thus we must use isNaN function | ||
expect(isNaN(test_interface.doubleMethod(NaN))).toBe(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO, float
and double
SHOULD NOT take these special values such as NaN
, Infinity
and -Infinity
.
They are only allowed in unrestricted float
and unrestricted double
.
Please see: https://heycam.github.io/webidl/#idl-unrestricted-float
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@usefulhyun Ah, I didn't know that you already updated this patch.
Sorry for delayed review.
test/interface_basic_types.test.ts
Outdated
// unrestricted. | ||
const base = 1 / 2; | ||
const precision = 52; | ||
for (var test_case = 0; test_case < 100; test_case++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use let
instead of var
. The var
is function scope and let
is block scope.
So, we prefer to use let
to avoid unexpected behavior.
This patch includes the implementation of
float
typeand extensive test cases for
float
anddouble
type.float
type and its test interface.float
anddouble
type.ISSUE=#182