-
Notifications
You must be signed in to change notification settings - Fork 124
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
More blocking functions #292
More blocking functions #292
Conversation
Tested findTrainingData, Train etc. with 1 field for integer, double. |
|
||
public class TruncateDouble extends HashFunction implements UDF1<Double, Double> { | ||
int numDecimalPlaces; | ||
static final int[] POWERS_OF_10 = {1, 10, 100, 1000, 10000, 100000}; |
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.
why use this? just say 10 exp the argument.
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.
pow() seems a relatively expansive operation.
https://stackoverflow.com/questions/46983772/fastest-way-to-obtain-a-power-of-10
RangeDbl value = new RangeBetween0And10Dbl(); | ||
assertEquals(0, value.call((double) 867)); | ||
value = new RangeBetween10And100Dbl(); | ||
assertEquals(0, value.call((double) 867)); |
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.
saying 867d makes the code more readable..upto you if you feel that way.
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.
Updated
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; |
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.
tests for different classes should be in different junit classes. multiple asserts should not go into same unit test, as you dont know then which one broke. If you think it is too much to write junits for the derived classes, just test the main base class.
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.
Changes made
public class TestRangeInt { | ||
|
||
@Test | ||
public void testRangeForValueZero() { |
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.
same comment as earlier
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.
Changes Made
#261