From f86ef11ea42347c5f4a596d603935d224461ebc9 Mon Sep 17 00:00:00 2001 From: Tushar Naik Date: Mon, 15 Jan 2024 12:16:13 +0530 Subject: [PATCH 1/4] Moving NumericValue to double to ensure correctness during comparison --- .../main/java/io/appform/hope/core/values/NumericValue.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hope-core/src/main/java/io/appform/hope/core/values/NumericValue.java b/hope-core/src/main/java/io/appform/hope/core/values/NumericValue.java index ce696e6..11fbe77 100644 --- a/hope-core/src/main/java/io/appform/hope/core/values/NumericValue.java +++ b/hope-core/src/main/java/io/appform/hope/core/values/NumericValue.java @@ -25,13 +25,13 @@ @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class NumericValue extends EvaluatableValue { +public class NumericValue extends EvaluatableValue { /** * @param value Number value */ public NumericValue(Number value) { - super(value); + super(value.doubleValue()); } /** From 6c194bb66ffc5cd21aa348fd6291e16317f73f21 Mon Sep 17 00:00:00 2001 From: Tushar Naik Date: Mon, 15 Jan 2024 12:22:25 +0530 Subject: [PATCH 2/4] Bumped up version --- README.md | 2 +- hope-core/pom.xml | 2 +- hope-lang/pom.xml | 2 +- pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8c371ee..ef58fa6 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Use the following dependency in your code. io.appform.hope hope-lang - 2.0.5 + 2.0.6 ``` diff --git a/hope-core/pom.xml b/hope-core/pom.xml index 2f9e14c..55c9ab0 100644 --- a/hope-core/pom.xml +++ b/hope-core/pom.xml @@ -5,7 +5,7 @@ hope io.appform.hope - 2.0.5 + 2.0.6 4.0.0 diff --git a/hope-lang/pom.xml b/hope-lang/pom.xml index 00a697c..3681d90 100644 --- a/hope-lang/pom.xml +++ b/hope-lang/pom.xml @@ -5,7 +5,7 @@ hope io.appform.hope - 2.0.5 + 2.0.6 4.0.0 diff --git a/pom.xml b/pom.xml index b2e7606..db67f49 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ io.appform.hope hope pom - 2.0.5 + 2.0.6 Hope https://github.com/santanusinha/hope From d978463aa52c67390aefb2a99d9bd60ae16b2d20 Mon Sep 17 00:00:00 2001 From: Tushar-Naik Date: Mon, 15 Jan 2024 06:53:53 +0000 Subject: [PATCH 3/4] Comitting files changed by Github Actions Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- dependencies.txt | 2 +- hope-core/dependencies.txt | 2 +- hope-core/dependency-reduced-pom.xml | 2 +- hope-lang/dependencies.txt | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dependencies.txt b/dependencies.txt index b72c279..d1003b3 100644 --- a/dependencies.txt +++ b/dependencies.txt @@ -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 diff --git a/hope-core/dependencies.txt b/hope-core/dependencies.txt index 851b79e..c5d05b6 100644 --- a/hope-core/dependencies.txt +++ b/hope-core/dependencies.txt @@ -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 diff --git a/hope-core/dependency-reduced-pom.xml b/hope-core/dependency-reduced-pom.xml index 3fd6830..2e6d1d5 100644 --- a/hope-core/dependency-reduced-pom.xml +++ b/hope-core/dependency-reduced-pom.xml @@ -3,7 +3,7 @@ hope io.appform.hope - 2.0.5 + 2.0.6 4.0.0 hope-core diff --git a/hope-lang/dependencies.txt b/hope-lang/dependencies.txt index 24025ed..4a449c7 100644 --- a/hope-lang/dependencies.txt +++ b/hope-lang/dependencies.txt @@ -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 From 9590c2b413f7a2a540e442a9c18c3c7ede282453 Mon Sep 17 00:00:00 2001 From: Tushar Naik Date: Mon, 15 Jan 2024 14:20:46 +0530 Subject: [PATCH 4/4] Added a test for equals, also changed from EvaluatableValue to EvaluatableValue as it was unnecessary --- .../main/java/io/appform/hope/core/values/NumericValue.java | 2 +- .../test/java/io/appform/hope/lang/LibraryFunctionsTest.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hope-core/src/main/java/io/appform/hope/core/values/NumericValue.java b/hope-core/src/main/java/io/appform/hope/core/values/NumericValue.java index 11fbe77..bd094c4 100644 --- a/hope-core/src/main/java/io/appform/hope/core/values/NumericValue.java +++ b/hope-core/src/main/java/io/appform/hope/core/values/NumericValue.java @@ -25,7 +25,7 @@ @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class NumericValue extends EvaluatableValue { +public class NumericValue extends EvaluatableValue { /** * @param value Number value diff --git a/hope-lang/src/test/java/io/appform/hope/lang/LibraryFunctionsTest.java b/hope-lang/src/test/java/io/appform/hope/lang/LibraryFunctionsTest.java index fb60aad..e9e4f4f 100644 --- a/hope-lang/src/test/java/io/appform/hope/lang/LibraryFunctionsTest.java +++ b/hope-lang/src/test/java/io/appform/hope/lang/LibraryFunctionsTest.java @@ -258,7 +258,8 @@ private static Stream 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) ); }