From 9590c2b413f7a2a540e442a9c18c3c7ede282453 Mon Sep 17 00:00:00 2001 From: Tushar Naik Date: Mon, 15 Jan 2024 14:20:46 +0530 Subject: [PATCH] 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) ); }