Number static data properties#1492
Conversation
|
amazing pr thank you! |
|
All of them have now been set up, I'll have to go through them and check that they are all correct, then I'll go ahead and write tests for them all. |
|
@Perryvw Do you think stuff like this should have testcases? And if so, what do you want us to test? I was looking at |
There was a problem hiding this comment.
These are indeed tricky to test since we can't compare them to the JS values. However, I think we can test their relative sizes within Lua? This somewhat sneakily also tests they are translated into correct code without compiler or runtime exceptions :)
I'm thinking something like:
test.each([
"Number.NEGATIVE_INFINITY < Number.MIN_VALUE",
"Number.MIN_VALUE < Number.MIN_SAFE_INTEGER",
"Number.MIN_SAFE_INTEGER < 0",
"0 < Number.EPSILON",
"Number.EPSILON < Number.MAX_SAFE_INTEGER",
"Number.MAX_SAFE_INTEGER < Number.MAX_VALUE",
"Number.MAX_VALUE < Number.POSITIVE_INFINITY"
])("Numer constants have correct relative sizes (%p)", comparison => {
util.testExpression(comparison).expectToEqual(true);
});|
Those tests look good yeah, but the So... for example in MAX_VALUE, do you think we should base that off of Lua's max value, or Javascript's max value? Because right now it is based off of Javascript's documentation. |
This is not done, please do not merge yet. Tests will be added once all data properties have been added.
This PR aims to provide all the data properties from JS's Number library.
Closes: #1108
Progress: