Skip to content

Commit

Permalink
Merge pull request #38 from santanusinha/numeric-value-fix
Browse files Browse the repository at this point in the history
Moving NumericValue to double to ensure correctness during comparison
  • Loading branch information
santanusinha authored Jan 15, 2024
2 parents c43148f + 9590c2b commit 37b5609
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Use the following dependency in your code.
<dependency>
<groupId>io.appform.hope</groupId>
<artifactId>hope-lang</artifactId>
<version>2.0.5</version>
<version>2.0.6</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion dependencies.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
io.appform.hope:hope:pom:2.0.5
io.appform.hope:hope:pom:2.0.6
+- org.openjdk.jmh:jmh-core:jar:1.35:test
| +- net.sf.jopt-simple:jopt-simple:jar:5.0.4:test
| \- org.apache.commons:commons-math3:jar:3.2:test
Expand Down
2 changes: 1 addition & 1 deletion hope-core/dependencies.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
io.appform.hope:hope-core:jar:2.0.5
io.appform.hope:hope-core:jar:2.0.6
+- org.reflections:reflections:jar:0.9.12:compile
| \- org.javassist:javassist:jar:3.26.0-GA:compile
+- org.openjdk.jmh:jmh-core:jar:1.35:test
Expand Down
2 changes: 1 addition & 1 deletion hope-core/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>hope</artifactId>
<groupId>io.appform.hope</groupId>
<version>2.0.5</version>
<version>2.0.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>hope-core</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion hope-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>hope</artifactId>
<groupId>io.appform.hope</groupId>
<version>2.0.5</version>
<version>2.0.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class NumericValue extends EvaluatableValue<Number> {
* @param value Number value
*/
public NumericValue(Number value) {
super(value);
super(value.doubleValue());
}

/**
Expand Down
4 changes: 2 additions & 2 deletions hope-lang/dependencies.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
io.appform.hope:hope-lang:jar:2.0.5
+- io.appform.hope:hope-core:jar:2.0.5:compile
io.appform.hope:hope-lang:jar:2.0.6
+- io.appform.hope:hope-core:jar:2.0.6:compile
| \- org.reflections:reflections:jar:0.9.12:compile
| \- org.javassist:javassist:jar:3.26.0-GA:compile
+- ch.qos.logback:logback-classic:jar:1.2.10:test
Expand Down
2 changes: 1 addition & 1 deletion hope-lang/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>hope</artifactId>
<groupId>io.appform.hope</groupId>
<version>2.0.5</version>
<version>2.0.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ private static Stream<Arguments> rules() {
Arguments.of("{}", "(math.abs(math.sub(date.week_of_month(), %d)) <= 1 && math.abs(math.sub(date.week_of_month(), %d)) >= 0) || (math.abs(math.sub(date.week_of_month(), %d)) <= 6 && math.abs(math.sub(date.week_of_month(), %d)) >= 3)".formatted(weekOfMonth, weekOfMonth, weekOfMonth, weekOfMonth), true),
Arguments.of("{}", "(math.abs(math.sub(date.week_of_year(), %d)) <= 1 && math.abs(math.sub(date.week_of_year(), %d)) >= 0) || (math.abs(math.sub(date.week_of_year(), %d)) <= 54 && math.abs(math.sub(date.week_of_year(), %d)) >= 51)".formatted(weekOfYear, weekOfYear, weekOfYear, weekOfYear), true),
Arguments.of("{}", "(math.abs(math.sub(date.month_of_year(), %d)) <= 1 && math.abs(math.sub(date.month_of_year(), %d)) >= 0) || (math.abs(math.sub(date.month_of_year(), %d)) <= 12 && math.abs(math.sub(date.month_of_year(), %d)) >= 11)".formatted(dateTime.getMonth().getValue(), dateTime.getMonth().getValue(), dateTime.getMonth().getValue(), dateTime.getMonth().getValue()), true),
Arguments.of("{}", "(math.abs(math.sub(date.year(), %d)) <= 1 && math.abs(math.sub(date.year(), %d)) >= 0)".formatted(dateTime.getYear(), dateTime.getYear()), true)
Arguments.of("{}", "(math.abs(math.sub(date.year(), %d)) <= 1 && math.abs(math.sub(date.year(), %d)) >= 0)".formatted(dateTime.getYear(), dateTime.getYear()), true),
Arguments.of("{}", "date.week_of_month() == 1 || date.week_of_month() == 2 || date.week_of_month() == 3 || date.week_of_month() == 4 || date.week_of_month() == 5", true)

);
}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>io.appform.hope</groupId>
<artifactId>hope</artifactId>
<packaging>pom</packaging>
<version>2.0.5</version>
<version>2.0.6</version>

<name>Hope</name>
<url>https://github.com/santanusinha/hope</url>
Expand Down

0 comments on commit 37b5609

Please sign in to comment.